Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 757f0a53 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert "Fixes a bug in the BluetoothDevice#getIdentityAddress API where...

Merge "Revert "Fixes a bug in the BluetoothDevice#getIdentityAddress API where it"" into tm-dev am: c198cec2

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/19281218



Change-Id: I60f436c2f4c7b90269bcb82b49ebb10a5e4b09a8
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 530bf537 c198cec2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3881,7 +3881,7 @@ public class AdapterService extends Service {
        if (deviceProp != null && deviceProp.isConsolidated()) {
            return deviceProp.getIdentityAddress();
        } else {
            return null;
            return address;
        }
    }

+5 −8
Original line number Diff line number Diff line
@@ -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) {
+1 −2
Original line number Diff line number Diff line
@@ -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