From c118294af8f285c1f09cb02b6f1aa776e1b8de77 Mon Sep 17 00:00:00 2001 From: Stanley Tng Date: Thu, 29 Nov 2018 13:47:45 -0800 Subject: [PATCH] Display Hearing Aids name on UI tile When the current device is a hearing aids, display the name under the tile. Bug: 117423826 Test: Manual testing on phone with hearing aids connected Change-Id: I98cfda7905763a3da3dbc1fbed13fee881da7bb2 --- .../android/settingslib/bluetooth/CachedBluetoothDevice.java | 4 ++++ packages/SystemUI/res/values/strings.xml | 2 ++ .../src/com/android/systemui/qs/tiles/BluetoothTile.java | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index d6c64913f048f..6833a2f010123 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -203,6 +203,10 @@ public class CachedBluetoothDevice implements Comparable mHiSyncId = id; } + public boolean isHearingAidDevice() { + return mHiSyncId != BluetoothHearingAid.HI_SYNC_ID_INVALID; + } + void onBondingDockConnect() { // Attempt to connect if UUIDs are available. Otherwise, // we will connect when the ACTION_UUID intent arrives. diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 50454fc9bcf28..789e7a5e96b32 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -700,6 +700,8 @@ Headset Input + + Hearing Aids Turning on… diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java index c62a592be8e22..3ab1c21b50663 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BluetoothTile.java @@ -205,7 +205,10 @@ public class BluetoothTile extends QSTileImpl { } else { final BluetoothClass bluetoothClass = lastDevice.getBtClass(); if (bluetoothClass != null) { - if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) { + if (lastDevice.isHearingAidDevice()) { + return mContext.getString( + R.string.quick_settings_bluetooth_secondary_label_hearing_aids); + } else if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) { return mContext.getString( R.string.quick_settings_bluetooth_secondary_label_audio); } else if (bluetoothClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) {