Merge "Allow some system channels to be blocked" into oc-dev am: 540e8f50e3
am: 166a994a4c
Change-Id: Ide3aeac0c328f08becc693795ef5553fa0c9a281
This commit is contained in:
@@ -201,7 +201,8 @@ public class AppNotificationSettings extends NotificationSettingsBase {
|
|||||||
final NotificationChannel channel) {
|
final NotificationChannel channel) {
|
||||||
MasterSwitchPreference channelPref = new MasterSwitchPreference(
|
MasterSwitchPreference channelPref = new MasterSwitchPreference(
|
||||||
getPrefContext());
|
getPrefContext());
|
||||||
channelPref.setSwitchEnabled(mSuspendedAppsAdmin == null && !mAppRow.systemApp);
|
channelPref.setSwitchEnabled(mSuspendedAppsAdmin == null
|
||||||
|
&& isChannelBlockable(mAppRow.systemApp, channel));
|
||||||
channelPref.setKey(channel.getId());
|
channelPref.setKey(channel.getId());
|
||||||
channelPref.setTitle(channel.getName());
|
channelPref.setTitle(channel.getName());
|
||||||
channelPref.setChecked(channel.getImportance() != IMPORTANCE_NONE);
|
channelPref.setChecked(channel.getImportance() != IMPORTANCE_NONE);
|
||||||
|
@@ -228,7 +228,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
|
|||||||
mBlockBar.setKey(KEY_BLOCK);
|
mBlockBar.setKey(KEY_BLOCK);
|
||||||
getPreferenceScreen().addPreference(mBlockBar);
|
getPreferenceScreen().addPreference(mBlockBar);
|
||||||
|
|
||||||
if (mAppRow.systemApp && mChannel.getImportance() != NotificationManager.IMPORTANCE_NONE) {
|
if (!isChannelBlockable(mAppRow.systemApp, mChannel)) {
|
||||||
setVisible(mBlockBar, false);
|
setVisible(mBlockBar, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -443,4 +443,12 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
|
|
||||||
return lockscreenSecure;
|
return lockscreenSecure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isChannelBlockable(boolean systemApp, NotificationChannel channel) {
|
||||||
|
if (!mAppRow.systemApp) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return channel.isBlockableSystem()
|
||||||
|
|| channel.getImportance() == NotificationManager.IMPORTANCE_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user