Merge "Allow some system channels to be blocked" into oc-dev
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 2035cd2..efcb5a1 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -203,7 +203,8 @@
final NotificationChannel channel) {
MasterSwitchPreference channelPref = new MasterSwitchPreference(
getPrefContext());
- channelPref.setSwitchEnabled(mSuspendedAppsAdmin == null && !mAppRow.systemApp);
+ channelPref.setSwitchEnabled(mSuspendedAppsAdmin == null
+ && isChannelBlockable(mAppRow.systemApp, channel));
channelPref.setKey(channel.getId());
channelPref.setTitle(channel.getName());
channelPref.setChecked(channel.getImportance() != IMPORTANCE_NONE);
diff --git a/src/com/android/settings/notification/ChannelNotificationSettings.java b/src/com/android/settings/notification/ChannelNotificationSettings.java
index 27e60c7..8c43a3f 100644
--- a/src/com/android/settings/notification/ChannelNotificationSettings.java
+++ b/src/com/android/settings/notification/ChannelNotificationSettings.java
@@ -232,7 +232,7 @@
mBlockBar.setKey(KEY_BLOCK);
getPreferenceScreen().addPreference(mBlockBar);
- if (mAppRow.systemApp && mChannel.getImportance() != NotificationManager.IMPORTANCE_NONE) {
+ if (!isChannelBlockable(mAppRow.systemApp, mChannel)) {
setVisible(mBlockBar, false);
}
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index 695c796..bfa9355 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -443,4 +443,12 @@
return lockscreenSecure;
}
+
+ protected boolean isChannelBlockable(boolean systemApp, NotificationChannel channel) {
+ if (!mAppRow.systemApp) {
+ return true;
+ }
+ return channel.isBlockableSystem()
+ || channel.getImportance() == NotificationManager.IMPORTANCE_NONE;
+ }
}