From db380fa9cb7eb3894d4a252a33fc9a6dfdc748f4 Mon Sep 17 00:00:00 2001 From: Geoffrey Pitsch Date: Wed, 28 Dec 2016 12:29:40 -0500 Subject: [PATCH] DO NOT MERGE Fix Notification Settings when unblockable app is blocked. When an app was blocked in the past, don't hide the controls so the user is able to unblock the app. After unblocking, the controls will be hidden the next time settings is visited. Bug:32557897 Change-Id: I7ab17f647b197162932b131c41bb18cf5c18917d --- .../notification/NotificationSettingsBase.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java index 0e637a79839..c7dbfdd8fa7 100644 --- a/src/com/android/settings/notification/NotificationSettingsBase.java +++ b/src/com/android/settings/notification/NotificationSettingsBase.java @@ -155,7 +155,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen } protected void setupImportancePrefs(boolean notBlockable, boolean notSilenceable, - int importance, boolean banned) { + int importance, boolean banned) { if (mShowSlider && !notSilenceable) { setVisible(mBlock, false); setVisible(mSilent, false); @@ -176,10 +176,11 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen }); } else { setVisible(mImportance, false); - if (notBlockable) { + // Hide controls that are not settable, unless they are already switched on. + final boolean blocked = (importance == Ranking.IMPORTANCE_NONE || banned); + if (notBlockable && !blocked) { setVisible(mBlock, false); } else { - boolean blocked = importance == Ranking.IMPORTANCE_NONE || banned; mBlock.setChecked(blocked); mBlock.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @@ -193,10 +194,11 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen } }); } - if (notSilenceable) { + final boolean silenced = (importance == Ranking.IMPORTANCE_LOW); + if (notSilenceable && !silenced) { setVisible(mSilent, false); } else { - mSilent.setChecked(importance == Ranking.IMPORTANCE_LOW); + mSilent.setChecked(silenced); mSilent.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) {