Skip to content

Commit

Permalink
Revert "Fixes a bug in the BluetoothDevice#getIdentityAddress API whe…
Browse files Browse the repository at this point in the history
…re it"

This reverts commit 448c2830336794d350b1c7c4f62c3e406b172e32.

Reason for revert: b/238847789

Test: Clean revert of CL

Change-Id: I30941e8b9344e9dbaacaec5ca2c2046d149ed839
(cherry picked from commit bf9246b080ee80380d3fc5f20258294a69f81391)
Merged-In: I30941e8b9344e9dbaacaec5ca2c2046d149ed839
  • Loading branch information
Bart Sears authored and Android Build Coastguard Worker committed Jul 14, 2022
1 parent 9b46dea commit ef1c055
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3881,7 +3881,7 @@ public String getIdentityAddress(String address) {
if (deviceProp != null && deviceProp.isConsolidated()) {
return deviceProp.getIdentityAddress();
} else {
return null;
return address;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,22 +853,19 @@ public void testObfuscateBluetoothAddress_FactoryResetAndReloadNativeLayer() thr

@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) {
Expand Down
3 changes: 1 addition & 2 deletions framework/java/android/bluetooth/BluetoothDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,7 @@ public String getAnonymizedAddress() {
* 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
Expand Down

0 comments on commit ef1c055

Please sign in to comment.