Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c32db2d0 authored by mattgilbride's avatar mattgilbride
Browse files

JobSchedulerService - call PermissionEnforcer helper on methods annotated with @EnforcePermission

All java methods annotated with @EnforcePermission
must call super.<methodName>_enforcePermission
method provided by PermissionEnforcer.

This required by the @EnforcePermission annotation,
and enforced by a lint check.

This lint check does not yet run globally, causing
this to be missed. That problem is being addressed
imminently.

Bug: 236558918
Test: TH
Change-Id: Ie3ac9d33644f69e81d0570caf09036817f0d0d39
parent eae34494
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3824,6 +3824,7 @@ public class JobSchedulerService extends com.android.server.SystemService
        @Override
        @EnforcePermission(allOf = {MANAGE_ACTIVITY_TASKS, INTERACT_ACROSS_USERS_FULL})
        public void registerUserVisibleJobObserver(@NonNull IUserVisibleJobObserver observer) {
            super.registerUserVisibleJobObserver_enforcePermission();
            if (observer == null) {
                throw new NullPointerException("observer");
            }
@@ -3835,6 +3836,7 @@ public class JobSchedulerService extends com.android.server.SystemService
        @Override
        @EnforcePermission(allOf = {MANAGE_ACTIVITY_TASKS, INTERACT_ACROSS_USERS_FULL})
        public void unregisterUserVisibleJobObserver(@NonNull IUserVisibleJobObserver observer) {
            super.unregisterUserVisibleJobObserver_enforcePermission();
            if (observer == null) {
                throw new NullPointerException("observer");
            }
@@ -3842,8 +3844,9 @@ public class JobSchedulerService extends com.android.server.SystemService
        }

        @Override
        @EnforcePermission(allOf = {"MANAGE_ACTIVITY_TASKS", "INTERACT_ACROSS_USERS_FULL"})
        @EnforcePermission(allOf = {MANAGE_ACTIVITY_TASKS, INTERACT_ACROSS_USERS_FULL})
        public void stopUserVisibleJobsForUser(@NonNull String packageName, int userId) {
            super.stopUserVisibleJobsForUser_enforcePermission();
            if (packageName == null) {
                throw new NullPointerException("packageName");
            }