From 514337c716ede5aded2c07bff4e143c792ccc7c7 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Mon, 24 Jan 2022 21:03:17 +0000 Subject: [PATCH] Fix Doze FGS job handling. While in Doze, jobs of apps the Foreground Service proc state or higher are only exempted if they're expedited or have the important-while-foreground bit set. We were accidentally considering all uidActive jobs as exempt, letting the device exit the Doze maintenance window early, and then stopping the uidActive app's jobs if they weren't exempted or had the important-while-foreground bit set. This meant that if only the app running a foreground service had jobs to run and the app didn't ask for the jobs to be exempted from Doze, the maintenance window would last for 30 seconds and the jobs would be stopped, but if there were other background jobs to be run, the maintenance window could last for the full time (10 minutes or whatever it would be). Fixing the inconsistency so that we don't exit a maintenance window early when there are non-exempt jobs running. Bug: 216150579 Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job Test: atest CtsJobSchedulerTestCases Change-Id: I07de57b364c9fee995eca020153622ba85d17c96 --- .../com/android/server/job/JobSchedulerService.java | 9 +++------ .../job/controllers/DeviceIdleJobsController.java | 4 ++-- .../com/android/server/job/controllers/JobStatus.java | 11 ++++++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java index 12a8654c61f70..d93ad3c0d8bc4 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java @@ -1633,12 +1633,9 @@ public class JobSchedulerService extends com.android.server.SystemService for (int i=0; i