diff --git a/src/com/android/settings/notification/NotificationPreferenceController.java b/src/com/android/settings/notification/NotificationPreferenceController.java index 22f07be6d6b..3f535fb074f 100644 --- a/src/com/android/settings/notification/NotificationPreferenceController.java +++ b/src/com/android/settings/notification/NotificationPreferenceController.java @@ -111,6 +111,9 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc } protected boolean isChannelConfigurable() { + if (mAppRow != null && mAppRow.lockedImportance) { + return false; + } if (mChannel != null && mAppRow != null) { return !Objects.equals(mChannel.getId(), mAppRow.lockedChannelId); } diff --git a/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java index 1ad93780fa3..2368af5f94b 100644 --- a/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/NotificationPreferenceControllerTest.java @@ -218,6 +218,20 @@ public class NotificationPreferenceControllerTest { assertTrue(mController.isChannelConfigurable()); } + @Test + public void testIsConfigurable_appLevel() { + NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); + appRow.lockedChannelId = "something"; + appRow.lockedImportance = true; + + mController.onResume(appRow, mock(NotificationChannel.class), null, null); + assertFalse(mController.isChannelConfigurable()); + + appRow.lockedImportance = false; + mController.onResume(appRow, mock(NotificationChannel.class), null, null); + assertTrue(mController.isChannelConfigurable()); + } + @Test public void testIsChannelBlockable_nonSystemAppsBlockable() { NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();