Merge "Fix hiding of channel fields" into qt-dev am: c14825c93d am: b1ec5751c1

am: 85a3096214

Change-Id: I0c5fc03a217e489cd1eec5022ecb42ace7390a0a
This commit is contained in:
Julia Reynolds
2019-05-22 16:31:19 -07:00
committed by android-build-merger
2 changed files with 6 additions and 2 deletions

View File

@@ -74,7 +74,9 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc
return false; return false;
} }
if (mChannelGroup != null) { if (mChannelGroup != null) {
return !mChannelGroup.isBlocked(); if (mChannelGroup.isBlocked()) {
return false;
}
} }
if (mChannel != null) { if (mChannel != null) {
return mChannel.getImportance() != IMPORTANCE_NONE; return mChannel.getImportance() != IMPORTANCE_NONE;

View File

@@ -105,10 +105,12 @@ public class NotificationPreferenceControllerTest {
@Test @Test
public void isAvailable_notIfChannelBlocked() { public void isAvailable_notIfChannelBlocked() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannelGroup group = mock(NotificationChannelGroup.class);
when(group.isBlocked()).thenReturn(false);
NotificationChannel channel = mock(NotificationChannel.class); NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE); when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
mController.onResume(appRow, channel, null, null); mController.onResume(appRow, channel, group, null);
assertFalse(mController.isAvailable()); assertFalse(mController.isAvailable());
} }