Merge "Fix a11y issues." into rvc-dev
This commit is contained in:
@@ -644,6 +644,9 @@
|
||||
<!-- Content description to tell the user a notification has been removed from the notification shade -->
|
||||
<string name="accessibility_notification_dismissed">Notification dismissed.</string>
|
||||
|
||||
<!-- Content description to tell the user a bubble has been dismissed. -->
|
||||
<string name="accessibility_bubble_dismissed">Bubble dismissed.</string>
|
||||
|
||||
<!-- Content description for the notification shade panel (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_desc_notification_shade">Notification shade.</string>
|
||||
<!-- Content description for the quick settings panel (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||
|
||||
@@ -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<Bubble> getBubbles() {
|
||||
return Collections.unmodifiableList(mBubbles);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user