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

Commit 614b60cc authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Separate bundles from other channels

Test: PreferencesHelperTest
Test: BundleListPreferenceControllerTest
Flag: android.service.notification.notification_classification
Bug: 346612561
Change-Id: I152285c10cbdf73bcbee9fcd43a2118bfd235d6f
parent f31477f7
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -17,7 +17,11 @@
package com.android.server.notification;

import static android.app.AppOpsManager.OP_SYSTEM_ALERT_WINDOW;
import static android.app.NotificationChannel.NEWS_ID;
import static android.app.NotificationChannel.PLACEHOLDER_CONVERSATION_ID;
import static android.app.NotificationChannel.PROMOTIONS_ID;
import static android.app.NotificationChannel.RECS_ID;
import static android.app.NotificationChannel.SOCIAL_MEDIA_ID;
import static android.app.NotificationChannel.USER_LOCKED_IMPORTANCE;
import static android.app.NotificationManager.BUBBLE_PREFERENCE_ALL;
import static android.app.NotificationManager.BUBBLE_PREFERENCE_NONE;
@@ -1581,7 +1585,11 @@ public class PreferencesHelper implements RankingConfig {
                boolean includeChannel = (includeDeleted || !nc.isDeleted())
                        && (activeChannelFilter == null
                                || (includeBlocked && nc.getImportance() == IMPORTANCE_NONE)
                                || activeChannelFilter.contains(nc.getId()));
                                || activeChannelFilter.contains(nc.getId()))
                        && !PROMOTIONS_ID.equals(nc.getId())
                        && !NEWS_ID.equals(nc.getId())
                        && !SOCIAL_MEDIA_ID.equals(nc.getId())
                        && !RECS_ID.equals(nc.getId());
                if (includeChannel) {
                    if (nc.getGroup() != null) {
                        if (r.groups.get(nc.getGroup()) != null) {
+4 −3
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.permission.PermissionManager;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.FlagsParameterization;
import android.platform.test.flag.junit.SetFlagsRule;
@@ -2127,6 +2128,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
    }

    @Test
    @DisableFlags(FLAG_NOTIFICATION_CLASSIFICATION)
    public void testUpdate_preUpgrade_updatesAppFields() throws Exception {
        assertTrue(mHelper.canShowBadge(PKG_N_MR1, UID_N_MR1));
        assertEquals(Notification.PRIORITY_DEFAULT, mHelper.getPackagePriority(PKG_N_MR1, UID_N_MR1));
@@ -2907,6 +2909,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
    }

    @Test
    @DisableFlags(FLAG_NOTIFICATION_CLASSIFICATION)
    public void testOnlyHasDefaultChannel() throws Exception {
        assertTrue(mHelper.onlyHasDefaultChannel(PKG_N_MR1, UID_N_MR1));
        assertFalse(mHelper.onlyHasDefaultChannel(PKG_O, UID_O));
@@ -3317,9 +3320,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        assertEquals(3, actual.size());
        for (NotificationChannelGroup group : actual) {
            if (group.getId() == null) {
                assertEquals(
                        notificationClassification() ? 6 : 2,
                        group.getChannels().size()); // misc channel too
                assertEquals(2, group.getChannels().size());
                assertTrue(channel3.getId().equals(group.getChannels().get(0).getId())
                        || channel3.getId().equals(group.getChannels().get(1).getId()));
            } else if (group.getId().equals(ncg.getId())) {