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

Commit 78de01b8 authored by Yuri Lin's avatar Yuri Lin Committed by Android (Google) Code Review
Browse files

Merge "Rename to getNotificationChannelGroupsWithoutChannels" into main

parents 2aade0e4 7b262abf
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -4998,8 +4998,8 @@ public class NotificationManagerService extends SystemService {
                getNotificationChannelGroupsWithoutChannels(String pkg) {
            checkCallerIsSystemOrSameApp(pkg);
            List<NotificationChannelGroup> groups = new ArrayList<>();
            groups.addAll(
                    mPreferencesHelper.getNotificationChannelGroups(pkg, Binder.getCallingUid()));
            groups.addAll(mPreferencesHelper.getNotificationChannelGroupsWithoutChannels(pkg,
                    Binder.getCallingUid()));
            return new ParceledListSlice<>(groups);
        }
@@ -7146,7 +7146,7 @@ public class NotificationManagerService extends SystemService {
            verifyPrivilegedListener(token, user, true);
            List<NotificationChannelGroup> groups = new ArrayList<>();
            groups.addAll(mPreferencesHelper.getNotificationChannelGroups(
            groups.addAll(mPreferencesHelper.getNotificationChannelGroupsWithoutChannels(
                    pkg, getUidForPackageAndUser(pkg, user)));
            return new ParceledListSlice<>(groups);
        }
+2 −2
Original line number Diff line number Diff line
@@ -1764,8 +1764,8 @@ public class PreferencesHelper implements RankingConfig {
     * structure; do not modify the returned groups before copying or parceling.
     */
    @Override
    public Collection<NotificationChannelGroup> getNotificationChannelGroups(String pkg,
            int uid) {
    public Collection<NotificationChannelGroup> getNotificationChannelGroupsWithoutChannels(
            String pkg, int uid) {
        List<NotificationChannelGroup> groups = new ArrayList<>();
        synchronized (mLock) {
            PackagePreferences r = getPackagePreferencesLocked(pkg, uid);
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public interface RankingConfig {
    boolean canShowNotificationsOnLockscreen(int userId);
    boolean canShowPrivateNotificationsOnLockScreen(int userId);

    Collection<NotificationChannelGroup> getNotificationChannelGroups(String pkg,
    Collection<NotificationChannelGroup> getNotificationChannelGroupsWithoutChannels(String pkg,
            int uid);
    void createNotificationChannelGroup(String pkg, int uid, NotificationChannelGroup group,
            boolean fromTargetApp, int callingUid, boolean isSystemOrSystemUi);
+6 −3
Original line number Diff line number Diff line
@@ -5339,7 +5339,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mBinderService.getNotificationChannelGroupsFromPrivilegedListener(
                null, mPkg, Process.myUserHandle());
        verify(mPreferencesHelper, times(1)).getNotificationChannelGroups(anyString(), anyInt());
        verify(mPreferencesHelper, times(1)).getNotificationChannelGroupsWithoutChannels(
                anyString(), anyInt());
    }
    @Test
@@ -5356,7 +5357,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
            // pass
        }
        verify(mPreferencesHelper, never()).getNotificationChannelGroups(anyString(), anyInt());
        verify(mPreferencesHelper, never()).getNotificationChannelGroupsWithoutChannels(anyString(),
                anyInt());
    }
    @Test
@@ -5376,7 +5378,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
            // pass
        }
        verify(mPreferencesHelper, never()).getNotificationChannelGroups(anyString(), anyInt());
        verify(mPreferencesHelper, never()).getNotificationChannelGroupsWithoutChannels(anyString(),
                anyInt());
    }
    @Test
+5 −4
Original line number Diff line number Diff line
@@ -3314,7 +3314,8 @@ public class PreferencesHelperTest extends UiServiceTestCase {
                PKG_N_MR1, UID_N_MR1, nonGroupedNonDeletedChannel.getId(), false));

        // notDeleted
        assertEquals(1, mHelper.getNotificationChannelGroups(PKG_N_MR1, UID_N_MR1).size());
        assertEquals(1, mHelper.getNotificationChannelGroups(PKG_N_MR1, UID_N_MR1,
                NotificationChannelGroupsHelper.Params.forAllGroups()).getList().size());

        verify(mHandler, never()).requestSort();

@@ -3474,7 +3475,7 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        assertNull(mHelper.getNotificationDelegate(PKG_O, UID_O));
        assertEquals(0, mHelper.getAppLockedFields(PKG_O, UID_O));
        assertEquals(0, mHelper.getRemovedPkgNotificationChannels(PKG_O, UID_O).size());
        assertEquals(0, mHelper.getNotificationChannelGroups(PKG_O, UID_O).size());
        assertEquals(0, mHelper.getNotificationChannelGroupsWithoutChannels(PKG_O, UID_O).size());

        NotificationChannel channel = getChannel();
        mHelper.createNotificationChannel(PKG_O, UID_O, channel, true, false,
@@ -3496,8 +3497,8 @@ public class PreferencesHelperTest extends UiServiceTestCase {
        NotificationChannelGroup ncg = new NotificationChannelGroup("group1", "name1");
        mHelper.createNotificationChannelGroup(PKG_N_MR1, UID_N_MR1, ncg, true,
                UID_N_MR1, false);
        assertEquals(ncg,
                mHelper.getNotificationChannelGroups(PKG_N_MR1, UID_N_MR1).iterator().next());
        assertEquals(ncg, mHelper.getNotificationChannelGroupsWithoutChannels(PKG_N_MR1,
                UID_N_MR1).iterator().next());
        verify(mHandler, never()).requestSort();
        assertEquals(1, mLogger.getCalls().size());
        assertEquals(