From b837d57b02a48dd92bc153b170388578b4a725c2 Mon Sep 17 00:00:00 2001 From: Vania Januar Date: Thu, 29 Dec 2022 10:12:10 +0000 Subject: [PATCH] Set title for Bluetooth Details page to "Stylus" for styluses. Bug: 254835745 Test: BluetoothDeviceDetailsFragmentTest Change-Id: I725877b0bcf44fa7be805e16fb2d695c9d6074dc --- .../settings/bluetooth/BluetoothDeviceDetailsFragment.java | 4 +--- .../bluetooth/BluetoothDeviceDetailsFragmentTest.java | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java index a8c43fb3e10..8eaff45b400 100644 --- a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java +++ b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java @@ -341,9 +341,7 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment @VisibleForTesting void setTitleForInputDevice() { - // TODO(b/254835745) once source filter for bt stylus merged - // && mInputDevice.supportsSource(InputDevice.SOURCE_BLUETOOTH_STYLUS)) - if (mInputDevice != null) { + if (StylusDevicesController.isDeviceStylus(mInputDevice, mCachedDevice)) { // This will override the default R.string.device_details_title "Device Details" // that will show on non-stylus bluetooth devices. // That title is set via the manifest and also from BluetoothDeviceUpdater. diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java index 57af4126540..501279c47f2 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java @@ -159,7 +159,9 @@ public class BluetoothDeviceDetailsFragmentTest { public void getTitle_inputDeviceTitle() { FeatureFlagUtils.setEnabled(mContext, FeatureFlagUtils.SETTINGS_SHOW_STYLUS_PREFERENCES, true); - doReturn(mock(InputDevice.class)).when(mFragment).getInputDevice(mContext); + InputDevice inputDevice = mock(InputDevice.class); + doReturn(true).when(inputDevice).supportsSource(InputDevice.SOURCE_STYLUS); + doReturn(inputDevice).when(mFragment).getInputDevice(mContext); mFragment.onAttach(mContext); mFragment.setTitleForInputDevice();