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

Commit 7a23d1f7 authored by Evan Severson's avatar Evan Severson
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
Change-Id: If7cc71bec2c609aed501fc06c875f87c167cf521
parent 7b3ff2c8
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) {