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

Commit f4b1bce7 authored by Evan Severson's avatar Evan Severson Committed by Cherrypicker Worker
Browse files

Clear historical record on all package uninstall broadcasts

When the last package is removed the uid removed signal can arrive
before which removes the UidState object from the data structure. This
caused the historical appops clearing call to never be made so the
registry is only correct during the first install.

Test: atests AppOpsTest --iterations 5, without then with the change.
Fixes: 333797941
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7a23d1f7fa42026c5b3b15bc282851bf497d97b7)
Merged-In: If7cc71bec2c609aed501fc06c875f87c167cf521
Change-Id: If7cc71bec2c609aed501fc06c875f87c167cf521
parent e5773136
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1364,6 +1364,9 @@ public class AppOpsService extends IAppOpsService.Stub {

    @GuardedBy("this")
    private void packageRemovedLocked(int uid, String packageName) {
        mHandler.post(PooledLambda.obtainRunnable(HistoricalRegistry::clearHistory,
                mHistoricalRegistry, uid, packageName));

        UidState uidState = mUidStates.get(uid);
        if (uidState == null) {
            return;
@@ -1398,9 +1401,6 @@ public class AppOpsService extends IAppOpsService.Stub {
                }
            }
        }

        mHandler.post(PooledLambda.obtainRunnable(HistoricalRegistry::clearHistory,
                    mHistoricalRegistry, uid, packageName));
    }

    public void uidRemoved(int uid) {