Delete deleteConversationNotificationChannels from NotificationManagerService.
This method isn't used anywhere and its functionality is superseded by onConversationRemoved, which handles deleted conversations. Test: atest NotificationManagerServiceTest Bug: 169349809 Change-Id: Iad7f592e71ecf425930e31873088a02e298380b3
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -3616,34 +3616,6 @@ public class NotificationManagerService extends SystemService {
|
||||
handleSavePolicyFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConversationNotificationChannels(String pkg, int uid,
|
||||
String conversationId) {
|
||||
checkCallerIsSystem();
|
||||
List<NotificationChannel> 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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user