OSDN Git Service

Restore group block button.
authorJulia Reynolds <juliacr@google.com>
Fri, 17 Nov 2017 20:04:40 +0000 (15:04 -0500)
committerJulia Reynolds <juliacr@google.com>
Mon, 20 Nov 2017 14:11:57 +0000 (09:11 -0500)
Test: RunSettingsRoboTests
Bug: 63927402
Change-Id: I2e8163082d81d696dce2082be49a16c85458672b

src/com/android/settings/notification/NotificationPreferenceController.java
tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java

index b1ef69e..797f30d 100644 (file)
@@ -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;
             }
index d685740..1f49ff2 100644 (file)
@@ -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);