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

Commit 50f8f639 authored by SongFerngWang's avatar SongFerngWang
Browse files

[LE Broadcast]Fix the crash in the BluetoothLeBroadcast constructor

The onServiceConnected is called, but the constructor is not finished.

Bug: 247058040
Test: build pass. local test and don't encounter the crash
Change-Id: I806446a893fd3ca18ee926b0bc7d2ceed2717902
parent d9ef4d8e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -210,13 +210,15 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {

    LocalBluetoothLeBroadcast(Context context) {
        mExecutor = Executors.newSingleThreadExecutor();
        BluetoothAdapter.getDefaultAdapter().
                getProfileProxy(context, mServiceListener, BluetoothProfile.LE_AUDIO_BROADCAST);
        mBuilder = new BluetoothLeAudioContentMetadata.Builder();
        mContentResolver = context.getContentResolver();
        Handler handler = new Handler(Looper.getMainLooper());
        mSettingsObserver = new BroadcastSettingsObserver(handler);
        updateBroadcastInfoFromContentProvider();

        // Before registering callback, the constructor should finish creating the all of variables.
        BluetoothAdapter.getDefaultAdapter()
                .getProfileProxy(context, mServiceListener, BluetoothProfile.LE_AUDIO_BROADCAST);
    }

    /**