From 9af95dae7dd4c1f8ec33ea959585584e7cbc9020 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Wed, 12 Aug 2020 12:17:41 -0700 Subject: [PATCH] Hide conversation bubble switch if app bubbles are off Fixes: 159340745 Test: BubblePreferenceControllerTest Test: priority conversation bubble => app bubbles OFF => toggle hidden => selected bubbles ON => toggle checked => app bubbles ON => toggle checked Test: default/silent conversation bubble => app bubbles OFF => toggle hidden => selected bubbles ON => toggle NOT checked => app bubbles ON => toggle NOT checked Change-Id: Ia5759c2a06c1da4d84b3dafed95e52c3aa30ad56 --- .../settings/notification/app/BubblePreferenceController.java | 2 +- .../notification/app/BubblePreferenceControllerTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/notification/app/BubblePreferenceController.java b/src/com/android/settings/notification/app/BubblePreferenceController.java index 1aed15609ca..722b27941ab 100644 --- a/src/com/android/settings/notification/app/BubblePreferenceController.java +++ b/src/com/android/settings/notification/app/BubblePreferenceController.java @@ -77,7 +77,7 @@ public class BubblePreferenceController extends NotificationPreferenceController if (isDefaultChannel()) { return true; } else { - return mAppRow != null; + return mAppRow != null && mAppRow.bubblePreference != BUBBLE_PREFERENCE_NONE; } } return true; diff --git a/tests/robotests/src/com/android/settings/notification/app/BubblePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/BubblePreferenceControllerTest.java index 6fec5250f19..afb3d1b0e7f 100644 --- a/tests/robotests/src/com/android/settings/notification/app/BubblePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/app/BubblePreferenceControllerTest.java @@ -137,7 +137,7 @@ public class BubblePreferenceControllerTest { } @Test - public void isAvailable_channel_yesIfAppOff() { + public void isAvailable_channel_notIfAppOff() { Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON); NotificationBackend.AppRow appRow = new NotificationBackend.AppRow(); appRow.bubblePreference = BUBBLE_PREFERENCE_NONE; @@ -145,7 +145,7 @@ public class BubblePreferenceControllerTest { when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH); mController.onResume(appRow, channel, null, null, null, null); - assertTrue(mController.isAvailable()); + assertFalse(mController.isAvailable()); } @Test