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
(cherry picked from commit be6b577f2799ae6ca3ed07834ae4b596714ba784)
diff --git a/packages/SystemUI/res/layout/media_output_list_item.xml b/packages/SystemUI/res/layout/media_output_list_item.xml
index b85ea59..44be9d14 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">
<CheckBox
android:id="@+id/check_box"
+ android:focusable="false"
+ android:importantForAccessibility="no"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
index ddcba3a..07001ee 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
@@ -118,6 +118,7 @@
mCheckBox.setVisibility(View.GONE);
mStatusIcon.setVisibility(View.GONE);
mEndTouchArea.setVisibility(View.GONE);
+ mEndTouchArea.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
mContainerLayout.setOnClickListener(null);
mContainerLayout.setContentDescription(null);
mTitleText.setTextColor(mController.getColorItemContent());
@@ -170,7 +171,7 @@
setSingleLineLayout(getItemTitle(device), true /* bFocused */,
true /* showSeekBar */,
false /* showProgressBar */, false /* showStatus */);
- setUpContentDescriptionForActiveDevice(device);
+ setUpContentDescriptionForView(mContainerLayout, false, device);
mCheckBox.setOnCheckedChangeListener(null);
mCheckBox.setVisibility(View.VISIBLE);
mCheckBox.setChecked(true);
@@ -181,6 +182,9 @@
mEndTouchArea.setVisibility(View.VISIBLE);
mEndTouchArea.setOnClickListener(null);
mEndTouchArea.setOnClickListener((v) -> 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 @@
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 @@
}
}
- 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