Remove Dream Overlay window name and update content descriptions.

This changelist sets the Dream Overlay window name to an empty string.
Omitting the name causes the window to be attributed to SystemUI by
Talkback for any visual element (status bar, complications) rather than
the dream.

This changelist also sets the content descriptions for a number of
icons in the dream overlay.

Test: manual
Fixes: 267837462
Change-Id: Ic31d2c53d53a3e4c961cfc4e5a01245822b22b96
This commit is contained in:
Bryce Lee
2023-02-10 17:25:18 -08:00
parent 2cc5cf369b
commit 21b031eece
3 changed files with 35 additions and 8 deletions

View File

@@ -2950,4 +2950,22 @@
[CHAR LIMIT=32]
-->
<string name="lock_screen_settings">Lock screen settings</string>
<!-- Content description for Wi-Fi not available icon on dream [CHAR LIMIT=NONE]-->
<string name="wifi_unavailable_dream_overlay_content_description">Wi-Fi not available</string>
<!-- Content description for camera blocked icon on dream [CHAR LIMIT=NONE] -->
<string name="camera_blocked_dream_overlay_content_description">Camera blocked</string>
<!-- Content description for camera and microphone blocked icon on dream [CHAR LIMIT=NONE] -->
<string name="camera_and_microphone_blocked_dream_overlay_content_description">Camera and microphone blocked</string>
<!-- Content description for camera and microphone disabled icon on dream [CHAR LIMIT=NONE] -->
<string name="microphone_blocked_dream_overlay_content_description">Microphone blocked</string>
<!-- Content description for priority mode icon on dream [CHAR LIMIT=NONE] -->
<string name="priority_mode_dream_overlay_content_description">Priority mode on</string>
<!-- Content description for when assistant attention is active [CHAR LIMIT=NONE] -->
<string name="assistant_attention_content_description">Assistant attention on</string>
</resources>

View File

@@ -269,6 +269,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
*/
private void addOverlayWindowLocked(WindowManager.LayoutParams layoutParams) {
mWindow = new PhoneWindow(mContext);
// Default to SystemUI name for TalkBack.
mWindow.setTitle("");
mWindow.setAttributes(layoutParams);
mWindow.setWindowManager(null, layoutParams.token, "DreamOverlay", true);

View File

@@ -259,7 +259,8 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve
mConnectivityManager.getActiveNetwork());
final boolean available = capabilities != null
&& capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
showIcon(DreamOverlayStatusBarView.STATUS_ICON_WIFI_UNAVAILABLE, !available);
showIcon(DreamOverlayStatusBarView.STATUS_ICON_WIFI_UNAVAILABLE, !available,
R.string.wifi_unavailable_dream_overlay_content_description);
}
private void updateAlarmStatusIcon() {
@@ -274,7 +275,8 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve
private void updateAssistantAttentionIcon() {
showIcon(DreamOverlayStatusBarView.STATUS_ICON_ASSISTANT_ATTENTION_ACTIVE,
mDreamOverlayStateController.hasAssistantAttention());
mDreamOverlayStateController.hasAssistantAttention(),
R.string.assistant_attention_content_description);
}
private void updateVisibility() {
@@ -304,13 +306,16 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve
@DreamOverlayStatusBarView.StatusIconType int iconType = Resources.ID_NULL;
showIcon(
DreamOverlayStatusBarView.STATUS_ICON_CAMERA_DISABLED,
!micBlocked && cameraBlocked);
!micBlocked && cameraBlocked,
R.string.camera_blocked_dream_overlay_content_description);
showIcon(
DreamOverlayStatusBarView.STATUS_ICON_MIC_DISABLED,
micBlocked && !cameraBlocked);
micBlocked && !cameraBlocked,
R.string.microphone_blocked_dream_overlay_content_description);
showIcon(
DreamOverlayStatusBarView.STATUS_ICON_MIC_CAMERA_DISABLED,
micBlocked && cameraBlocked);
micBlocked && cameraBlocked,
R.string.camera_and_microphone_blocked_dream_overlay_content_description);
}
private String buildNotificationsContentDescription(int notificationCount) {
@@ -323,11 +328,13 @@ public class DreamOverlayStatusBarViewController extends ViewController<DreamOve
private void updatePriorityModeStatusIcon() {
showIcon(
DreamOverlayStatusBarView.STATUS_ICON_PRIORITY_MODE_ON,
mZenModeController.getZen() != Settings.Global.ZEN_MODE_OFF);
mZenModeController.getZen() != Settings.Global.ZEN_MODE_OFF,
R.string.priority_mode_dream_overlay_content_description);
}
private void showIcon(@DreamOverlayStatusBarView.StatusIconType int iconType, boolean show) {
showIcon(iconType, show, null);
private void showIcon(@DreamOverlayStatusBarView.StatusIconType int iconType, boolean show,
int contentDescriptionResId) {
showIcon(iconType, show, mResources.getString(contentDescriptionResId));
}
private void showIcon(