Loading core/java/android/app/INotificationManager.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,6 @@ interface INotificationManager void setInterruptionFilter(String pkg, int interruptionFilter, boolean fromUser); NotificationChannel createConversationNotificationChannelForPackageFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, String parentChannelId, String conversationId); void updateNotificationChannelGroupFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannelGroup group); void updateNotificationChannelFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannel channel); ParceledListSlice getNotificationChannelsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user); ParceledListSlice getNotificationChannelGroupsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user); Loading services/core/java/com/android/server/notification/NotificationManagerService.java +0 −19 Original line number Diff line number Diff line Loading @@ -7392,25 +7392,6 @@ public class NotificationManagerService extends SystemService { pkg, uid, parentId, conversationId, false, false).copy(); } @Override public void updateNotificationChannelGroupFromPrivilegedListener( INotificationListener token, String pkg, UserHandle user, NotificationChannelGroup group) throws RemoteException { Objects.requireNonNull(user); verifyPrivilegedListener(token, user, false); int packageUid = getUidForPackageAndUser(pkg, user); if (packageUid == INVALID_UID) { return; } NotificationChannelGroup previous = mPreferencesHelper.getNotificationChannelGroup( group.getId(), pkg, packageUid); if (previous == null) { return; } createNotificationChannelGroup(pkg, packageUid, group, false, true); handleSavePolicyFile(); } @Override public void updateNotificationChannelFromPrivilegedListener(INotificationListener token, String pkg, UserHandle user, NotificationChannel channel) throws RemoteException { Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +0 −59 Original line number Diff line number Diff line Loading @@ -5616,65 +5616,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { anyInt()); } @Test public void updateNotificationChannelGroupFromPrivilegedListener_cdm_success() throws Exception { NotificationChannelGroup createByApp = new NotificationChannelGroup("grp", "Group"); mService.mPreferencesHelper.createNotificationChannelGroup(mPkg, mUid, createByApp, true, mUid, false); NotificationChannelGroup updateByNls = new NotificationChannelGroup("grp", "Updated"); when(mCompanionMgr.getAssociations(mPkg, mUserId)) .thenReturn(singletonList(mock(AssociationInfo.class))); mBinderService.updateNotificationChannelGroupFromPrivilegedListener( null, mPkg, mUser, updateByNls); NotificationChannelGroup result = mService.mPreferencesHelper.getNotificationChannelGroup( "grp", mPkg, mUid); assertThat(result.getName().toString()).isEqualTo("Updated"); } @Test public void updateNotificationChannelGroupFromPrivilegedListener_noCdm_throws() throws Exception { when(mCompanionMgr.getAssociations(mPkg, mUserId)).thenReturn(Lists.newArrayList()); NotificationChannelGroup updateByNls = new NotificationChannelGroup("grp", "Updated"); SecurityException exception = assertThrows(SecurityException.class, () -> mBinderService.updateNotificationChannelGroupFromPrivilegedListener( null, mPkg, mUser, updateByNls)); assertThat(exception).hasMessageThat().contains("does not have access"); } @Test public void updateNotificationChannelGroupFromPrivilegedListener_wrongPackage_ignored() throws Exception { NotificationChannelGroup updateByNls = new NotificationChannelGroup("grp", "Updated"); when(mCompanionMgr.getAssociations(mPkg, mUserId)) .thenReturn(singletonList(mock(AssociationInfo.class))); mBinderService.updateNotificationChannelGroupFromPrivilegedListener( null, "com.package.does.not.exist", mUser, updateByNls); verify(mService.mPreferencesHelper, never()).createNotificationChannelGroup(any(), anyInt(), any(), anyBoolean(), anyInt(), anyBoolean()); } @Test public void updateNotificationChannelGroupFromPrivilegedListener_notAnUpdate_ignored() throws Exception { NotificationChannelGroup createByNls = new NotificationChannelGroup("grp", "New"); when(mCompanionMgr.getAssociations(mPkg, mUserId)) .thenReturn(singletonList(mock(AssociationInfo.class))); mBinderService.updateNotificationChannelGroupFromPrivilegedListener( null, mPkg, mUser, createByNls); verify(mService.mPreferencesHelper, never()).createNotificationChannelGroup(any(), anyInt(), any(), anyBoolean(), anyInt(), anyBoolean()); } @Test public void testGetPackagesWithChannels_blocked() throws Exception { // While we mostly rely on the PreferencesHelper implementation of channels, we filter in Loading Loading
core/java/android/app/INotificationManager.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,6 @@ interface INotificationManager void setInterruptionFilter(String pkg, int interruptionFilter, boolean fromUser); NotificationChannel createConversationNotificationChannelForPackageFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, String parentChannelId, String conversationId); void updateNotificationChannelGroupFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannelGroup group); void updateNotificationChannelFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user, in NotificationChannel channel); ParceledListSlice getNotificationChannelsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user); ParceledListSlice getNotificationChannelGroupsFromPrivilegedListener(in INotificationListener token, String pkg, in UserHandle user); Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +0 −19 Original line number Diff line number Diff line Loading @@ -7392,25 +7392,6 @@ public class NotificationManagerService extends SystemService { pkg, uid, parentId, conversationId, false, false).copy(); } @Override public void updateNotificationChannelGroupFromPrivilegedListener( INotificationListener token, String pkg, UserHandle user, NotificationChannelGroup group) throws RemoteException { Objects.requireNonNull(user); verifyPrivilegedListener(token, user, false); int packageUid = getUidForPackageAndUser(pkg, user); if (packageUid == INVALID_UID) { return; } NotificationChannelGroup previous = mPreferencesHelper.getNotificationChannelGroup( group.getId(), pkg, packageUid); if (previous == null) { return; } createNotificationChannelGroup(pkg, packageUid, group, false, true); handleSavePolicyFile(); } @Override public void updateNotificationChannelFromPrivilegedListener(INotificationListener token, String pkg, UserHandle user, NotificationChannel channel) throws RemoteException { Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +0 −59 Original line number Diff line number Diff line Loading @@ -5616,65 +5616,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { anyInt()); } @Test public void updateNotificationChannelGroupFromPrivilegedListener_cdm_success() throws Exception { NotificationChannelGroup createByApp = new NotificationChannelGroup("grp", "Group"); mService.mPreferencesHelper.createNotificationChannelGroup(mPkg, mUid, createByApp, true, mUid, false); NotificationChannelGroup updateByNls = new NotificationChannelGroup("grp", "Updated"); when(mCompanionMgr.getAssociations(mPkg, mUserId)) .thenReturn(singletonList(mock(AssociationInfo.class))); mBinderService.updateNotificationChannelGroupFromPrivilegedListener( null, mPkg, mUser, updateByNls); NotificationChannelGroup result = mService.mPreferencesHelper.getNotificationChannelGroup( "grp", mPkg, mUid); assertThat(result.getName().toString()).isEqualTo("Updated"); } @Test public void updateNotificationChannelGroupFromPrivilegedListener_noCdm_throws() throws Exception { when(mCompanionMgr.getAssociations(mPkg, mUserId)).thenReturn(Lists.newArrayList()); NotificationChannelGroup updateByNls = new NotificationChannelGroup("grp", "Updated"); SecurityException exception = assertThrows(SecurityException.class, () -> mBinderService.updateNotificationChannelGroupFromPrivilegedListener( null, mPkg, mUser, updateByNls)); assertThat(exception).hasMessageThat().contains("does not have access"); } @Test public void updateNotificationChannelGroupFromPrivilegedListener_wrongPackage_ignored() throws Exception { NotificationChannelGroup updateByNls = new NotificationChannelGroup("grp", "Updated"); when(mCompanionMgr.getAssociations(mPkg, mUserId)) .thenReturn(singletonList(mock(AssociationInfo.class))); mBinderService.updateNotificationChannelGroupFromPrivilegedListener( null, "com.package.does.not.exist", mUser, updateByNls); verify(mService.mPreferencesHelper, never()).createNotificationChannelGroup(any(), anyInt(), any(), anyBoolean(), anyInt(), anyBoolean()); } @Test public void updateNotificationChannelGroupFromPrivilegedListener_notAnUpdate_ignored() throws Exception { NotificationChannelGroup createByNls = new NotificationChannelGroup("grp", "New"); when(mCompanionMgr.getAssociations(mPkg, mUserId)) .thenReturn(singletonList(mock(AssociationInfo.class))); mBinderService.updateNotificationChannelGroupFromPrivilegedListener( null, mPkg, mUser, createByNls); verify(mService.mPreferencesHelper, never()).createNotificationChannelGroup(any(), anyInt(), any(), anyBoolean(), anyInt(), anyBoolean()); } @Test public void testGetPackagesWithChannels_blocked() throws Exception { // While we mostly rely on the PreferencesHelper implementation of channels, we filter in Loading