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

Commit fdd4e6bf authored by Louis Chang's avatar Louis Chang
Browse files

Clear calling identity before updating lock-task packages

Updating lock-task packages could end up pausing activities
and the operation is expected to be done on system uid.

Bug: 297335387
Test: atest LockTaskModeTests
Change-Id: I6c25926cb6c7156a03a29ebf046d1a5cc57a6d36
parent bf3c622e
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -2648,10 +2648,16 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            mAmInternal.enforceCallingPermission(Manifest.permission.UPDATE_LOCK_TASK_PACKAGES,
            mAmInternal.enforceCallingPermission(Manifest.permission.UPDATE_LOCK_TASK_PACKAGES,
                    "updateLockTaskPackages()");
                    "updateLockTaskPackages()");
        }
        }
        final long origId = Binder.clearCallingIdentity();
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
            ProtoLog.w(WM_DEBUG_LOCKTASK, "Allowlisting %d:%s", userId, Arrays.toString(packages));
                ProtoLog.w(WM_DEBUG_LOCKTASK, "Allowlisting %d:%s", userId,
                        Arrays.toString(packages));
                getLockTaskController().updateLockTaskPackages(userId, packages);
                getLockTaskController().updateLockTaskPackages(userId, packages);
            }
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
    }
    }


    @Override
    @Override