diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 96b8c1c0490ca..fd9a8d1dca7e3 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -644,6 +644,9 @@
Notification dismissed.
+
+ Bubble dismissed.
+
Notification shade.
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
index 35a4811110a83..b773bdbcc6928 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
@@ -15,6 +15,7 @@
*/
package com.android.systemui.bubbles;
+import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;
import static com.android.internal.annotations.VisibleForTesting.Visibility.PRIVATE;
import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_DATA;
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES;
@@ -772,7 +773,7 @@ public class BubbleData {
/**
* The set of bubbles in row.
*/
- @VisibleForTesting(visibility = PRIVATE)
+ @VisibleForTesting(visibility = PACKAGE)
public List getBubbles() {
return Collections.unmodifiableList(mBubbles);
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index d870c11915125..366d4a7345af8 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -1106,6 +1106,8 @@ public class BubbleStackView extends FrameLayout {
// R constants are not final so we cannot use switch-case here.
if (action == AccessibilityNodeInfo.ACTION_DISMISS) {
mBubbleData.dismissAll(BubbleController.DISMISS_ACCESSIBILITY_ACTION);
+ announceForAccessibility(
+ getResources().getString(R.string.accessibility_bubble_dismissed));
return true;
} else if (action == AccessibilityNodeInfo.ACTION_COLLAPSE) {
mBubbleData.setExpanded(false);
@@ -1136,32 +1138,29 @@ public class BubbleStackView extends FrameLayout {
if (mBubbleData.getBubbles().isEmpty()) {
return;
}
- Bubble topBubble = mBubbleData.getBubbles().get(0);
- String appName = topBubble.getAppName();
- Notification notification = topBubble.getEntry().getSbn().getNotification();
- CharSequence titleCharSeq = notification.extras.getCharSequence(Notification.EXTRA_TITLE);
- String titleStr = getResources().getString(R.string.notification_bubble_title);
- if (titleCharSeq != null) {
- titleStr = titleCharSeq.toString();
- }
- int moreCount = mBubbleContainer.getChildCount() - 1;
- // Example: Title from app name.
- String singleDescription = getResources().getString(
- R.string.bubble_content_description_single, titleStr, appName);
+ for (int i = 0; i < mBubbleData.getBubbles().size(); i++) {
+ final Bubble bubble = mBubbleData.getBubbles().get(i);
+ final String appName = bubble.getAppName();
+ final Notification notification = bubble.getEntry().getSbn().getNotification();
+ final CharSequence titleCharSeq =
+ notification.extras.getCharSequence(Notification.EXTRA_TITLE);
- // Example: Title from app name and 4 more.
- String stackDescription = getResources().getString(
- R.string.bubble_content_description_stack, titleStr, appName, moreCount);
+ String titleStr = getResources().getString(R.string.notification_bubble_title);
+ if (titleCharSeq != null) {
+ titleStr = titleCharSeq.toString();
+ }
- if (mIsExpanded) {
- // TODO(b/129522932) - update content description for each bubble in expanded view.
- } else {
- // Collapsed stack.
- if (moreCount > 0) {
- mBubbleContainer.setContentDescription(stackDescription);
- } else {
- mBubbleContainer.setContentDescription(singleDescription);
+ if (bubble.getIconView() != null) {
+ if (mIsExpanded || i > 0) {
+ bubble.getIconView().setContentDescription(getResources().getString(
+ R.string.bubble_content_description_single, titleStr, appName));
+ } else {
+ final int moreCount = mBubbleContainer.getChildCount() - 1;
+ bubble.getIconView().setContentDescription(getResources().getString(
+ R.string.bubble_content_description_stack,
+ titleStr, appName, moreCount));
+ }
}
}
}