From a87cee11b6af5d2caa3a81aeb81b6219f0b3e75e Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 17 Nov 2017 15:04:40 -0500 Subject: [PATCH] Restore group block button. Test: RunSettingsRoboTests Bug: 63927402 Change-Id: I2e8163082d81d696dce2082be49a16c85458672b --- .../notification/NotificationPreferenceController.java | 2 +- .../notification/NotificationPreferenceControllerTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/notification/NotificationPreferenceController.java b/src/com/android/settings/notification/NotificationPreferenceController.java index b1ef69eaacf..797f30d3f7b 100644 --- a/src/com/android/settings/notification/NotificationPreferenceController.java +++ b/src/com/android/settings/notification/NotificationPreferenceController.java @@ -172,7 +172,7 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc } protected boolean isChannelGroupBlockable() { - if (mChannelGroup != null && mChannelGroup.getGroup() == null && mAppRow != null) { + if (mChannelGroup != null && mChannelGroup.getGroup() != null && mAppRow != null) { if (!mAppRow.systemApp) { return true; } diff --git a/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java index d6857402861..1f49ff2e514 100644 --- a/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java @@ -273,6 +273,7 @@ public class NotificationPreferenceControllerTest { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.systemApp = false; NotificationChannelGroupWrapper group = mock(NotificationChannelGroupWrapper.class); + when(group.getGroup()).thenReturn(mock(NotificationChannelGroup.class)); when(group.isBlocked()).thenReturn(false); mController.onResume(appRow, null, group, null); @@ -284,6 +285,7 @@ public class NotificationPreferenceControllerTest { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.systemApp = true; NotificationChannelGroupWrapper group = mock(NotificationChannelGroupWrapper.class); + when(group.getGroup()).thenReturn(mock(NotificationChannelGroup.class)); when(group.isBlocked()).thenReturn(false); mController.onResume(appRow, null, group, null); @@ -295,6 +297,7 @@ public class NotificationPreferenceControllerTest { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.systemApp = true; NotificationChannelGroupWrapper group = mock(NotificationChannelGroupWrapper.class); + when(group.getGroup()).thenReturn(mock(NotificationChannelGroup.class)); when(group.isBlocked()).thenReturn(true); mController.onResume(appRow, null, group, null);