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

Commit 7450a3d9 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Fix history crash" into main

parents 5962d3de 34721557
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ public class NotificationHistoryManager {
                for (int i = 0; i < pendingPackageRemovals.size(); i++) {
                    userHistory.onPackageRemoved(pendingPackageRemovals.get(i));
                }
                mUserPendingPackageRemovals.put(userId, null);
                mUserPendingPackageRemovals.remove(userId);
            }

            // delete history if it was disabled when the user was locked
@@ -133,7 +133,7 @@ public class NotificationHistoryManager {
        synchronized (mLock) {
            // Actual data deletion is handled by other parts of the system (the entire directory is
            // removed) - we just need clean up our internal state for GC
            mUserPendingPackageRemovals.put(userId, null);
            mUserPendingPackageRemovals.remove(userId);
            mHistoryEnabled.put(userId, false);
            mUserPendingHistoryDisables.put(userId, false);
            onUserStopped(userId);
+10 −1
Original line number Diff line number Diff line
@@ -183,7 +183,6 @@ public class NotificationHistoryManagerTest extends UiServiceTestCase {
        assertThat(mHistoryManager.doesHistoryExistForUser(mProfileId)).isFalse();
        verify(mDb, times(2)).disableHistory();
    }

    @Test
    public void testAddProfile_historyEnabledInPrimary() {
        // create a history
@@ -610,4 +609,14 @@ public class NotificationHistoryManagerTest extends UiServiceTestCase {

        assertThat(mHistoryManager.isHistoryEnabled(USER_SYSTEM)).isFalse();
    }
    @Test
    public void testDelayedPackageRemoval_userLocked() {
        String pkg = "pkg";
        mHistoryManager.onPackageRemoved(USER_SYSTEM, pkg);
        mHistoryManager.onUserUnlocked(USER_SYSTEM);
        mHistoryManager.onUserStopped(USER_SYSTEM);
        mHistoryManager.onPackageRemoved(USER_SYSTEM, pkg);

        // no exception, yay
    }
}