Merge "PSS permission dialog - Add missing hover and focus states" into main
diff --git a/packages/SystemUI/res/color/screenshare_options_spinner_background.xml b/packages/SystemUI/res/color/screenshare_options_spinner_background.xml
new file mode 100644
index 0000000..922813dc
--- /dev/null
+++ b/packages/SystemUI/res/color/screenshare_options_spinner_background.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 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.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <item android:state_hovered="false" android:state_focused="false" android:color="@android:color/transparent" />
+ <item android:state_focused="true" android:color="?androidprv:attr/materialColorOnSurface" android:alpha=".1" />
+ <item android:state_hovered="true" android:color="?androidprv:attr/materialColorOnSurface" android:alpha=".08" />
+</selector>
diff --git a/packages/SystemUI/res/drawable/screenshare_options_spinner_background.xml b/packages/SystemUI/res/drawable/screenshare_options_spinner_background.xml
index f7c04b5..429a801 100644
--- a/packages/SystemUI/res/drawable/screenshare_options_spinner_background.xml
+++ b/packages/SystemUI/res/drawable/screenshare_options_spinner_background.xml
@@ -22,7 +22,7 @@
<stroke
android:width="1dp"
android:color="?androidprv:attr/textColorTertiary" />
- <solid android:color="@android:color/transparent"/>
+ <solid android:color="@color/screenshare_options_spinner_background"/>
</shape>
</item>
<item
diff --git a/packages/SystemUI/res/layout/screen_record_options.xml b/packages/SystemUI/res/layout/screen_record_options.xml
index fa345c9..4b5cdb5 100644
--- a/packages/SystemUI/res/layout/screen_record_options.xml
+++ b/packages/SystemUI/res/layout/screen_record_options.xml
@@ -40,22 +40,16 @@
android:popupBackground="@drawable/screenrecord_spinner_background"
android:dropDownWidth="274dp"
android:importantForAccessibility="yes"/>
- <FrameLayout
- android:id="@+id/screenrecord_audio_switch_container"
+
+ <Switch
android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- <Switch
- android:layout_width="wrap_content"
- android:minWidth="48dp"
- android:layout_height="48dp"
- android:layout_gravity="end"
- android:focusable="false"
- android:clickable="false"
- android:id="@+id/screenrecord_audio_switch"
- android:contentDescription="@string/screenrecord_audio_label"
- style="@style/ScreenRecord.Switch"
- android:importantForAccessibility="yes"/>
- </FrameLayout>
+ android:minWidth="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="end"
+ android:id="@+id/screenrecord_audio_switch"
+ android:contentDescription="@string/screenrecord_audio_label"
+ style="@style/ScreenRecord.Switch"
+ android:importantForAccessibility="yes" />
</LinearLayout>
<LinearLayout
android:id="@+id/show_taps"
@@ -81,20 +75,14 @@
android:fontFamily="@*android:string/config_bodyFontFamily"
android:textColor="?android:attr/textColorPrimary"
android:contentDescription="@string/screenrecord_taps_label"/>
- <FrameLayout
- android:id="@+id/screenrecord_taps_switch_container"
+
+ <Switch
android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- <Switch
- android:layout_width="wrap_content"
- android:minWidth="48dp"
- android:layout_height="48dp"
- android:focusable="false"
- android:clickable="false"
- android:id="@+id/screenrecord_taps_switch"
- android:contentDescription="@string/screenrecord_taps_label"
- style="@style/ScreenRecord.Switch"
- android:importantForAccessibility="yes"/>
- </FrameLayout>
+ android:minWidth="48dp"
+ android:layout_height="48dp"
+ android:id="@+id/screenrecord_taps_switch"
+ android:contentDescription="@string/screenrecord_taps_label"
+ style="@style/ScreenRecord.Switch"
+ android:importantForAccessibility="yes" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegate.kt b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegate.kt
index 1c76b00..ab6067c 100644
--- a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegate.kt
+++ b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionDialogDelegate.kt
@@ -29,7 +29,6 @@
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
-import android.view.ViewGroup
import android.view.accessibility.AccessibilityNodeInfo
import android.widget.AdapterView
import android.widget.ArrayAdapter
@@ -114,10 +113,8 @@
}
private lateinit var tapsSwitch: Switch
- private lateinit var tapsSwitchContainer: ViewGroup
private lateinit var tapsView: View
private lateinit var audioSwitch: Switch
- private lateinit var audioSwitchContainer: ViewGroup
private lateinit var options: Spinner
override fun createDialog(): SystemUIDialog {
@@ -164,17 +161,12 @@
private fun initRecordOptionsView() {
audioSwitch = dialog.requireViewById(R.id.screenrecord_audio_switch)
tapsSwitch = dialog.requireViewById(R.id.screenrecord_taps_switch)
- audioSwitchContainer = dialog.requireViewById(R.id.screenrecord_audio_switch_container)
- tapsSwitchContainer = dialog.requireViewById(R.id.screenrecord_taps_switch_container)
// Add these listeners so that the switch only responds to movement
// within its target region, to meet accessibility requirements
audioSwitch.setOnTouchListener { _, event -> event.action == ACTION_MOVE }
tapsSwitch.setOnTouchListener { _, event -> event.action == ACTION_MOVE }
- audioSwitchContainer.setOnClickListener { audioSwitch.toggle() }
- tapsSwitchContainer.setOnClickListener { tapsSwitch.toggle() }
-
tapsView = dialog.requireViewById(R.id.show_taps)
updateTapsViewVisibility()