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
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index 0e637a7..c7dbfdd 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -155,7 +155,7 @@
}
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 @@
});
} 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 @@
}
});
}
- 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) {