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

Commit 31719bf9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Delay user state deletion in AppOpsService" into main

parents 80b0f0c4 1198c4f3
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -551,6 +551,11 @@ public class AppOpsService extends IAppOpsService.Stub {
    @VisibleForTesting
    final Constants mConstants;

    /**
     * Some processes in the user may still be running when trying to drop the user's state
     */
    private static final long REMOVE_USER_DELAY = 5000L;

    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
    final class UidState {
        public final int uid;
@@ -6820,6 +6825,8 @@ public class AppOpsService extends IAppOpsService.Stub {
    @Override
    public void removeUser(int userHandle) throws RemoteException {
        checkSystemUid("removeUser");
        mHandler.postDelayed(() -> {
            Slog.i(TAG, "Removing user " + userHandle + " from AppOpsService");
            synchronized (AppOpsService.this) {
                final int tokenCount = mOpUserRestrictions.size();
                for (int i = tokenCount - 1; i >= 0; i--) {
@@ -6828,6 +6835,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                }
                removeUidsForUserLocked(userHandle);
            }
        }, REMOVE_USER_DELAY);
    }

    @Override