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

Commit 9aa4a016 authored by venkata Jagadeesh's avatar venkata Jagadeesh Committed by Andre Eisenbach
Browse files

Broadcast UUIDS on BT state transition to ON

Use case: Phone and media connection is not happening
after BT reset during swapping between the HeadSet.

Precondition:
1. WIFI should be on and connected with AP.

Steps:
1. Pair and connect from DUT to PLT legend device.
2. Make an Mobile originated (MO) call.
3. Pair and connect from DUT to sony carkit.
4. Swap connection between PLT legend and sony carkit.
5. During swapping turn OFF BT from DUT.
6. Turn ON DUT and wait for auto connection from DUT.
7. Repeat step from 4-6 10 times.

Failure: Failed to connect with HS.

Root cause: Broadcarst UUIDS on receiving the on event
from lower layers even though the state is not
transitioned to ON.

Fix: Broadcast UUIDS on BT state is transitioned to ON
to avoid timing issues related UUIDS.

Change-Id: Ibdbaecd60cf36c599700b1ca353481b8149efa90
parent 6a3053d9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1527,6 +1527,16 @@ public class AdapterService extends Service {
         }
    }

    public void updateUuids() {
        debugLog( "updateUuids() - Updating UUIDs for bonded devices");
        BluetoothDevice[] bondedDevices = getBondedDevices();
        if (bondedDevices == null) return;

        for (BluetoothDevice device : bondedDevices) {
            mRemoteDevices.updateUuids(device);
        }
    }

     private void autoConnectHeadset(){
        HeadsetService  hsService = HeadsetService.getHeadsetService();

+1 −0
Original line number Diff line number Diff line
@@ -232,6 +232,7 @@ final class AdapterState extends StateMachine {
                errorLog("Entered OnState after cleanup");
                return;
            }
            adapterService.updateUuids();
            adapterService.autoConnect();
        }

+8 −2
Original line number Diff line number Diff line
@@ -282,6 +282,7 @@ final class RemoteDevices {
                        case AbstractionLayer.BT_PROPERTY_UUIDS:
                            int numUuids = val.length/AbstractionLayer.BT_UUID_SIZE;
                            device.mUuids = Utils.byteArrayToUuid(val);
                            if (mAdapterService.getState() == BluetoothAdapter.STATE_ON)
                                sendUuidIntent(bdDevice);
                            break;
                        case AbstractionLayer.BT_PROPERTY_TYPE_OF_DEVICE:
@@ -364,7 +365,6 @@ final class RemoteDevices {
    }



    void fetchUuids(BluetoothDevice device) {
        if (mSdpTracker.contains(device)) return;
        mSdpTracker.add(device);
@@ -376,6 +376,12 @@ final class RemoteDevices {
        mAdapterService.getRemoteServicesNative(Utils.getBytesFromAddress(device.getAddress()));
    }

    void updateUuids(BluetoothDevice device) {
        Message message = mHandler.obtainMessage(MESSAGE_UUID_INTENT);
        message.obj = device;
        mHandler.sendMessage(message);
    }

    private final Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {