Merge "Prevent users from blocking system notifications." into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-06-14 22:25:25 +00:00
committed by Android (Google) Code Review

View File

@@ -175,6 +175,9 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
});
} else {
setVisible(mImportance, false);
if (isSystemApp) {
setVisible(mBlock, false);
} else {
boolean blocked = importance == Ranking.IMPORTANCE_NONE || banned;
mBlock.setChecked(blocked);
mBlock.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@@ -182,7 +185,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean blocked = (Boolean) newValue;
final int importance =
blocked ? Ranking.IMPORTANCE_NONE :Ranking.IMPORTANCE_UNSPECIFIED;
blocked ? Ranking.IMPORTANCE_NONE : Ranking.IMPORTANCE_UNSPECIFIED;
mBackend.setImportance(mPkgInfo.packageName, mUid, importance);
updateDependents(importance);
return true;
@@ -203,6 +206,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
updateDependents(banned ? Ranking.IMPORTANCE_NONE : importance);
}
}
}
protected void setupPriorityPref(boolean priority) {
mPriority.setDisabledByAdmin(mSuspendedAppsAdmin);