Merge "Non-blockable notification packages can't be blocked." into nyc-mr1-dev
diff --git a/src/com/android/settings/notification/NotificationBackend.java b/src/com/android/settings/notification/NotificationBackend.java
index 944a1f2..1229b9e 100644
--- a/src/com/android/settings/notification/NotificationBackend.java
+++ b/src/com/android/settings/notification/NotificationBackend.java
@@ -60,6 +60,16 @@
public AppRow loadAppRow(Context context, PackageManager pm, PackageInfo app) {
final AppRow row = loadAppRow(context, pm, app.applicationInfo);
row.systemApp = Utils.isSystemPackage(context.getResources(), pm, app);
+ final String[] nonBlockablePkgs = context.getResources().getStringArray(
+ com.android.internal.R.array.config_nonBlockableNotificationPackages);
+ if (nonBlockablePkgs != null) {
+ int N = nonBlockablePkgs.length;
+ for (int i = 0; i < N; i++) {
+ if (app.packageName.equals(nonBlockablePkgs[i])) {
+ row.systemApp = true;
+ }
+ }
+ }
return row;
}
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index bce42eb..3469cc0 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -154,13 +154,13 @@
}
}
- protected void setupImportancePrefs(boolean isSystemApp, int importance, boolean banned) {
+ protected void setupImportancePrefs(boolean notBlockable, int importance, boolean banned) {
if (mShowSlider) {
setVisible(mBlock, false);
setVisible(mSilent, false);
mImportance.setDisabledByAdmin(mSuspendedAppsAdmin);
mImportance.setMinimumProgress(
- isSystemApp ? Ranking.IMPORTANCE_MIN : Ranking.IMPORTANCE_NONE);
+ notBlockable ? Ranking.IMPORTANCE_MIN : Ranking.IMPORTANCE_NONE);
mImportance.setMax(Ranking.IMPORTANCE_MAX);
mImportance.setProgress(importance);
mImportance.setAutoOn(importance == Ranking.IMPORTANCE_UNSPECIFIED);
@@ -175,7 +175,7 @@
});
} else {
setVisible(mImportance, false);
- if (isSystemApp) {
+ if (notBlockable) {
setVisible(mBlock, false);
} else {
boolean blocked = importance == Ranking.IMPORTANCE_NONE || banned;
@@ -191,20 +191,20 @@
return true;
}
});
-
- mSilent.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- final boolean silenced = (Boolean) newValue;
- final int importance =
- silenced ? Ranking.IMPORTANCE_LOW : Ranking.IMPORTANCE_UNSPECIFIED;
- mBackend.setImportance(mPkgInfo.packageName, mUid, importance);
- updateDependents(importance);
- return true;
- }
- });
- updateDependents(banned ? Ranking.IMPORTANCE_NONE : importance);
}
+ mSilent.setChecked(importance == Ranking.IMPORTANCE_LOW);
+ mSilent.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ final boolean silenced = (Boolean) newValue;
+ final int importance =
+ silenced ? Ranking.IMPORTANCE_LOW : Ranking.IMPORTANCE_UNSPECIFIED;
+ mBackend.setImportance(mPkgInfo.packageName, mUid, importance);
+ updateDependents(importance);
+ return true;
+ }
+ });
+ updateDependents(banned ? Ranking.IMPORTANCE_NONE : importance);
}
}