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

Commit c9cd5689 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Screen Chips] Make chips accessible.

Two accessibility changes:
1) Add content descriptions to each of the chip types
2) For the screen recording countdown chip, make the region assertive so
   that the countdown is announced.

Bug: 332662551
Flag: com.android.systemui.status_bar_screen_sharing_chips

Test: With flag disabled, enable TalkBack -> Trigger phone call ->
verify description is "Ongoing phone call"
Test: With flag enabled, enable TalkBack -> Trigger phone call ->
verify description is "Ongoing phone call"
Test: Enable TalkBack -> Share screen to app -> verify description is
"Sharing screen"
Test: Enable TalkBack -> Cast screen to other device -> verify
description is "Casting screen"
Test: Enable TalkBack -> Start screen record -> verify the countdown is
announced, and that "Recording" screen is announced once the recording
actually starts. (Note: With both the old screen record icon and the new
chip, one of the countdown numbers is sometimes missed because there's
too many other announcements happening at the same time. As long as most
of the countdown is announced and "Recording screen" is always
announced, this seems okay.)

Change-Id: I8f6c82ad819fc19427d91b2b3c3d80cc9f173ae8
parent c208c6e4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,13 +34,13 @@
        android:background="@drawable/ongoing_activity_chip_bg"
        android:paddingStart="@dimen/ongoing_activity_chip_side_padding"
        android:paddingEnd="@dimen/ongoing_activity_chip_side_padding"
        android:contentDescription="@string/ongoing_phone_call_content_description"
        android:minWidth="@dimen/min_clickable_item_size"
    >

        <ImageView
            android:src="@*android:drawable/ic_phone"
            android:id="@+id/ongoing_activity_chip_icon"
            android:contentDescription="@string/ongoing_phone_call_content_description"
            android:layout_width="@dimen/ongoing_activity_chip_icon_size"
            android:layout_height="@dimen/ongoing_activity_chip_icon_size"
            android:tint="?android:attr/colorPrimary"
+4 −0
Original line number Diff line number Diff line
@@ -328,6 +328,8 @@
    <!-- Button to stop a screen recording [CHAR LIMIT=35] -->
    <string name="screenrecord_stop_dialog_button">Stop recording</string>

    <!-- Content description for the status bar chip shown to the user when they're sharing their screen to another app on the device [CHAR LIMIT=NONE] -->
    <string name="share_to_app_chip_accessibility_label">Sharing screen</string>
    <!-- Title for a dialog shown to the user that will let them stop sharing their screen to another app on the device [CHAR LIMIT=50] -->
    <string name="share_to_app_stop_dialog_title">Stop sharing screen?</string>
    <!-- Text telling a user that they will stop sharing their screen if they click the "Stop sharing" button [CHAR LIMIT=100] -->
@@ -337,6 +339,8 @@
    <!-- Button to stop screen sharing [CHAR LIMIT=35] -->
    <string name="share_to_app_stop_dialog_button">Stop sharing</string>

    <!-- Content description for the status bar chip shown to the user when they're casting their screen to a different device [CHAR LIMIT=NONE] -->
    <string name="cast_to_other_device_chip_accessibility_label">Casting screen</string>
    <!-- Title for a dialog shown to the user that will let them stop casting their screen to a different device [CHAR LIMIT=50] -->
    <string name="cast_to_other_device_stop_dialog_title">Stop casting screen?</string>
    <!-- Text telling a user that they will stop casting their screen to a different device if they click the "Stop casting" button [CHAR LIMIT=100] -->
+4 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.chips.call.ui.viewmodel
import android.view.View
import com.android.internal.jank.InteractionJankMonitor
import com.android.systemui.animation.ActivityTransitionAnimator
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
@@ -65,7 +66,9 @@ constructor(
                            icon =
                                Icon.Resource(
                                    com.android.internal.R.drawable.ic_phone,
                                    contentDescription = null,
                                    ContentDescription.Resource(
                                        R.string.ongoing_phone_call_content_description,
                                    ),
                                ),
                            colors = ColorsModel.Themed,
                            startTimeMs = startTimeInElapsedRealtime,
+7 −1
Original line number Diff line number Diff line
@@ -85,7 +85,13 @@ constructor(
            icon =
                Icon.Resource(
                    CAST_TO_OTHER_DEVICE_ICON,
                    ContentDescription.Resource(R.string.accessibility_casting),
                    // Note: This string is "Casting screen", which is okay right now because this
                    // chip does not currently support audio-only casting. If the chip starts
                    // supporting audio-only casting (see b/342169876), update the content
                    // description to just "Casting".
                    ContentDescription.Resource(
                        R.string.cast_to_other_device_chip_accessibility_label,
                    ),
                ),
            colors = ColorsModel.Red,
            // TODO(b/332662551): Maybe use a MediaProjection API to fetch this time.
+8 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.chips.screenrecord.ui.viewmodel
import android.app.ActivityManager
import androidx.annotation.DrawableRes
import com.android.systemui.animation.DialogTransitionAnimator
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
@@ -64,8 +65,13 @@ constructor(
                    }
                    is ScreenRecordChipModel.Recording -> {
                        OngoingActivityChipModel.Shown.Timer(
                            // TODO(b/332662551): Also provide a content description.
                            icon = Icon.Resource(ICON, contentDescription = null),
                            icon =
                                Icon.Resource(
                                    ICON,
                                    ContentDescription.Resource(
                                        R.string.screenrecord_ongoing_screen_only,
                                    ),
                                ),
                            colors = ColorsModel.Red,
                            startTimeMs = systemClock.elapsedRealtime(),
                            createDialogLaunchOnClickListener(
Loading