Merge remote-tracking branch 'origin/release' into dev
# Conflicts: # app/src/main/java/com/gh/gamecenter/catalog/CatalogFragment.kt # app/src/main/java/com/gh/gamecenter/catalog/SubCatalogFragment.kt
This commit is contained in:
@ -490,10 +490,15 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
* @param packageName 包名
|
||||
* @return null表示下载列表中不存在该任务,否则返回下载任务
|
||||
*/
|
||||
@Nullable
|
||||
public DownloadEntity getDownloadEntityByPackageName(String packageName) {
|
||||
if (mDownloadDao == null) return null;
|
||||
|
||||
for (DownloadEntity downloadEntity : mDownloadDao.getAll()) {
|
||||
List<DownloadEntity> downloadList = mDownloadDao.getAll();
|
||||
|
||||
if (downloadList == null) return null;
|
||||
|
||||
for (DownloadEntity downloadEntity : downloadList) {
|
||||
if (packageName.equals(downloadEntity.getPackageName())) {
|
||||
return downloadEntity;
|
||||
}
|
||||
@ -762,7 +767,16 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
serviceIntent.putExtra(DownloadService.KEY_SERVICE_ACTION, DownloadService.START_FOREGROUND);
|
||||
mContext.startForegroundService(serviceIntent);
|
||||
} else {
|
||||
mContext.startService(serviceIntent);
|
||||
/*
|
||||
* sentry上报oppo手机无法启动服务,原因:OPPO手机自动熄屏一段时间后,会启用系统自带的电量优化管理,禁止一切自启动的APP(用户设置的自启动白名单除外),所以在服务启动的地方进行try/catch防止崩溃,
|
||||
* https://sentry.ghzs.com/organizations/lightgame/issues/10707/?project=22&query=is%3Aunresolved+assigned%3Ame&statsPeriod=14d,
|
||||
* https://stackoverflow.com/questions/38764497/security-exception-unable-to-start-service-user-0-is-restricted
|
||||
*/
|
||||
ExtensionsKt.tryWithDefaultCatch(() -> {
|
||||
mContext.startService(serviceIntent);
|
||||
return null;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user