Merge "Delete deleteConversationNotificationChannels from NotificationManagerService." into sc-dev am: e0d692833e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13997625 Change-Id: If930361aeceddfa8f535bea9627450170773a001
This commit is contained in:
@@ -104,7 +104,6 @@ interface INotificationManager
|
|||||||
void createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId);
|
void createConversationNotificationChannelForPackage(String pkg, int uid, in NotificationChannel parentChannel, String conversationId);
|
||||||
NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted);
|
NotificationChannel getNotificationChannelForPackage(String pkg, int uid, String channelId, String conversationId, boolean includeDeleted);
|
||||||
void deleteNotificationChannel(String pkg, String channelId);
|
void deleteNotificationChannel(String pkg, String channelId);
|
||||||
void deleteConversationNotificationChannels(String pkg, int uid, String conversationId);
|
|
||||||
ParceledListSlice getNotificationChannels(String callingPkg, String targetPkg, int userId);
|
ParceledListSlice getNotificationChannels(String callingPkg, String targetPkg, int userId);
|
||||||
ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
|
ParceledListSlice getNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
|
||||||
int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
|
int getNumNotificationChannelsForPackage(String pkg, int uid, boolean includeDeleted);
|
||||||
|
|||||||
@@ -3616,34 +3616,6 @@ public class NotificationManagerService extends SystemService {
|
|||||||
handleSavePolicyFile();
|
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
|
@Override
|
||||||
public NotificationChannelGroup getNotificationChannelGroup(String pkg, String groupId) {
|
public NotificationChannelGroup getNotificationChannelGroup(String pkg, String groupId) {
|
||||||
checkCallerIsSystemOrSameApp(pkg);
|
checkCallerIsSystemOrSameApp(pkg);
|
||||||
|
|||||||
@@ -6971,51 +6971,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
|||||||
assertNotNull(friendChannel.getId());
|
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
|
@Test
|
||||||
public void testCorrectCategory_systemOn_appCannotTurnOff() {
|
public void testCorrectCategory_systemOn_appCannotTurnOff() {
|
||||||
int requested = 0;
|
int requested = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user