Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +1 −1 Original line number Diff line number Diff line Loading @@ -3881,7 +3881,7 @@ public class AdapterService extends Service { if (deviceProp != null && deviceProp.isConsolidated()) { return deviceProp.getIdentityAddress(); } else { return null; return address; } } Loading android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +5 −8 Original line number Diff line number Diff line Loading @@ -853,22 +853,19 @@ public class AdapterServiceTest { @Test public void testAddressConsolidation() { // Verify that we return null when the device property for this address does not exist Assert.assertNull(mAdapterService.getIdentityAddress(TEST_BT_ADDR_1)); // Create device property // Create device properties RemoteDevices remoteDevices = mAdapterService.getRemoteDevices(); remoteDevices.addDeviceProperties(Utils.getBytesFromAddress((TEST_BT_ADDR_1))); // Verify that we return null when the identity address is not known Assert.assertNull(mAdapterService.getIdentityAddress(TEST_BT_ADDR_1)); String identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1); Assert.assertEquals(identityAddress, TEST_BT_ADDR_1); // Trigger address consolidate callback remoteDevices.addressConsolidateCallback(Utils.getBytesFromAddress(TEST_BT_ADDR_1), Utils.getBytesFromAddress(TEST_BT_ADDR_2)); // Verify we can get correct identity address Assert.assertEquals(TEST_BT_ADDR_2, mAdapterService.getIdentityAddress(TEST_BT_ADDR_1)); identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1); Assert.assertEquals(identityAddress, TEST_BT_ADDR_2); } private static byte[] getMetricsSalt(HashMap<String, HashMap<String, String>> adapterConfig) { Loading framework/java/android/bluetooth/BluetoothDevice.java +1 −2 Original line number Diff line number Diff line Loading @@ -1477,8 +1477,7 @@ public final class BluetoothDevice implements Parcelable, Attributable { * Returns the identity address of this BluetoothDevice. * <p> For example, "00:11:22:AA:BB:CC". * * @return this device's identity address as a string or {@code null} if the identity * address is either not known or is unable to be retrieved * @return Bluetooth identity address as a string * @hide */ @SystemApi Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +1 −1 Original line number Diff line number Diff line Loading @@ -3881,7 +3881,7 @@ public class AdapterService extends Service { if (deviceProp != null && deviceProp.isConsolidated()) { return deviceProp.getIdentityAddress(); } else { return null; return address; } } Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +5 −8 Original line number Diff line number Diff line Loading @@ -853,22 +853,19 @@ public class AdapterServiceTest { @Test public void testAddressConsolidation() { // Verify that we return null when the device property for this address does not exist Assert.assertNull(mAdapterService.getIdentityAddress(TEST_BT_ADDR_1)); // Create device property // Create device properties RemoteDevices remoteDevices = mAdapterService.getRemoteDevices(); remoteDevices.addDeviceProperties(Utils.getBytesFromAddress((TEST_BT_ADDR_1))); // Verify that we return null when the identity address is not known Assert.assertNull(mAdapterService.getIdentityAddress(TEST_BT_ADDR_1)); String identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1); Assert.assertEquals(identityAddress, TEST_BT_ADDR_1); // Trigger address consolidate callback remoteDevices.addressConsolidateCallback(Utils.getBytesFromAddress(TEST_BT_ADDR_1), Utils.getBytesFromAddress(TEST_BT_ADDR_2)); // Verify we can get correct identity address Assert.assertEquals(TEST_BT_ADDR_2, mAdapterService.getIdentityAddress(TEST_BT_ADDR_1)); identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1); Assert.assertEquals(identityAddress, TEST_BT_ADDR_2); } private static byte[] getMetricsSalt(HashMap<String, HashMap<String, String>> adapterConfig) { Loading
framework/java/android/bluetooth/BluetoothDevice.java +1 −2 Original line number Diff line number Diff line Loading @@ -1477,8 +1477,7 @@ public final class BluetoothDevice implements Parcelable, Attributable { * Returns the identity address of this BluetoothDevice. * <p> For example, "00:11:22:AA:BB:CC". * * @return this device's identity address as a string or {@code null} if the identity * address is either not known or is unable to be retrieved * @return Bluetooth identity address as a string * @hide */ @SystemApi Loading