Merge "Fix some issues with notif blocking in settings"

This commit is contained in:
Julia Reynolds
2021-01-25 17:18:53 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settings.notification.app; package com.android.settings.notification.app;
import static android.app.NotificationManager.IMPORTANCE_LOW;
import static android.app.NotificationManager.IMPORTANCE_NONE; import static android.app.NotificationManager.IMPORTANCE_NONE;
import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
@@ -107,7 +108,7 @@ public class BlockPreferenceController extends NotificationPreferenceController
? IMPORTANCE_NONE ? IMPORTANCE_NONE
: isDefaultChannel() : isDefaultChannel()
? IMPORTANCE_UNSPECIFIED ? IMPORTANCE_UNSPECIFIED
: mChannel.getOriginalImportance(); : Math.max(mChannel.getOriginalImportance(), IMPORTANCE_LOW);
mChannel.setImportance(importance); mChannel.setImportance(importance);
saveChannel(); saveChannel();
} }

View File

@@ -339,7 +339,9 @@ public class ChannelListPreferenceController extends NotificationPreferenceContr
channelPref.setOnPreferenceChangeListener( channelPref.setOnPreferenceChangeListener(
(preference, o) -> { (preference, o) -> {
boolean value = (Boolean) o; boolean value = (Boolean) o;
int importance = value ? channel.getOriginalImportance() : IMPORTANCE_NONE; int importance = value
? Math.max(channel.getOriginalImportance(), IMPORTANCE_LOW)
: IMPORTANCE_NONE;
channel.setImportance(importance); channel.setImportance(importance);
channel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE); channel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
PrimarySwitchPreference channelPref1 = (PrimarySwitchPreference) preference; PrimarySwitchPreference channelPref1 = (PrimarySwitchPreference) preference;