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

Commit 406c2c96 authored by Chienyuan's avatar Chienyuan Committed by Chienyuan Huang
Browse files

SDP: Choose proper address for native command/callback

Tag: #refactor
Bug: 197044261
Test: manual
Change-Id: I27d2224e49e95971ebc6f08742b3b6f5f964c0a8
parent c090ca4c
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@ public class SdpManager {

        SdpSearchInstance getSearchInstance(byte[] address, byte[] uuidBytes) {
            String addressString = Utils.getAddressStringFromByte(address);
            addressString = sAdapterService.getIdentityAddress(addressString);
            ParcelUuid uuid = Utils.byteArrayToUuid(uuidBytes)[0];
            for (SdpSearchInstance inst : mList) {
                if (inst.getDevice().getAddress().equals(addressString) && inst.getUuid()
@@ -208,8 +209,6 @@ public class SdpManager {

    private SdpManager(AdapterService adapterService) {
        sSdpSearchTracker = new SdpSearchTracker();

        /* This is only needed until intents are no longer used */
        sAdapterService = adapterService;
        initializeNative();
        sNativeAvailable = true;
@@ -464,7 +463,7 @@ public class SdpManager {

            inst.startSearch(); // Trigger timeout message

            sdpSearchNative(Utils.getBytesFromAddress(inst.getDevice().getAddress()),
            sdpSearchNative(sAdapterService.getByteIdentityAddress(inst.getDevice()),
                    Utils.uuidToByteArray(inst.getUuid()));
        } else { // Else queue is empty.
            if (D) {
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.bluetooth.sdp;

import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;

import android.bluetooth.BluetoothAdapter;
@@ -73,6 +74,7 @@ public class DipTest {
        MockitoAnnotations.initMocks(this);

        TestUtils.setAdapterService(mAdapterService);
        doReturn("00:01:02:03:04:05").when(mAdapterService).getIdentityAddress("00:01:02:03:04:05");

        if (Looper.myLooper() == null) {
            Looper.prepare();