diff options
| author | 2025-02-05 13:59:54 -0800 | |
|---|---|---|
| committer | 2025-02-05 13:59:54 -0800 | |
| commit | 78de01b80eb73c5160bbf8fecc11f25743b51d5d (patch) | |
| tree | 8aee9faa1440b1ad91cc66ef65719daeccb2d77b | |
| parent | 2aade0e48bd8deac1219394b8f8b6a0c46feff7d (diff) | |
| parent | 7b262abf1c29077a8c43312da866eb180333e3a7 (diff) | |
Merge "Rename to getNotificationChannelGroupsWithoutChannels" into main
5 files changed, 17 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 66e119fcf90f..3a3deb00562e 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -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); } diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java index 14728f4c796c..a171ffc2ed98 100644 --- a/services/core/java/com/android/server/notification/PreferencesHelper.java +++ b/services/core/java/com/android/server/notification/PreferencesHelper.java @@ -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); diff --git a/services/core/java/com/android/server/notification/RankingConfig.java b/services/core/java/com/android/server/notification/RankingConfig.java index 001e91cbea12..d5b8147a64ec 100644 --- a/services/core/java/com/android/server/notification/RankingConfig.java +++ b/services/core/java/com/android/server/notification/RankingConfig.java @@ -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); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 7010c5fca25c..0373eb6e9318 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -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 diff --git a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java index 66db5dd17564..3f26cd9258af 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java @@ -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( |