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

Commit dadb71af authored by Mykola Podolian's avatar Mykola Podolian Committed by Android (Google) Code Review
Browse files

Merge "Fixed issue with bubble prefs not restored." into main

parents b87c2275 9d22bb50
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -310,6 +310,7 @@ public class PreferencesHelper implements RankingConfig {
                    parser.getAttributeInt(null, ATT_VISIBILITY, DEFAULT_VISIBILITY),
                    parser.getAttributeBoolean(null, ATT_SHOW_BADGE, DEFAULT_SHOW_BADGE),
                    bubblePref);
            r.bubblePreference = bubblePref;
            r.priority = parser.getAttributeInt(null, ATT_PRIORITY, DEFAULT_PRIORITY);
            r.visibility = parser.getAttributeInt(null, ATT_VISIBILITY, DEFAULT_VISIBILITY);
            r.showBadge = parser.getAttributeBoolean(null, ATT_SHOW_BADGE, DEFAULT_SHOW_BADGE);
@@ -676,7 +677,7 @@ public class PreferencesHelper implements RankingConfig {
     * @param bubblePreference whether bubbles are allowed.
     */
    public void setBubblesAllowed(String pkg, int uid, int bubblePreference) {
        boolean changed = false;
        boolean changed;
        synchronized (mPackagePreferences) {
            PackagePreferences p = getOrCreatePackagePreferencesLocked(pkg, uid);
            changed = p.bubblePreference != bubblePreference;
+14 −0
Original line number Diff line number Diff line
@@ -3961,6 +3961,20 @@ public class PreferencesHelperTest extends UiServiceTestCase {
                mXmlHelper.getAppLockedFields(PKG_O, UID_O));
    }

    @Test
    public void testReadXml_existingPackage_bubblePrefsRestored() throws Exception {
        mHelper.setBubblesAllowed(PKG_O, UID_O, BUBBLE_PREFERENCE_ALL);
        assertEquals(BUBBLE_PREFERENCE_ALL, mHelper.getBubblePreference(PKG_O, UID_O));

        mXmlHelper.setBubblesAllowed(PKG_O, UID_O, BUBBLE_PREFERENCE_NONE);
        assertEquals(BUBBLE_PREFERENCE_NONE, mXmlHelper.getBubblePreference(PKG_O, UID_O));

        ByteArrayOutputStream stream = writeXmlAndPurge(PKG_O, UID_O, false, UserHandle.USER_ALL);
        loadStreamXml(stream, true, UserHandle.USER_ALL);

        assertEquals(BUBBLE_PREFERENCE_ALL, mXmlHelper.getBubblePreference(PKG_O, UID_O));
    }

    @Test
    public void testUpdateNotificationChannel_fixedPermission() {
        List<UserInfo> users = ImmutableList.of(new UserInfo(UserHandle.USER_SYSTEM, "user0", 0));