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

Commit e844b369 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Broadcast UUIDS on BT state transition to ON"

parents 6a3053d9 9aa4a016
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) {