Loading apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +8 −9 Original line number Original line Diff line number Diff line Loading @@ -3744,7 +3744,7 @@ public class JobSchedulerService extends com.android.server.SystemService // Enforce that only the app itself (or shared uid participant) can schedule a // Enforce that only the app itself (or shared uid participant) can schedule a // job that runs one of the app's services, as well as verifying that the // job that runs one of the app's services, as well as verifying that the // named service properly requires the BIND_JOB_SERVICE permission // named service properly requires the BIND_JOB_SERVICE permission private void enforceValidJobRequest(int uid, JobInfo job) { private void enforceValidJobRequest(int uid, int pid, JobInfo job) { final PackageManager pm = getContext() final PackageManager pm = getContext() .createContextAsUser(UserHandle.getUserHandleForUid(uid), 0) .createContextAsUser(UserHandle.getUserHandleForUid(uid), 0) .getPackageManager(); .getPackageManager(); Loading @@ -3768,6 +3768,10 @@ public class JobSchedulerService extends com.android.server.SystemService throw new IllegalArgumentException( throw new IllegalArgumentException( "Tried to schedule job for non-existent component: " + service); "Tried to schedule job for non-existent component: " + service); } } if (job.isPersisted() && !canPersistJobs(pid, uid)) { throw new IllegalArgumentException("Requested job cannot be persisted without" + " holding android.permission.RECEIVE_BOOT_COMPLETED permission"); } } } private boolean canPersistJobs(int pid, int uid) { private boolean canPersistJobs(int pid, int uid) { Loading Loading @@ -3915,13 +3919,7 @@ public class JobSchedulerService extends com.android.server.SystemService final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final int userId = UserHandle.getUserId(uid); final int userId = UserHandle.getUserId(uid); enforceValidJobRequest(uid, job); enforceValidJobRequest(uid, pid, job); if (job.isPersisted()) { if (!canPersistJobs(pid, uid)) { throw new IllegalArgumentException("Error: requested job be persisted without" + " holding RECEIVE_BOOT_COMPLETED permission."); } } final int result = validateJob(job, uid, -1, null, null); final int result = validateJob(job, uid, -1, null, null); if (result != JobScheduler.RESULT_SUCCESS) { if (result != JobScheduler.RESULT_SUCCESS) { Loading @@ -3948,9 +3946,10 @@ public class JobSchedulerService extends com.android.server.SystemService Slog.d(TAG, "Enqueueing job: " + job.toString() + " work: " + work); Slog.d(TAG, "Enqueueing job: " + job.toString() + " work: " + work); } } final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final int pid = Binder.getCallingPid(); final int userId = UserHandle.getUserId(uid); final int userId = UserHandle.getUserId(uid); enforceValidJobRequest(uid, job); enforceValidJobRequest(uid, pid, job); if (work == null) { if (work == null) { throw new NullPointerException("work is null"); throw new NullPointerException("work is null"); } } Loading Loading
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +8 −9 Original line number Original line Diff line number Diff line Loading @@ -3744,7 +3744,7 @@ public class JobSchedulerService extends com.android.server.SystemService // Enforce that only the app itself (or shared uid participant) can schedule a // Enforce that only the app itself (or shared uid participant) can schedule a // job that runs one of the app's services, as well as verifying that the // job that runs one of the app's services, as well as verifying that the // named service properly requires the BIND_JOB_SERVICE permission // named service properly requires the BIND_JOB_SERVICE permission private void enforceValidJobRequest(int uid, JobInfo job) { private void enforceValidJobRequest(int uid, int pid, JobInfo job) { final PackageManager pm = getContext() final PackageManager pm = getContext() .createContextAsUser(UserHandle.getUserHandleForUid(uid), 0) .createContextAsUser(UserHandle.getUserHandleForUid(uid), 0) .getPackageManager(); .getPackageManager(); Loading @@ -3768,6 +3768,10 @@ public class JobSchedulerService extends com.android.server.SystemService throw new IllegalArgumentException( throw new IllegalArgumentException( "Tried to schedule job for non-existent component: " + service); "Tried to schedule job for non-existent component: " + service); } } if (job.isPersisted() && !canPersistJobs(pid, uid)) { throw new IllegalArgumentException("Requested job cannot be persisted without" + " holding android.permission.RECEIVE_BOOT_COMPLETED permission"); } } } private boolean canPersistJobs(int pid, int uid) { private boolean canPersistJobs(int pid, int uid) { Loading Loading @@ -3915,13 +3919,7 @@ public class JobSchedulerService extends com.android.server.SystemService final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final int userId = UserHandle.getUserId(uid); final int userId = UserHandle.getUserId(uid); enforceValidJobRequest(uid, job); enforceValidJobRequest(uid, pid, job); if (job.isPersisted()) { if (!canPersistJobs(pid, uid)) { throw new IllegalArgumentException("Error: requested job be persisted without" + " holding RECEIVE_BOOT_COMPLETED permission."); } } final int result = validateJob(job, uid, -1, null, null); final int result = validateJob(job, uid, -1, null, null); if (result != JobScheduler.RESULT_SUCCESS) { if (result != JobScheduler.RESULT_SUCCESS) { Loading @@ -3948,9 +3946,10 @@ public class JobSchedulerService extends com.android.server.SystemService Slog.d(TAG, "Enqueueing job: " + job.toString() + " work: " + work); Slog.d(TAG, "Enqueueing job: " + job.toString() + " work: " + work); } } final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final int pid = Binder.getCallingPid(); final int userId = UserHandle.getUserId(uid); final int userId = UserHandle.getUserId(uid); enforceValidJobRequest(uid, job); enforceValidJobRequest(uid, pid, job); if (work == null) { if (work == null) { throw new NullPointerException("work is null"); throw new NullPointerException("work is null"); } } Loading