diff options
| author | 2023-11-30 18:12:31 +0000 | |
|---|---|---|
| committer | 2023-11-30 18:12:31 +0000 | |
| commit | f0d16342ae4d8c1748e85f2778ae704f352d69d5 (patch) | |
| tree | 925f29e9bd62e23d9964be94286c2a091d567323 | |
| parent | 4aa3999f54bc1348952ccc45a9828e44d99e89b7 (diff) | |
| parent | 0028af98ce492beceb643a5aa1f609848f91c86b (diff) | |
Merge "Throw the SecurityException only on V+ builds." into main
| -rw-r--r-- | apex/jobscheduler/service/aconfig/job.aconfig | 7 | ||||
| -rw-r--r-- | apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/apex/jobscheduler/service/aconfig/job.aconfig b/apex/jobscheduler/service/aconfig/job.aconfig index eb5502ba95d2..c65e50640ee9 100644 --- a/apex/jobscheduler/service/aconfig/job.aconfig +++ b/apex/jobscheduler/service/aconfig/job.aconfig @@ -5,4 +5,11 @@ flag { namespace: "backstage_power" description: "Only relax a prefetch job's connectivity constraint when the device is charging and battery is not low" bug: "299329948" +} + +flag { + name: "throw_on_unsupported_bias_usage" + namespace: "backstage_power" + description: "Throw an exception if an unsupported app uses JobInfo.setBias" + bug: "300477393" }
\ No newline at end of file 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 07475b4f2136..2d972d0eebe4 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java @@ -4358,7 +4358,8 @@ public class JobSchedulerService extends com.android.server.SystemService private JobInfo enforceBuilderApiPermissions(int uid, int pid, JobInfo job) { if (job.getBias() != JobInfo.BIAS_DEFAULT && !hasPermission(uid, pid, Manifest.permission.UPDATE_DEVICE_STATS)) { - if (CompatChanges.isChangeEnabled(THROW_ON_UNSUPPORTED_BIAS_USAGE, uid)) { + if (CompatChanges.isChangeEnabled(THROW_ON_UNSUPPORTED_BIAS_USAGE, uid) + && Flags.throwOnUnsupportedBiasUsage()) { throw new SecurityException("Apps may not call setBias()"); } else { // We can't throw the exception. Log the issue and modify the job to remove |