Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b24071b7 authored by Josh Tsuji's avatar Josh Tsuji Committed by Android (Google) Code Review
Browse files

Merge "Fix a11y issues." into rvc-dev

parents af242fb7 0f390fb0
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -644,6 +644,9 @@
    <!-- Content description to tell the user a notification has been removed from the notification shade -->
    <!-- Content description to tell the user a notification has been removed from the notification shade -->
    <string name="accessibility_notification_dismissed">Notification dismissed.</string>
    <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] -->
    <!-- Content description for the notification shade panel (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_desc_notification_shade">Notification shade.</string>
    <string name="accessibility_desc_notification_shade">Notification shade.</string>
    <!-- Content description for the quick settings panel (not shown on the screen). [CHAR LIMIT=NONE] -->
    <!-- Content description for the quick settings panel (not shown on the screen). [CHAR LIMIT=NONE] -->
+2 −1
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@
 */
 */
package com.android.systemui.bubbles;
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.internal.annotations.VisibleForTesting.Visibility.PRIVATE;
import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_DATA;
import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_DATA;
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES;
@@ -772,7 +773,7 @@ public class BubbleData {
    /**
    /**
     * The set of bubbles in row.
     * The set of bubbles in row.
     */
     */
    @VisibleForTesting(visibility = PRIVATE)
    @VisibleForTesting(visibility = PACKAGE)
    public List<Bubble> getBubbles() {
    public List<Bubble> getBubbles() {
        return Collections.unmodifiableList(mBubbles);
        return Collections.unmodifiableList(mBubbles);
    }
    }
+22 −23
Original line number Original line Diff line number Diff line
@@ -1106,6 +1106,8 @@ public class BubbleStackView extends FrameLayout {
        // R constants are not final so we cannot use switch-case here.
        // R constants are not final so we cannot use switch-case here.
        if (action == AccessibilityNodeInfo.ACTION_DISMISS) {
        if (action == AccessibilityNodeInfo.ACTION_DISMISS) {
            mBubbleData.dismissAll(BubbleController.DISMISS_ACCESSIBILITY_ACTION);
            mBubbleData.dismissAll(BubbleController.DISMISS_ACCESSIBILITY_ACTION);
            announceForAccessibility(
                    getResources().getString(R.string.accessibility_bubble_dismissed));
            return true;
            return true;
        } else if (action == AccessibilityNodeInfo.ACTION_COLLAPSE) {
        } else if (action == AccessibilityNodeInfo.ACTION_COLLAPSE) {
            mBubbleData.setExpanded(false);
            mBubbleData.setExpanded(false);
@@ -1136,32 +1138,29 @@ public class BubbleStackView extends FrameLayout {
        if (mBubbleData.getBubbles().isEmpty()) {
        if (mBubbleData.getBubbles().isEmpty()) {
            return;
            return;
        }
        }
        Bubble topBubble = mBubbleData.getBubbles().get(0);

        String appName = topBubble.getAppName();
        for (int i = 0; i < mBubbleData.getBubbles().size(); i++) {
        Notification notification = topBubble.getEntry().getSbn().getNotification();
            final Bubble bubble = mBubbleData.getBubbles().get(i);
        CharSequence titleCharSeq = notification.extras.getCharSequence(Notification.EXTRA_TITLE);
            final String appName = bubble.getAppName();
            final Notification notification = bubble.getEntry().getSbn().getNotification();
            final CharSequence titleCharSeq =
                    notification.extras.getCharSequence(Notification.EXTRA_TITLE);

            String titleStr = getResources().getString(R.string.notification_bubble_title);
            String titleStr = getResources().getString(R.string.notification_bubble_title);
            if (titleCharSeq != null) {
            if (titleCharSeq != null) {
                titleStr = titleCharSeq.toString();
                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);

        // Example: Title from app name and 4 more.
        String stackDescription = getResources().getString(
                R.string.bubble_content_description_stack, titleStr, appName, moreCount);


        if (mIsExpanded) {
            if (bubble.getIconView() != null) {
            // TODO(b/129522932) - update content description for each bubble in expanded view.
                if (mIsExpanded || i > 0) {
        } else {
                    bubble.getIconView().setContentDescription(getResources().getString(
            // Collapsed stack.
                            R.string.bubble_content_description_single, titleStr, appName));
            if (moreCount > 0) {
                mBubbleContainer.setContentDescription(stackDescription);
                } else {
                } else {
                mBubbleContainer.setContentDescription(singleDescription);
                    final int moreCount = mBubbleContainer.getChildCount() - 1;
                    bubble.getIconView().setContentDescription(getResources().getString(
                            R.string.bubble_content_description_stack,
                            titleStr, appName, moreCount));
                }
            }
            }
        }
        }
    }
    }