Non-blockable notification packages can't be blocked.
Bug: 31404047 Change-Id: Icbe7e5e57983d281f6fe21e9b4715c822784d43c
This commit is contained in:
@@ -60,6 +60,16 @@ public class NotificationBackend {
|
|||||||
public AppRow loadAppRow(Context context, PackageManager pm, PackageInfo app) {
|
public AppRow loadAppRow(Context context, PackageManager pm, PackageInfo app) {
|
||||||
final AppRow row = loadAppRow(context, pm, app.applicationInfo);
|
final AppRow row = loadAppRow(context, pm, app.applicationInfo);
|
||||||
row.systemApp = Utils.isSystemPackage(context.getResources(), pm, app);
|
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;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -154,13 +154,13 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupImportancePrefs(boolean isSystemApp, int importance, boolean banned) {
|
protected void setupImportancePrefs(boolean notBlockable, int importance, boolean banned) {
|
||||||
if (mShowSlider) {
|
if (mShowSlider) {
|
||||||
setVisible(mBlock, false);
|
setVisible(mBlock, false);
|
||||||
setVisible(mSilent, false);
|
setVisible(mSilent, false);
|
||||||
mImportance.setDisabledByAdmin(mSuspendedAppsAdmin);
|
mImportance.setDisabledByAdmin(mSuspendedAppsAdmin);
|
||||||
mImportance.setMinimumProgress(
|
mImportance.setMinimumProgress(
|
||||||
isSystemApp ? Ranking.IMPORTANCE_MIN : Ranking.IMPORTANCE_NONE);
|
notBlockable ? Ranking.IMPORTANCE_MIN : Ranking.IMPORTANCE_NONE);
|
||||||
mImportance.setMax(Ranking.IMPORTANCE_MAX);
|
mImportance.setMax(Ranking.IMPORTANCE_MAX);
|
||||||
mImportance.setProgress(importance);
|
mImportance.setProgress(importance);
|
||||||
mImportance.setAutoOn(importance == Ranking.IMPORTANCE_UNSPECIFIED);
|
mImportance.setAutoOn(importance == Ranking.IMPORTANCE_UNSPECIFIED);
|
||||||
@@ -175,7 +175,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setVisible(mImportance, false);
|
setVisible(mImportance, false);
|
||||||
if (isSystemApp) {
|
if (notBlockable) {
|
||||||
setVisible(mBlock, false);
|
setVisible(mBlock, false);
|
||||||
} else {
|
} else {
|
||||||
boolean blocked = importance == Ranking.IMPORTANCE_NONE || banned;
|
boolean blocked = importance == Ranking.IMPORTANCE_NONE || banned;
|
||||||
@@ -191,7 +191,8 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
mSilent.setChecked(importance == Ranking.IMPORTANCE_LOW);
|
||||||
mSilent.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mSilent.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
@@ -206,7 +207,6 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
updateDependents(banned ? Ranking.IMPORTANCE_NONE : importance);
|
updateDependents(banned ? Ranking.IMPORTANCE_NONE : importance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected void setupPriorityPref(boolean priority) {
|
protected void setupPriorityPref(boolean priority) {
|
||||||
mPriority.setDisabledByAdmin(mSuspendedAppsAdmin);
|
mPriority.setDisabledByAdmin(mSuspendedAppsAdmin);
|
||||||
|
Reference in New Issue
Block a user