From c1ca4b81c17ebfbca7627db07bed088c5cb0ae7c Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Thu, 21 Jan 2021 11:13:57 -0500 Subject: [PATCH] Fix some issues with notif blocking in settings - Fix cast cast exception - Make sure unblocking a notification channel also actually unblocks it Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.notification" Fixes: 177968301 Fixes: 177907827 Change-Id: Ibad56e102e167bcf004fbd0f9873cc29834a30c1 --- res/xml/channel_notification_settings.xml | 5 ++--- .../settings/notification/app/BlockPreferenceController.java | 3 ++- .../notification/app/ChannelListPreferenceController.java | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/res/xml/channel_notification_settings.xml b/res/xml/channel_notification_settings.xml index ff1427b7d7b..44a21acbe4c 100644 --- a/res/xml/channel_notification_settings.xml +++ b/res/xml/channel_notification_settings.xml @@ -25,10 +25,9 @@ android:order="1" android:layout="@layout/settings_entity_header" /> - + android:order="2" /> { 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.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE); PrimarySwitchPreference channelPref1 = (PrimarySwitchPreference) preference;