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

Commit 3a8d8e50 authored by venkata Jagadeesh's avatar venkata Jagadeesh Committed by android-build-merger
Browse files

Broadcast UUIDS on BT state transition to ON

am: 59acf0a9

* commit '59acf0a9':
  Broadcast UUIDS on BT state transition to ON

Change-Id: Ie3f311eb23193c3da4a5d54e0a956caeaf9a0084
parents c7d0b719 59acf0a9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1642,6 +1642,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) {