summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ronish Kalia <ronish@google.com> 2023-03-19 11:26:38 +0000
committer Ronish Kalia <ronish@google.com> 2023-03-22 17:32:17 +0000
commit73f35cb9af67276c48f893564ba77d0baf592955 (patch)
tree3a8da098caf1e5b8f2d4faebbfe2acf8eeabcedb
parent21f7408abeb2e65d24685764ce1b195f092a68d3 (diff)
Allow non-empty namespaces in system uid to cancel all jobs
Bug: 273816163 Change-Id: I25ff81e231b420a2307cb768fe48d571b81d9bb1
-rw-r--r--apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java4
1 files changed, 3 insertions, 1 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 08810b549e62..26a3480ec367 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
@@ -1809,7 +1809,9 @@ public class JobSchedulerService extends com.android.server.SystemService
private boolean cancelJobsForUid(int uid, boolean includeSourceApp,
boolean namespaceOnly, @Nullable String namespace,
@JobParameters.StopReason int reason, int internalReasonCode, String debugReason) {
- if (uid == Process.SYSTEM_UID) {
+ // Non-null system namespace means the cancelling is limited to the namespace
+ // and won't cause issues for the system at large.
+ if (uid == Process.SYSTEM_UID && (!namespaceOnly || namespace == null)) {
Slog.wtfStack(TAG, "Can't cancel all jobs for system uid");
return false;
}