From 45e4b8948cb4fcad7c6baefbb47f684f8d201c92 Mon Sep 17 00:00:00 2001 From: Hall Liu Date: Thu, 12 Mar 2020 14:54:13 -0700 Subject: [PATCH] Rename NotificationChannel#setBlockableSystem Rename the method to setBlockable. Also rename isBlockableSystem in the same way. Bug: 151311073 Test: atest NotificationChannelTest Change-Id: I0504f8043dc864fe6677f2e65783068ffa3437ba --- .../contextualcards/slices/NotificationChannelSlice.java | 2 +- .../app/NotificationPreferenceController.java | 2 +- .../notification/app/BlockPreferenceControllerTest.java | 2 +- .../app/NotificationPreferenceControllerTest.java | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java index 5ac407d46e8..2716e4cf1df 100644 --- a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java +++ b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java @@ -467,7 +467,7 @@ public class NotificationChannelSlice implements CustomSliceable { return true; } - return channel.isBlockableSystem() + return channel.isBlockable() || channel.getImportance() == IMPORTANCE_NONE; } diff --git a/src/com/android/settings/notification/app/NotificationPreferenceController.java b/src/com/android/settings/notification/app/NotificationPreferenceController.java index be1ce1bda5b..ecba95b8985 100644 --- a/src/com/android/settings/notification/app/NotificationPreferenceController.java +++ b/src/com/android/settings/notification/app/NotificationPreferenceController.java @@ -134,7 +134,7 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc return channel.getImportance() == IMPORTANCE_NONE; } - return channel.isBlockableSystem() || !mAppRow.systemApp + return channel.isBlockable() || !mAppRow.systemApp || channel.getImportance() == IMPORTANCE_NONE; } return false; diff --git a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java index b83ab77a0c2..d203c47abc8 100644 --- a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java @@ -200,7 +200,7 @@ public class BlockPreferenceControllerTest { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.systemApp = true; NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_DEFAULT); - channel.setBlockableSystem(true); + channel.setBlockable(true); mController.onResume(appRow, channel, null, null, null, null); mController.updateState(mPreference); assertTrue(mSwitch.isEnabled()); diff --git a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java index 170a5e0901d..259f40ee299 100644 --- a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java @@ -236,7 +236,7 @@ public class NotificationPreferenceControllerTest { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.systemApp = false; NotificationChannel channel = mock(NotificationChannel.class); - when(channel.isBlockableSystem()).thenReturn(false); + when(channel.isBlockable()).thenReturn(false); mController.onResume(appRow, channel, null, null, null, null); assertTrue(mController.isChannelBlockable()); @@ -247,7 +247,7 @@ public class NotificationPreferenceControllerTest { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.systemApp = true; NotificationChannel channel = mock(NotificationChannel.class); - when(channel.isBlockableSystem()).thenReturn(false); + when(channel.isBlockable()).thenReturn(false); when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH); mController.onResume(appRow, channel, null, null, null, null); @@ -259,7 +259,7 @@ public class NotificationPreferenceControllerTest { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.systemApp = true; NotificationChannel channel = mock(NotificationChannel.class); - when(channel.isBlockableSystem()).thenReturn(true); + when(channel.isBlockable()).thenReturn(true); mController.onResume(appRow, channel, null, null, null, null); assertTrue(mController.isChannelBlockable()); @@ -270,7 +270,7 @@ public class NotificationPreferenceControllerTest { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.systemApp = true; NotificationChannel channel = mock(NotificationChannel.class); - when(channel.isBlockableSystem()).thenReturn(false); + when(channel.isBlockable()).thenReturn(false); when(channel.getImportance()).thenReturn(IMPORTANCE_NONE); mController.onResume(appRow, channel, null, null, null, null);