diff --git a/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml b/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml index 298ad3025b00d..8d1da0f7ad1b3 100644 --- a/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml +++ b/libs/WindowManager/Shell/res/layout/bubble_manage_menu.xml @@ -63,11 +63,11 @@ android:tint="@color/bubbles_icon_tint"/> + android:textAppearance="@*android:style/TextAppearance.DeviceDefault" /> diff --git a/libs/WindowManager/Shell/res/values/strings.xml b/libs/WindowManager/Shell/res/values/strings.xml index 3082962e1a8ba..9f6cf79dcbc4b 100644 --- a/libs/WindowManager/Shell/res/values/strings.xml +++ b/libs/WindowManager/Shell/res/values/strings.xml @@ -146,6 +146,8 @@ %1$s settings Dismiss bubble + + Don\u2019t bubble Don\u2019t bubble conversation diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index 0b947c8b9b08e..deb4fd5f19bbd 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -844,6 +844,8 @@ public class BubbleStackView extends FrameLayout private DismissView mDismissView; private ViewGroup mManageMenu; + private TextView mManageDontBubbleText; + private ViewGroup mManageSettingsView; private ImageView mManageSettingsIcon; private TextView mManageSettingsText; private boolean mShowingManage = false; @@ -1217,7 +1219,11 @@ public class BubbleStackView extends FrameLayout mUnbubbleConversationCallback.accept(mBubbleData.getSelectedBubble().getKey()); }); - mManageMenu.findViewById(R.id.bubble_manage_menu_settings_container).setOnClickListener( + mManageDontBubbleText = mManageMenu + .findViewById(R.id.bubble_manage_menu_dont_bubble_text); + + mManageSettingsView = mManageMenu.findViewById(R.id.bubble_manage_menu_settings_container); + mManageSettingsView.setOnClickListener( view -> { showManageMenu(false /* show */); final BubbleViewProvider bubble = mBubbleData.getSelectedBubble(); @@ -2868,10 +2874,19 @@ public class BubbleStackView extends FrameLayout // name and icon. if (show) { final Bubble bubble = mBubbleData.getBubbleInStackWithKey(mExpandedBubble.getKey()); - if (bubble != null) { + if (bubble != null && !bubble.isAppBubble()) { + // Setup options for non app bubbles + mManageDontBubbleText.setText(R.string.bubbles_dont_bubble_conversation); mManageSettingsIcon.setImageBitmap(bubble.getRawAppBadge()); mManageSettingsText.setText(getResources().getString( R.string.bubbles_app_settings, bubble.getAppName())); + mManageSettingsView.setVisibility(VISIBLE); + } else { + // Setup options for app bubbles + mManageDontBubbleText.setText(R.string.bubbles_dont_bubble); + // App bubbles are not notification based + // so we don't show the option to go to notification settings + mManageSettingsView.setVisibility(GONE); } } @@ -2936,6 +2951,15 @@ public class BubbleStackView extends FrameLayout } } + /** + * Checks whether manage menu notification settings action is available and visible + * Used for testing + */ + @VisibleForTesting + public boolean isManageMenuSettingsVisible() { + return mManageSettingsView != null && mManageSettingsView.getVisibility() == VISIBLE; + } + private void updateExpandedBubble() { if (DEBUG_BUBBLE_STACK_VIEW) { Log.d(TAG, "updateExpandedBubble()"); diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java index 8e3988b2c0383..ee4e00baafe6f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -1245,6 +1245,24 @@ public class BubblesTest extends SysuiTestCase { // Show the menu stackView.showManageMenu(true); assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */); + assertTrue(stackView.isManageMenuSettingsVisible()); + } + + @Test + public void testShowManageMenuChangesSysuiState_appBubble() { + mBubbleController.showOrHideAppBubble(mAppBubbleIntent, mUser0); + assertTrue(mBubbleController.hasBubbles()); + + // Expand the stack + BubbleStackView stackView = mBubbleController.getStackView(); + mBubbleData.setExpanded(true); + assertStackExpanded(); + assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */); + + // Show the menu + stackView.showManageMenu(true); + assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */); + assertFalse(stackView.isManageMenuSettingsVisible()); } @Test