From e4dc6c972f462564538cd72979a518b4f52f55a7 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Mon, 25 Jul 2022 10:58:04 -0400 Subject: [PATCH] Only show the channel toast if users expressly ask for it Test: NotificationChannelWarningsPreferenceControllerTest.java Bug: 231150048 Change-Id: I4797a2184561ae3dcd03e62bfb78a90686458c6b --- ...icationChannelWarningsPreferenceController.java | 7 +------ ...ionChannelWarningsPreferenceControllerTest.java | 14 +------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/com/android/settings/development/NotificationChannelWarningsPreferenceController.java b/src/com/android/settings/development/NotificationChannelWarningsPreferenceController.java index 775b70871f2..22b3f8360c4 100644 --- a/src/com/android/settings/development/NotificationChannelWarningsPreferenceController.java +++ b/src/com/android/settings/development/NotificationChannelWarningsPreferenceController.java @@ -38,10 +38,6 @@ public class NotificationChannelWarningsPreferenceController extends final static int SETTING_VALUE_ON = 1; @VisibleForTesting final static int SETTING_VALUE_OFF = 0; - @VisibleForTesting - final static int DEBUGGING_ENABLED = 1; - @VisibleForTesting - final static int DEBUGGING_DISABLED = 0; public NotificationChannelWarningsPreferenceController(Context context) { super(context); @@ -64,9 +60,8 @@ public class NotificationChannelWarningsPreferenceController extends @Override public void updateState(Preference preference) { - final int defaultWarningEnabled = isDebuggable() ? DEBUGGING_ENABLED : DEBUGGING_DISABLED; final int mode = Settings.Global.getInt(mContext.getContentResolver(), - Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, defaultWarningEnabled); + Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0); ((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF); } diff --git a/tests/robotests/src/com/android/settings/development/NotificationChannelWarningsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/NotificationChannelWarningsPreferenceControllerTest.java index 7d08c66bb6c..1887247d44f 100644 --- a/tests/robotests/src/com/android/settings/development/NotificationChannelWarningsPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/development/NotificationChannelWarningsPreferenceControllerTest.java @@ -102,7 +102,7 @@ public class NotificationChannelWarningsPreferenceControllerTest { } @Test - public void updateState_settingUndefinedDebuggingEnabled_preferenceShouldBeChecked() { + public void updateState_settingUndefinedDebuggingEnabled_preferenceShouldNotBeChecked() { mController = spy(mController); doReturn(true).when(mController).isDebuggable(); Settings.Global.putString(mContext.getContentResolver(), @@ -110,18 +110,6 @@ public class NotificationChannelWarningsPreferenceControllerTest { mController.updateState(mPreference); - verify(mPreference).setChecked(true); - } - - @Test - public void updateState_settingUndefinedDebuggingDisabled_preferenceShouldNotBeChecked() { - mController = spy(mController); - doReturn(false).when(mController).isDebuggable(); - Settings.Global.putString(mContext.getContentResolver(), - Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, "NotAnInteger"); - - mController.updateState(mPreference); - verify(mPreference).setChecked(false); }