From 8595cf779ad9fc8d765fe42a83cb51187b3c3a8a Mon Sep 17 00:00:00 2001 From: Alan Huang Date: Thu, 12 May 2022 15:47:59 +0000 Subject: [PATCH] Add Hearable control slice in bluetooth device detail settings Bug: 229048602 Test: make -j64 RunSettingsRoboTests Change-Id: I850aaee9bf7518c9f9de065fbbd1eb4919fc62ee --- res/xml/bluetooth_device_details_fragment.xml | 5 ++ .../BluetoothDeviceDetailsFragment.java | 52 +++++++++++++++++++ .../bluetooth/BluetoothFeatureProvider.java | 9 ++++ .../BluetoothFeatureProviderImpl.java | 7 +++ .../BluetoothFeatureProviderImplTest.java | 14 +++++ 5 files changed, 87 insertions(+) diff --git a/res/xml/bluetooth_device_details_fragment.xml b/res/xml/bluetooth_device_details_fragment.xml index f6c0af662aa..b44a93db62f 100644 --- a/res/xml/bluetooth_device_details_fragment.xml +++ b/res/xml/bluetooth_device_details_fragment.xml @@ -46,6 +46,11 @@ android:key="action_buttons" settings:allowDividerBelow="true"/> + + " + SETTINGS_URI + + ""; + private static final int METADATA_FAST_PAIR_CUSTOMIZED_FIELDS = 25; + private BluetoothFeatureProvider mBluetoothFeatureProvider; @Mock @@ -54,4 +59,13 @@ public class BluetoothFeatureProviderImplTest { final Uri uri = mBluetoothFeatureProvider.getBluetoothDeviceSettingsUri(mBluetoothDevice); assertThat(uri.toString()).isEqualTo(SETTINGS_URI); } + + @Test + public void getBluetoothDeviceControlUri_returnsCorrectUri() { + when(mBluetoothDevice.getMetadata(METADATA_FAST_PAIR_CUSTOMIZED_FIELDS)).thenReturn( + CONTROL_METADATA.getBytes()); + assertThat( + mBluetoothFeatureProvider.getBluetoothDeviceControlUri(mBluetoothDevice)).isEqualTo( + SETTINGS_URI); + } }