Loading apex/jobscheduler/service/aconfig/job.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,10 @@ flag { 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 apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
apex/jobscheduler/service/aconfig/job.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,10 @@ flag { 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
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -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 Loading