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

Commit 7a95ff7a authored by Winson's avatar Winson
Browse files

Remove pending/restored domain state when attaching

Otherwise it's persisted beyond the package's uninstall.

Bug: 182812601

Test: manual tested as part of writing CTS

Change-Id: I35072d6e4bf142db463860d01e0101098e82a185
parent 3780a17d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -867,13 +867,13 @@ public class DomainVerificationService extends SystemService
        boolean sendBroadcast = true;

        DomainVerificationPkgState pkgState;
        pkgState = mSettings.getPendingState(pkgName);
        pkgState = mSettings.removePendingState(pkgName);
        if (pkgState != null) {
            // Don't send when attaching from pending read, which is usually boot scan. Re-send on
            // boot is handled in a separate method once all packages are added.
            sendBroadcast = false;
        } else {
            pkgState = mSettings.getRestoredState(pkgName);
            pkgState = mSettings.removeRestoredState(pkgName);
        }

        AndroidPackage pkg = newPkgSetting.getPkg();
+4 −4
Original line number Diff line number Diff line
@@ -256,16 +256,16 @@ class DomainVerificationSettings {
    }

    @Nullable
    public DomainVerificationPkgState getPendingState(@NonNull String pkgName) {
    public DomainVerificationPkgState removePendingState(@NonNull String pkgName) {
        synchronized (mLock) {
            return mPendingPkgStates.get(pkgName);
            return mPendingPkgStates.remove(pkgName);
        }
    }

    @Nullable
    public DomainVerificationPkgState getRestoredState(@NonNull String pkgName) {
    public DomainVerificationPkgState removeRestoredState(@NonNull String pkgName) {
        synchronized (mLock) {
            return mRestoredPkgStates.get(pkgName);
            return mRestoredPkgStates.remove(pkgName);
        }
    }
}