diff options
authorSudheer Shanka <>2019-07-03 22:31:32 (GMT)
committerSudheer Shanka <>2019-07-03 22:45:32 (GMT)
commitbb4439869f5fbc943a9b8159eadfc717d133983a (patch)
parentf52b0bd3dfd214f7286191e420b9c05d31dafdb0 (diff)
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/ Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/ Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/ Change-Id: I020e366845d768da271b860a7ace91318e67d8ae
2 files changed, 2 insertions, 1 deletions
diff --git a/src/com/android/providers/downloads/ b/src/com/android/providers/downloads/
index d09738c..e1b2023 100644
--- a/src/com/android/providers/downloads/
+++ b/src/com/android/providers/downloads/
@@ -81,6 +81,7 @@ public class DownloadJobService extends JobService {
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/ b/src/com/android/providers/downloads/
index 7b4cb4e..565aa52 100644
--- a/src/com/android/providers/downloads/
+++ b/src/com/android/providers/downloads/
@@ -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);