From 3d04700c231e67c079d679dc508856ff6ef4dcb6 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 13 Jan 2022 06:40:19 +0000 Subject: [PATCH] Revert "Prevent apps from creating blocked channel groups" This reverts commit 1d65ccb49a56b426894b6f74ffdef6cd7b58c599. Reason for revert: Possible culprit of b/214331751 Change-Id: I315a4676a7f9107631f85a7be1cbac977bfbfb8f --- .../server/notification/PreferencesHelper.java | 3 --- .../notification/PreferencesHelperTest.java | 15 +-------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java index 0246c0c851cfc..258ae8c1c8496 100644 --- a/services/core/java/com/android/server/notification/PreferencesHelper.java +++ b/services/core/java/com/android/server/notification/PreferencesHelper.java @@ -848,9 +848,6 @@ public class PreferencesHelper implements RankingConfig { if (r == null) { throw new IllegalArgumentException("Invalid package"); } - if (fromTargetApp) { - group.setBlocked(false); - } final NotificationChannelGroup oldGroup = r.groups.get(group.getId()); if (oldGroup != null) { group.setChannels(oldGroup.getChannels()); 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 76bd4ebfb2286..d49cf670f471f 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java @@ -3173,19 +3173,6 @@ public class PreferencesHelperTest extends UiServiceTestCase { assertTrue(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); } - @Test - public void testIsGroupBlocked_appCannotCreateAsBlocked() throws Exception { - NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); - group.setBlocked(true); - mHelper.createNotificationChannelGroup(PKG_N_MR1, UID_N_MR1, group, true); - assertFalse(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); - - NotificationChannelGroup group3 = group.clone(); - group3.setBlocked(false); - mHelper.createNotificationChannelGroup(PKG_N_MR1, UID_N_MR1, group3, true); - assertFalse(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); - } - @Test public void testIsGroup_appCannotResetBlock() throws Exception { NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); @@ -4719,7 +4706,7 @@ public class PreferencesHelperTest extends UiServiceTestCase { public void testGetConversations_noDisabledGroups() { NotificationChannelGroup group = new NotificationChannelGroup("a", "a"); group.setBlocked(true); - mHelper.createNotificationChannelGroup(PKG_O, UID_O, group, false); + mHelper.createNotificationChannelGroup(PKG_O, UID_O, group, true); NotificationChannel parent = new NotificationChannel("parent", "p", 1); mHelper.createNotificationChannel(PKG_O, UID_O, parent, true, false);