From be6b577f2799ae6ca3ed07834ae4b596714ba784 Mon Sep 17 00:00:00 2001 From: shaoweishen Date: Tue, 26 Apr 2022 05:34:07 +0000 Subject: [PATCH] DO NOT MERGE: Downbranch merge conflict [Output Switcher] [A11y] Set property for endTouchArea update property for endTouchArea to make it selectable when talkback on. Bug: 221162268 Test: verify on device Change-Id: I063cb828694a5654374b296089c8aed384c9a2fc --- .../res/layout/media_output_list_item.xml | 2 ++ .../systemui/media/dialog/MediaOutputAdapter.java | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/res/layout/media_output_list_item.xml b/packages/SystemUI/res/layout/media_output_list_item.xml index b85ea598dbb4e..44be9d14ba25d 100644 --- a/packages/SystemUI/res/layout/media_output_list_item.xml +++ b/packages/SystemUI/res/layout/media_output_list_item.xml @@ -129,6 +129,8 @@ android:gravity="center_vertical"> mCheckBox.performClick()); + mEndTouchArea.setImportantForAccessibility( + View.IMPORTANT_FOR_ACCESSIBILITY_YES); + setUpContentDescriptionForView(mEndTouchArea, true, device); } else if (!mController.hasAdjustVolumeUserRestriction() && currentlyConnected) { mStatusIcon.setImageDrawable( mContext.getDrawable(R.drawable.media_output_status_check)); @@ -190,7 +194,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { true /* showSeekBar */, false /* showProgressBar */, true /* showStatus */); initSeekbar(device); - setUpContentDescriptionForActiveDevice(device); + setUpContentDescriptionForView(mContainerLayout, false, device); mCurrentActivePosition = position; } else if (isDeviceIncluded(mController.getSelectableMediaDevice(), device)) { mCheckBox.setOnCheckedChangeListener(null); @@ -258,9 +262,10 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { } } - private void setUpContentDescriptionForActiveDevice(MediaDevice device) { - mContainerLayout.setClickable(false); - mContainerLayout.setContentDescription( + private void setUpContentDescriptionForView(View view, boolean clickable, + MediaDevice device) { + view.setClickable(clickable); + view.setContentDescription( mContext.getString(device.getDeviceType() == MediaDevice.MediaDeviceType.TYPE_BLUETOOTH_DEVICE ? R.string.accessibility_bluetooth_name