summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudheer Shanka <sudheersai@google.com>2019-07-03 22:31:32 (GMT)
committerSudheer Shanka <sudheersai@google.com>2019-07-03 22:45:32 (GMT)
commitbb4439869f5fbc943a9b8159eadfc717d133983a (patch)
tree13c905582c7705bde7d74bffab25f886e01088f2
parentf52b0bd3dfd214f7286191e420b9c05d31dafdb0 (diff)
downloadandroid_packages_providers_DownloadProvider-bb4439869f5fbc943a9b8159eadfc717d133983a.zip
android_packages_providers_DownloadProvider-bb4439869f5fbc943a9b8159eadfc717d133983a.tar.gz
android_packages_providers_DownloadProvider-bb4439869f5fbc943a9b8159eadfc717d133983a.tar.bz2
Set FGS priority for download jobs with visible notifications.
This is what DownloadProvider used to do pre-Q using PRIORITY_FOREGROUND_APP but in Q, we added a new priority to denote FGS but DownloadProvider was still using PRIORITY_FOREGROUND_APP which is now considered a lower priority than FGS and some jobs are getting preempted unnecessarily. So, update DownloadProvider to mark download jobs with FGS priority instead of BFGS priority. This still has some issues but at least this will be kind of reverting DownloadProvider to its pre-Q behavior. Bug: 135982638 Test: manual - Go through DO provisioning a few times and check admin app can be successfully downloaded. Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java Change-Id: I020e366845d768da271b860a7ace91318e67d8ae
-rw-r--r--src/com/android/providers/downloads/DownloadJobService.java1
-rw-r--r--src/com/android/providers/downloads/Helpers.java2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/com/android/providers/downloads/DownloadJobService.java b/src/com/android/providers/downloads/DownloadJobService.java
index d09738c..e1b2023 100644
--- a/src/com/android/providers/downloads/DownloadJobService.java
+++ b/src/com/android/providers/downloads/DownloadJobService.java
@@ -81,6 +81,7 @@ public class DownloadJobService extends JobService {
@Override
public boolean onStopJob(JobParameters params) {
final int id = params.getJobId();
+ Log.d(TAG, "onStopJob id=" + id + ", reason=" + params.getStopReason());
final DownloadThread thread;
synchronized (mActiveThreads) {
diff --git a/src/com/android/providers/downloads/Helpers.java b/src/com/android/providers/downloads/Helpers.java
index 7b4cb4e..565aa52 100644
--- a/src/com/android/providers/downloads/Helpers.java
+++ b/src/com/android/providers/downloads/Helpers.java
@@ -161,7 +161,7 @@ public class Helpers {
// When this download will show a notification, run with a higher
// priority, since it's effectively a foreground service
if (info.isVisible()) {
- builder.setPriority(JobInfo.PRIORITY_FOREGROUND_APP);
+ builder.setPriority(JobInfo.PRIORITY_FOREGROUND_SERVICE);
builder.setFlags(JobInfo.FLAG_WILL_BE_FOREGROUND);
}