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

Commit 4b331cc1 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Update AppOpsService to remove user state after the user is removed."

parents 2a2042a1 bc2fadd0
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -2277,6 +2277,16 @@ public class AppOpsService extends IAppOpsService.Stub {
                ClientRestrictionState opRestrictions = mOpUserRestrictions.valueAt(i);
                opRestrictions.removeUser(userHandle);
            }
            removeUidsForUserLocked(userHandle);
        }
    }

    private void removeUidsForUserLocked(int userHandle) {
        for (int i = mUidStates.size() - 1; i >= 0; --i) {
            final int uid = mUidStates.keyAt(i);
            if (UserHandle.getUserId(uid) == userHandle) {
                mUidStates.removeAt(i);
            }
        }
    }

@@ -2396,6 +2406,12 @@ public class AppOpsService extends IAppOpsService.Stub {
                    perUserExcludedPackages = null;
                }
            }
            if (perUserRestrictions != null) {
                perUserRestrictions.remove(userId);
                if (perUserRestrictions.size() <= 0) {
                    perUserRestrictions = null;
                }
            }
        }

        public boolean isDefault() {