diff --git a/res/values/config.xml b/res/values/config.xml
index c2899efa1dc..beeac0c7db3 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -171,9 +171,6 @@
-
- content://com.google.android.gms.nearby.fastpair/settings_slice?addr=%1$s
-
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
index 2fbd061cbbc..36cbd5d3fd8 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java
@@ -121,7 +121,7 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
FeatureFlags.SLICE_INJECTION);
use(BlockingSlicePrefController.class).setSliceUri(injectionEnabled
- ? featureProvider.getBluetoothDeviceSettingsUri(mDeviceAddress)
+ ? featureProvider.getBluetoothDeviceSettingsUri(mCachedDevice.getDevice())
: null);
}
diff --git a/src/com/android/settings/bluetooth/BluetoothFeatureProvider.java b/src/com/android/settings/bluetooth/BluetoothFeatureProvider.java
index 2bca03808b1..582a26c182c 100644
--- a/src/com/android/settings/bluetooth/BluetoothFeatureProvider.java
+++ b/src/com/android/settings/bluetooth/BluetoothFeatureProvider.java
@@ -16,6 +16,7 @@
package com.android.settings.bluetooth;
+import android.bluetooth.BluetoothDevice;
import android.net.Uri;
/**
@@ -25,8 +26,8 @@ public interface BluetoothFeatureProvider {
/**
* Get the {@link Uri} that represents extra settings for a specific bluetooth device
- * @param macAddress Bluetooth mac address
+ * @param bluetoothDevice bluetooth device
* @return {@link Uri} for extra settings
*/
- Uri getBluetoothDeviceSettingsUri(String macAddress);
+ Uri getBluetoothDeviceSettingsUri(BluetoothDevice bluetoothDevice);
}
diff --git a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
index dcdc2fd77b0..e486b68c00c 100644
--- a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
+++ b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
@@ -16,11 +16,10 @@
package com.android.settings.bluetooth;
+import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.net.Uri;
-import com.android.settings.R;
-
/**
* Impl of {@link BluetoothFeatureProvider}
*/
@@ -33,9 +32,9 @@ public class BluetoothFeatureProviderImpl implements BluetoothFeatureProvider {
}
@Override
- public Uri getBluetoothDeviceSettingsUri(String macAddress) {
- final String uriString = mContext.getString(R.string.config_bluetooth_device_settings_uri,
- macAddress);
- return Uri.parse(uriString);
+ public Uri getBluetoothDeviceSettingsUri(BluetoothDevice bluetoothDevice) {
+ final String uriString = bluetoothDevice.getMetadata(
+ BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI);
+ return uriString != null ? Uri.parse(uriString) : null;
}
}
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
index 887f58c3245..a921215fc62 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
@@ -17,30 +17,40 @@ package com.android.settings.bluetooth;
import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.when;
+
+import android.bluetooth.BluetoothDevice;
import android.net.Uri;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class BluetoothFeatureProviderImplTest {
- private static final String PARAMETER_KEY = "addr";
- private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
+ private static final String SETTINGS_URI = "content://test.provider/settings_uri";
private BluetoothFeatureProvider mBluetoothFeatureProvider;
+ @Mock
+ private BluetoothDevice mBluetoothDevice;
+
@Before
public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
mBluetoothFeatureProvider = new BluetoothFeatureProviderImpl(
RuntimeEnvironment.application);
}
@Test
public void getBluetoothDeviceSettingsUri_containCorrectMacAddress() {
- final Uri uri = mBluetoothFeatureProvider.getBluetoothDeviceSettingsUri(MAC_ADDRESS);
- assertThat(uri.getQueryParameterNames()).containsExactly(PARAMETER_KEY);
- assertThat(uri.getQueryParameter(PARAMETER_KEY)).isEqualTo(MAC_ADDRESS);
+ when(mBluetoothDevice.getMetadata(
+ BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI)).thenReturn(SETTINGS_URI);
+ final Uri uri = mBluetoothFeatureProvider.getBluetoothDeviceSettingsUri(mBluetoothDevice);
+ assertThat(uri.toString()).isEqualTo(SETTINGS_URI);
}
}