From face5ff4971f1a249057ee4a6343c83e6ad6c542 Mon Sep 17 00:00:00 2001 From: Vania Januar Date: Tue, 20 Dec 2022 10:48:40 +0000 Subject: [PATCH] DEVICE_TYPE_STYLUS should support AdvancedDetailsHeader. Bug: 251200056 Test: BluetoothUtilsTest Change-Id: I714ecbcc12acd58d71e973bffe126e1dd275a0b7 --- .../android/settingslib/bluetooth/BluetoothUtils.java | 3 ++- .../settingslib/bluetooth/BluetoothUtilsTest.java | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java index a36cbc0dbf958..4a1a4e61f8879 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java @@ -260,7 +260,8 @@ public class BluetoothUtils { BluetoothDevice.METADATA_DEVICE_TYPE); if (TextUtils.equals(deviceType, BluetoothDevice.DEVICE_TYPE_UNTETHERED_HEADSET) || TextUtils.equals(deviceType, BluetoothDevice.DEVICE_TYPE_WATCH) - || TextUtils.equals(deviceType, BluetoothDevice.DEVICE_TYPE_DEFAULT)) { + || TextUtils.equals(deviceType, BluetoothDevice.DEVICE_TYPE_DEFAULT) + || TextUtils.equals(deviceType, BluetoothDevice.DEVICE_TYPE_STYLUS)) { Log.d(TAG, "isAdvancedDetailsHeader: deviceType is " + deviceType); return true; } diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java index ca14573c95e18..83972e8ef6e35 100644 --- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java +++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java @@ -192,6 +192,15 @@ public class BluetoothUtilsTest { assertThat(BluetoothUtils.isAdvancedDetailsHeader(mBluetoothDevice)).isEqualTo(true); } + @Test + public void isAdvancedDetailsHeader_deviceTypeStylus_returnTrue() { + when(mBluetoothDevice.getMetadata( + BluetoothDevice.METADATA_DEVICE_TYPE)).thenReturn( + BluetoothDevice.DEVICE_TYPE_STYLUS.getBytes()); + + assertThat(BluetoothUtils.isAdvancedDetailsHeader(mBluetoothDevice)).isEqualTo(true); + } + @Test public void isAdvancedDetailsHeader_deviceTypeDefault_returnTrue() { when(mBluetoothDevice.getMetadata(