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

Commit 65ba824e authored by Mady Mellor's avatar Mady Mellor Committed by android-build-merger
Browse files

Merge "Make sure to update config when setBubblesAllowed is called for apps" into qt-dev

am: fb10308d

Change-Id: Ieccc69eaf6f148195fcd6fee95cdda1b98e6802f
parents 77bda459 fb10308d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -481,11 +481,16 @@ public class PreferencesHelper implements RankingConfig {
     * @param allowed whether bubbles are allowed.
     */
    public void setBubblesAllowed(String pkg, int uid, boolean allowed) {
        boolean changed = false;
        synchronized (mPackagePreferences) {
            PackagePreferences p = getOrCreatePackagePreferencesLocked(pkg, uid);
            changed = p.allowBubble != allowed;
            p.allowBubble = allowed;
            p.lockedAppFields = p.lockedAppFields | LockableAppFields.USER_LOCKED_BUBBLE;
        }
        if (changed) {
            updateConfig();
        }
    }

    /**
+7 −0
Original line number Diff line number Diff line
@@ -2676,4 +2676,11 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        assertTrue(mHelper.getNotificationChannel(PKG_O, UID_O, channel1.getId(), false)
                .isImportanceLockedByCriticalDeviceFunction());
    }

    @Test
    public void testSetBubblesAllowed_false() {
        mHelper.setBubblesAllowed(PKG_O, UID_O, false);
        assertFalse(mHelper.areBubblesAllowed(PKG_O, UID_O));
        verify(mHandler, times(1)).requestSort();
    }
}