summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/layout/bluetooth_device_item.xml3
-rw-r--r--packages/SystemUI/res/layout/bluetooth_tile_dialog.xml24
-rw-r--r--packages/SystemUI/res/values/strings.xml8
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt33
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItem.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItemFactory.kt8
6 files changed, 70 insertions, 9 deletions
diff --git a/packages/SystemUI/res/layout/bluetooth_device_item.xml b/packages/SystemUI/res/layout/bluetooth_device_item.xml
index 08eccbbe9669..4336ccc70c33 100644
--- a/packages/SystemUI/res/layout/bluetooth_device_item.xml
+++ b/packages/SystemUI/res/layout/bluetooth_device_item.xml
@@ -21,7 +21,7 @@
style="@style/BluetoothTileDialog.Device"
android:layout_width="match_parent"
android:layout_height="@dimen/bluetooth_dialog_device_height"
- android:paddingEnd="24dp"
+ android:paddingEnd="0dp"
android:paddingStart="20dp"
android:layout_marginBottom="4dp">
@@ -86,6 +86,7 @@
android:id="@+id/gear_icon_image"
android:layout_width="0dp"
android:layout_height="24dp"
+ android:paddingEnd="24dp"
android:src="@drawable/ic_settings_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/packages/SystemUI/res/layout/bluetooth_tile_dialog.xml b/packages/SystemUI/res/layout/bluetooth_tile_dialog.xml
index c11a18b795a1..af29cada2657 100644
--- a/packages/SystemUI/res/layout/bluetooth_tile_dialog.xml
+++ b/packages/SystemUI/res/layout/bluetooth_tile_dialog.xml
@@ -120,6 +120,16 @@
android:visibility="gone"
app:constraint_referenced_ids="ic_arrow,see_all_text" />
+ <View
+ android:id="@+id/see_all_clickable_row"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:contentDescription="@string/accessibility_bluetooth_device_settings_see_all"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/device_list"
+ app:layout_constraintBottom_toTopOf="@+id/pair_new_device_text" />
+
<ImageView
android:id="@+id/ic_arrow"
android:layout_marginStart="36dp"
@@ -141,6 +151,8 @@
android:maxLines="1"
android:ellipsize="end"
android:gravity="center_vertical"
+ android:importantForAccessibility="no"
+ android:clickable="false"
android:layout_marginStart="0dp"
android:paddingStart="20dp"
android:text="@string/see_all_bluetooth_devices"
@@ -158,6 +170,16 @@
android:visibility="gone"
app:constraint_referenced_ids="ic_add,pair_new_device_text" />
+ <View
+ android:id="@+id/pair_new_device_clickable_row"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:contentDescription="@string/accessibility_bluetooth_device_settings_pair_new_device"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/see_all_text"
+ app:layout_constraintBottom_toTopOf="@+id/done_button" />
+
<ImageView
android:id="@+id/ic_add"
android:layout_width="24dp"
@@ -180,6 +202,8 @@
android:maxLines="1"
android:ellipsize="end"
android:gravity="center_vertical"
+ android:importantForAccessibility="no"
+ android:clickable="false"
android:layout_marginStart="0dp"
android:paddingStart="20dp"
android:text="@string/pair_new_bluetooth_devices"
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 9a3c6d5b322f..3163533a3f4d 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -467,6 +467,10 @@
<!-- Content description of the bluetooth device settings gear icon. [CHAR LIMIT=NONE] -->
<string name="accessibility_bluetooth_device_settings_gear">Click to configure device detail</string>
+ <!-- Content description of the bluetooth device settings see all. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_bluetooth_device_settings_see_all">Click to see all devices</string>
+ <!-- Content description of the bluetooth device settings pair new device. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_bluetooth_device_settings_pair_new_device">Click to pair new device</string>
<!-- Content description of the battery when battery state is unknown for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_battery_unknown">Battery percentage unknown.</string>
@@ -640,6 +644,10 @@
<string name="quick_settings_bluetooth_device_connected">Connected</string>
<!-- QuickSettings: Bluetooth dialog device saved default summary [CHAR LIMIT=NONE]-->
<string name="quick_settings_bluetooth_device_saved">Saved</string>
+ <!-- QuickSettings: Accessibility label to disconnect a device [CHAR LIMIT=NONE]-->
+ <string name="accessibility_quick_settings_bluetooth_device_tap_to_disconnect">disconnect</string>
+ <!-- QuickSettings: Accessibility label to activate a device [CHAR LIMIT=NONE]-->
+ <string name="accessibility_quick_settings_bluetooth_device_tap_to_activate">activate</string>
<!-- QuickSettings: Bluetooth secondary label for the battery level of a connected device [CHAR LIMIT=20]-->
<string name="quick_settings_bluetooth_secondary_label_battery_level"><xliff:g id="battery_level_as_percentage">%s</xliff:g> battery</string>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt
index aa7954e3cd0b..5bdb592a3558 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/BluetoothTileDialog.kt
@@ -20,9 +20,12 @@ import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
+import android.view.View.AccessibilityDelegate
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.ViewGroup
+import android.view.accessibility.AccessibilityNodeInfo
+import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction
import android.widget.ImageView
import android.widget.Switch
import android.widget.TextView
@@ -80,8 +83,8 @@ constructor(
private lateinit var doneButton: View
private lateinit var seeAllViewGroup: View
private lateinit var pairNewDeviceViewGroup: View
- private lateinit var seeAllText: View
- private lateinit var pairNewDeviceText: View
+ private lateinit var seeAllRow: View
+ private lateinit var pairNewDeviceRow: View
private lateinit var deviceListView: RecyclerView
override fun onCreate(savedInstanceState: Bundle?) {
@@ -98,8 +101,8 @@ constructor(
doneButton = requireViewById(R.id.done_button)
seeAllViewGroup = requireViewById(R.id.see_all_layout_group)
pairNewDeviceViewGroup = requireViewById(R.id.pair_new_device_layout_group)
- seeAllText = requireViewById(R.id.see_all_text)
- pairNewDeviceText = requireViewById(R.id.pair_new_device_text)
+ seeAllRow = requireViewById(R.id.see_all_clickable_row)
+ pairNewDeviceRow = requireViewById(R.id.pair_new_device_clickable_row)
deviceListView = requireViewById<RecyclerView>(R.id.device_list)
setupToggle()
@@ -107,8 +110,8 @@ constructor(
subtitleTextView.text = context.getString(subtitleResIdInitialValue)
doneButton.setOnClickListener { dismiss() }
- seeAllText.setOnClickListener { bluetoothTileDialogCallback.onSeeAllClicked(it) }
- pairNewDeviceText.setOnClickListener {
+ seeAllRow.setOnClickListener { bluetoothTileDialogCallback.onSeeAllClicked(it) }
+ pairNewDeviceRow.setOnClickListener {
bluetoothTileDialogCallback.onPairNewDeviceClicked(it)
}
}
@@ -194,7 +197,8 @@ constructor(
deviceItem1.iconWithDescription?.second ==
deviceItem2.iconWithDescription?.second &&
deviceItem1.background == deviceItem2.background &&
- deviceItem1.isEnabled == deviceItem2.isEnabled
+ deviceItem1.isEnabled == deviceItem2.isEnabled &&
+ deviceItem1.actionAccessibilityLabel == deviceItem2.actionAccessibilityLabel
}
}
@@ -238,6 +242,21 @@ constructor(
mutableDeviceItemClick.tryEmit(item)
uiEventLogger.log(BluetoothTileDialogUiEvent.DEVICE_CLICKED)
}
+ accessibilityDelegate =
+ object : AccessibilityDelegate() {
+ override fun onInitializeAccessibilityNodeInfo(
+ host: View,
+ info: AccessibilityNodeInfo
+ ) {
+ super.onInitializeAccessibilityNodeInfo(host, info)
+ info.addAction(
+ AccessibilityAction(
+ AccessibilityAction.ACTION_CLICK.id,
+ item.actionAccessibilityLabel
+ )
+ )
+ }
+ }
}
nameView.text = item.deviceName
summaryView.text = item.connectionSummary
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItem.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItem.kt
index 2c8d2a0806d2..1c621b87533d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItem.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItem.kt
@@ -49,5 +49,6 @@ data class DeviceItem(
val connectionSummary: String = "",
val iconWithDescription: Pair<Drawable, String>? = null,
val background: Int? = null,
- var isEnabled: Boolean = true
+ var isEnabled: Boolean = true,
+ var actionAccessibilityLabel: String = "",
)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItemFactory.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItemFactory.kt
index 7bb1619c5001..1c9be0f105b2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItemFactory.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/bluetooth/DeviceItemFactory.kt
@@ -28,6 +28,10 @@ private val backgroundOff = R.drawable.bluetooth_tile_dialog_bg_off
private val backgroundOffBusy = R.drawable.bluetooth_tile_dialog_bg_off_busy
private val connected = R.string.quick_settings_bluetooth_device_connected
private val saved = R.string.quick_settings_bluetooth_device_saved
+private val actionAccessibilityLabelActivate =
+ R.string.accessibility_quick_settings_bluetooth_device_tap_to_activate
+private val actionAccessibilityLabelDisconnect =
+ R.string.accessibility_quick_settings_bluetooth_device_tap_to_disconnect
/** Factories to create different types of Bluetooth device items from CachedBluetoothDevice. */
internal abstract class DeviceItemFactory {
@@ -60,6 +64,7 @@ internal class ActiveMediaDeviceItemFactory : DeviceItemFactory() {
},
background = backgroundOn,
isEnabled = !cachedDevice.isBusy,
+ actionAccessibilityLabel = context.getString(actionAccessibilityLabelDisconnect),
)
}
}
@@ -87,6 +92,7 @@ internal class AvailableMediaDeviceItemFactory : DeviceItemFactory() {
},
background = if (cachedDevice.isBusy) backgroundOffBusy else backgroundOff,
isEnabled = !cachedDevice.isBusy,
+ actionAccessibilityLabel = context.getString(actionAccessibilityLabelActivate),
)
}
}
@@ -112,6 +118,7 @@ internal class ConnectedDeviceItemFactory : DeviceItemFactory() {
},
background = if (cachedDevice.isBusy) backgroundOffBusy else backgroundOff,
isEnabled = !cachedDevice.isBusy,
+ actionAccessibilityLabel = context.getString(actionAccessibilityLabelDisconnect),
)
}
}
@@ -137,6 +144,7 @@ internal class SavedDeviceItemFactory : DeviceItemFactory() {
},
background = if (cachedDevice.isBusy) backgroundOffBusy else backgroundOff,
isEnabled = !cachedDevice.isBusy,
+ actionAccessibilityLabel = context.getString(actionAccessibilityLabelActivate),
)
}
}