diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index bda2fa9b96229..a5f8f103e437f 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -104,7 +104,6 @@ interface INotificationManager void createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId); NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted); void deleteNotificationChannel(String pkg, String channelId); - void deleteConversationNotificationChannels(String pkg, int uid, String conversationId); ParceledListSlice getNotificationChannels(String callingPkg, String targetPkg, int userId); ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted); diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 4fc97ef606e22..68990ba77297a 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -3616,34 +3616,6 @@ public class NotificationManagerService extends SystemService { handleSavePolicyFile(); } - @Override - public void deleteConversationNotificationChannels(String pkg, int uid, - String conversationId) { - checkCallerIsSystem(); - List channels = - mPreferencesHelper.getNotificationChannelsByConversationId( - pkg, uid, conversationId); - if (!channels.isEmpty()) { - // Preflight for fg service notifications in these channels: do nothing - // unless they're all eligible - final int appUserId = UserHandle.getUserId(uid); - for (NotificationChannel nc : channels) { - final String channelId = nc.getId(); - mAmi.stopForegroundServicesForChannel(pkg, appUserId, channelId); - cancelAllNotificationsInt(MY_UID, MY_PID, pkg, nc.getId(), 0, 0, true, - appUserId, REASON_CHANNEL_REMOVED, null); - mPreferencesHelper.deleteNotificationChannel(pkg, uid, channelId); - mListeners.notifyNotificationChannelChanged(pkg, - UserHandle.getUserHandleForUid(uid), - mPreferencesHelper.getNotificationChannel( - pkg, uid, channelId, true), - NOTIFICATION_CHANNEL_OR_GROUP_DELETED); - } - handleSavePolicyFile(); - } - } - - @Override public NotificationChannelGroup getNotificationChannelGroup(String pkg, String groupId) { checkCallerIsSystemOrSameApp(pkg); 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 55ebe11e4ca8f..bb70c79328c31 100755 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -6971,51 +6971,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { assertNotNull(friendChannel.getId()); } - @Test - public void deleteConversationNotificationChannels() throws Exception { - NotificationChannel messagesParent = - new NotificationChannel("messages", "messages", IMPORTANCE_HIGH); - Parcel msgParcel = Parcel.obtain(); - messagesParent.writeToParcel(msgParcel, 0); - msgParcel.setDataPosition(0); - - NotificationChannel callsParent = - new NotificationChannel("calls", "calls", IMPORTANCE_HIGH); - Parcel callParcel = Parcel.obtain(); - callsParent.writeToParcel(callParcel, 0); - callParcel.setDataPosition(0); - - mBinderService.createNotificationChannels(PKG, new ParceledListSlice(Arrays.asList( - messagesParent, callsParent))); - - String conversationId = "friend"; - - mBinderService.createConversationNotificationChannelForPackage( - PKG, mUid, NotificationChannel.CREATOR.createFromParcel(msgParcel), - conversationId); - mBinderService.createConversationNotificationChannelForPackage( - PKG, mUid, NotificationChannel.CREATOR.createFromParcel(callParcel), - conversationId); - - NotificationChannel messagesChild = mBinderService.getConversationNotificationChannel( - PKG, 0, PKG, messagesParent.getId(), false, conversationId); - NotificationChannel callsChild = mBinderService.getConversationNotificationChannel( - PKG, 0, PKG, callsParent.getId(), false, conversationId); - - assertEquals(messagesParent.getId(), messagesChild.getParentChannelId()); - assertEquals(conversationId, messagesChild.getConversationId()); - - assertEquals(callsParent.getId(), callsChild.getParentChannelId()); - assertEquals(conversationId, callsChild.getConversationId()); - - mBinderService.deleteConversationNotificationChannels(PKG, mUid, conversationId); - - assertNull(mBinderService.getConversationNotificationChannel( - PKG, 0, PKG, messagesParent.getId(), false, conversationId)); - assertNull(mBinderService.getConversationNotificationChannel( - PKG, 0, PKG, callsParent.getId(), false, conversationId)); - } - @Test public void testCorrectCategory_systemOn_appCannotTurnOff() { int requested = 0;