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

Commit 96eeb7e1 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh Committed by Android (Google) Code Review
Browse files

Merge "Fix race condition between starting of service and getting the Profile Proxy."

parents d040f951 7d0548d0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -120,7 +120,9 @@ class BluetoothEventLoop {
                | PowerManager.ON_AFTER_RELEASE, TAG);
        mWakeLock.setReferenceCounted(false);
        initializeNativeDataNative();
    }

    /*package*/ void getProfileProxy() {
        mAdapter.getProfileProxy(mContext, mProfileServiceListener, BluetoothProfile.A2DP);
    }

+4 −0
Original line number Diff line number Diff line
@@ -319,6 +319,10 @@ public class BluetoothService extends IBluetooth.Stub {
        mEventLoop = new BluetoothEventLoop(mContext, mAdapter, this);
    }

    public synchronized void initAfterA2dpRegistration() {
        mEventLoop.getProfileProxy();
    }

    @Override
    protected void finalize() throws Throwable {
        mContext.unregisterReceiver(mReceiver);
+2 −1
Original line number Diff line number Diff line
@@ -215,6 +215,7 @@ class ServerThread extends Thread {
                bluetoothA2dp = new BluetoothA2dpService(context, bluetooth);
                ServiceManager.addService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE,
                                          bluetoothA2dp);
                bluetooth.initAfterA2dpRegistration();

                int bluetoothOn = Settings.Secure.getInt(mContentResolver,
                    Settings.Secure.BLUETOOTH_ON, 0);