Loading packages/SettingsLib/res/drawable/ic_docked_tablet.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2023 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal"> <path android:fillColor="#000000" android:pathData="M480,280Q497,280 508.5,268.5Q520,257 520,240Q520,223 508.5,211.5Q497,200 480,200Q463,200 451.5,211.5Q440,223 440,240Q440,257 451.5,268.5Q463,280 480,280ZM120,720Q87,720 63.5,696.5Q40,673 40,640L60,160Q60,127 83.5,103.5Q107,80 140,80L820,80Q853,80 876.5,103.5Q900,127 900,160L920,640Q920,673 896.5,696.5Q873,720 840,720L120,720ZM120,640L840,640Q840,640 840,640Q840,640 840,640L820,160Q820,160 820,160Q820,160 820,160L140,160Q140,160 140,160Q140,160 140,160L120,640Q120,640 120,640Q120,640 120,640ZM320,880Q259,880 209.5,850Q160,820 160,765L160,720L240,720L240,760Q253,780 274.5,790Q296,800 320,800L640,800Q664,800 685.5,790.5Q707,781 720,761L720,720L800,720L800,765Q800,820 750.5,850Q701,880 640,880L320,880ZM480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Z"/> </vector> No newline at end of file packages/SystemUI/res/layout/media_output_list_item_advanced.xml +4 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,8 @@ <TextView android:id="@+id/volume_value" android:animateLayoutChanges="true" android:focusable="false" android:importantForAccessibility="no" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" Loading @@ -75,6 +77,8 @@ <TextView android:id="@+id/title" android:focusable="false" android:importantForAccessibility="no" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|start" Loading packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java +27 −7 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.os.Build; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.CheckBox; import android.widget.TextView; Loading Loading @@ -151,6 +152,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { mCurrentActivePosition = -1; } mStatusIcon.setVisibility(View.GONE); enableFocusPropertyForView(mContainerLayout); if (mController.isAnyDeviceTransferring()) { if (device.getState() == MediaDeviceState.STATE_CONNECTING Loading Loading @@ -250,7 +252,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { mController.getColorItemContent()); updateGroupableCheckBox(true, isDeviceDeselectable, device); updateEndClickArea(device, isDeviceDeselectable); setUpContentDescriptionForView(mContainerLayout, false, device); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, false /* showProgressBar */, true /* showCheckBox */, true /* showEndTouchArea */); Loading @@ -274,7 +277,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { mController.getDeselectableMediaDevice(), device); updateGroupableCheckBox(true, isDeviceDeselectable, device); updateEndClickArea(device, isDeviceDeselectable); setUpContentDescriptionForView(mContainerLayout, false, device); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, false /* showProgressBar */, true /* showCheckBox */, true /* showEndTouchArea */); Loading @@ -282,7 +286,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { } else { updateTitleIcon(R.drawable.media_output_icon_volume, mController.getColorItemContent()); setUpContentDescriptionForView(mContainerLayout, false, device); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); mCurrentActivePosition = position; setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, false /* showProgressBar */, false /* showCheckBox */, Loading Loading @@ -390,7 +395,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { View.IMPORTANT_FOR_ACCESSIBILITY_YES); mEndTouchArea.setBackgroundTintList( ColorStateList.valueOf(mController.getColorItemBackground())); setUpContentDescriptionForView(mEndTouchArea, true, device); setUpContentDescriptionForView(mEndTouchArea, device); } private void updateGroupableCheckBox(boolean isSelected, boolean isGroupable, Loading Loading @@ -471,14 +476,29 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { notifyDataSetChanged(); } private void setUpContentDescriptionForView(View view, boolean clickable, MediaDevice device) { view.setClickable(clickable); private void disableFocusPropertyForView(View view) { view.setFocusable(false); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } private void enableFocusPropertyForView(View view) { view.setFocusable(true); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO); } private void setUpContentDescriptionForView(View view, MediaDevice device) { view.setContentDescription( mContext.getString(device.getDeviceType() == MediaDevice.MediaDeviceType.TYPE_BLUETOOTH_DEVICE ? R.string.accessibility_bluetooth_name : R.string.accessibility_cast_name, device.getName())); view.setAccessibilityDelegate(new View.AccessibilityDelegate() { public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(host, info); host.setOnClickListener(null); } }); } } Loading packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,20 @@ public class MediaOutputAdapterTest extends SysuiTestCase { assertThat(mViewHolder.mEndTouchArea.getVisibility()).isEqualTo(View.VISIBLE); } @Test public void onBindViewHolder_bindConnectedRemoteDevice_verifyContentDescriptionNotNull() { when(mMediaOutputController.getSelectableMediaDevice()).thenReturn( ImmutableList.of(mMediaDevice2)); when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true); mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter .onCreateViewHolder(new LinearLayout(mContext), 0); mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0); assertThat(mViewHolder.mSeekBar.getContentDescription()).isNotNull(); assertThat(mViewHolder.mSeekBar.getAccessibilityDelegate()).isNotNull(); assertThat(mViewHolder.mContainerLayout.isFocusable()).isFalse(); } @Test public void onBindViewHolder_bindSingleConnectedRemoteDevice_verifyView() { when(mMediaOutputController.getSelectableMediaDevice()).thenReturn( Loading Loading @@ -334,6 +348,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase { assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.VISIBLE); assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.VISIBLE); assertThat(mViewHolder.mTitleText.getText().toString()).isEqualTo(TEST_DEVICE_NAME_2); assertThat(mViewHolder.mContainerLayout.isFocusable()).isTrue(); } @Test Loading Loading
packages/SettingsLib/res/drawable/ic_docked_tablet.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2023 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal"> <path android:fillColor="#000000" android:pathData="M480,280Q497,280 508.5,268.5Q520,257 520,240Q520,223 508.5,211.5Q497,200 480,200Q463,200 451.5,211.5Q440,223 440,240Q440,257 451.5,268.5Q463,280 480,280ZM120,720Q87,720 63.5,696.5Q40,673 40,640L60,160Q60,127 83.5,103.5Q107,80 140,80L820,80Q853,80 876.5,103.5Q900,127 900,160L920,640Q920,673 896.5,696.5Q873,720 840,720L120,720ZM120,640L840,640Q840,640 840,640Q840,640 840,640L820,160Q820,160 820,160Q820,160 820,160L140,160Q140,160 140,160Q140,160 140,160L120,640Q120,640 120,640Q120,640 120,640ZM320,880Q259,880 209.5,850Q160,820 160,765L160,720L240,720L240,760Q253,780 274.5,790Q296,800 320,800L640,800Q664,800 685.5,790.5Q707,781 720,761L720,720L800,720L800,765Q800,820 750.5,850Q701,880 640,880L320,880ZM480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Q480,400 480,400Q480,400 480,400L480,400Z"/> </vector> No newline at end of file
packages/SystemUI/res/layout/media_output_list_item_advanced.xml +4 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,8 @@ <TextView android:id="@+id/volume_value" android:animateLayoutChanges="true" android:focusable="false" android:importantForAccessibility="no" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" Loading @@ -75,6 +77,8 @@ <TextView android:id="@+id/title" android:focusable="false" android:importantForAccessibility="no" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|start" Loading
packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java +27 −7 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.os.Build; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.CheckBox; import android.widget.TextView; Loading Loading @@ -151,6 +152,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { mCurrentActivePosition = -1; } mStatusIcon.setVisibility(View.GONE); enableFocusPropertyForView(mContainerLayout); if (mController.isAnyDeviceTransferring()) { if (device.getState() == MediaDeviceState.STATE_CONNECTING Loading Loading @@ -250,7 +252,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { mController.getColorItemContent()); updateGroupableCheckBox(true, isDeviceDeselectable, device); updateEndClickArea(device, isDeviceDeselectable); setUpContentDescriptionForView(mContainerLayout, false, device); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, false /* showProgressBar */, true /* showCheckBox */, true /* showEndTouchArea */); Loading @@ -274,7 +277,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { mController.getDeselectableMediaDevice(), device); updateGroupableCheckBox(true, isDeviceDeselectable, device); updateEndClickArea(device, isDeviceDeselectable); setUpContentDescriptionForView(mContainerLayout, false, device); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, false /* showProgressBar */, true /* showCheckBox */, true /* showEndTouchArea */); Loading @@ -282,7 +286,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { } else { updateTitleIcon(R.drawable.media_output_icon_volume, mController.getColorItemContent()); setUpContentDescriptionForView(mContainerLayout, false, device); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); mCurrentActivePosition = position; setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, false /* showProgressBar */, false /* showCheckBox */, Loading Loading @@ -390,7 +395,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { View.IMPORTANT_FOR_ACCESSIBILITY_YES); mEndTouchArea.setBackgroundTintList( ColorStateList.valueOf(mController.getColorItemBackground())); setUpContentDescriptionForView(mEndTouchArea, true, device); setUpContentDescriptionForView(mEndTouchArea, device); } private void updateGroupableCheckBox(boolean isSelected, boolean isGroupable, Loading Loading @@ -471,14 +476,29 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { notifyDataSetChanged(); } private void setUpContentDescriptionForView(View view, boolean clickable, MediaDevice device) { view.setClickable(clickable); private void disableFocusPropertyForView(View view) { view.setFocusable(false); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } private void enableFocusPropertyForView(View view) { view.setFocusable(true); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO); } private void setUpContentDescriptionForView(View view, MediaDevice device) { view.setContentDescription( mContext.getString(device.getDeviceType() == MediaDevice.MediaDeviceType.TYPE_BLUETOOTH_DEVICE ? R.string.accessibility_bluetooth_name : R.string.accessibility_cast_name, device.getName())); view.setAccessibilityDelegate(new View.AccessibilityDelegate() { public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(host, info); host.setOnClickListener(null); } }); } } Loading
packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -246,6 +246,20 @@ public class MediaOutputAdapterTest extends SysuiTestCase { assertThat(mViewHolder.mEndTouchArea.getVisibility()).isEqualTo(View.VISIBLE); } @Test public void onBindViewHolder_bindConnectedRemoteDevice_verifyContentDescriptionNotNull() { when(mMediaOutputController.getSelectableMediaDevice()).thenReturn( ImmutableList.of(mMediaDevice2)); when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true); mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter .onCreateViewHolder(new LinearLayout(mContext), 0); mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0); assertThat(mViewHolder.mSeekBar.getContentDescription()).isNotNull(); assertThat(mViewHolder.mSeekBar.getAccessibilityDelegate()).isNotNull(); assertThat(mViewHolder.mContainerLayout.isFocusable()).isFalse(); } @Test public void onBindViewHolder_bindSingleConnectedRemoteDevice_verifyView() { when(mMediaOutputController.getSelectableMediaDevice()).thenReturn( Loading Loading @@ -334,6 +348,7 @@ public class MediaOutputAdapterTest extends SysuiTestCase { assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.VISIBLE); assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.VISIBLE); assertThat(mViewHolder.mTitleText.getText().toString()).isEqualTo(TEST_DEVICE_NAME_2); assertThat(mViewHolder.mContainerLayout.isFocusable()).isTrue(); } @Test Loading