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

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

Merge "Check if the uid still exists before attempting to remove app op state" into main

parents 70282a7d 943e1d0c
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -223,3 +223,14 @@ flag {
    description: "Show access entry of location bypass permission in the Privacy Dashboard"
    bug: "325536053"
}

flag {
    name: "dont_remove_existing_uid_states"
    is_fixed_read_only: true
    namespace: "permissions"
    description: "Double check if the uid still exists before attempting to remove its appops state"
    bug: "353474742"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+16 −0
Original line number Diff line number Diff line
@@ -1413,6 +1413,22 @@ public class AppOpsService extends IAppOpsService.Stub {
    }

    public void uidRemoved(int uid) {
        if (Flags.dontRemoveExistingUidStates()) {
            // b/358365471 If apps sharing UID are installed on multiple users and only one of
            // them is installed for a single user while keeping the others we observe this
            // subroutine get invoked incorrectly since the UID still exists.
            final long token = Binder.clearCallingIdentity();
            try {
                String uidName = getPackageManagerInternal().getNameForUid(uid);
                if (uidName != null) {
                    Slog.e(TAG, "Tried to remove existing UID. uid: " + uid + " name: " + uidName);
                    return;
                }
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }

        synchronized (this) {
            if (mUidStates.indexOfKey(uid) >= 0) {
                mUidStates.get(uid).clear();