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

Commit c50093fb authored by Eric Laurent's avatar Eric Laurent Committed by Gerrit Code Review
Browse files

Merge "audio: add try catch for BluetoothLeAudio.registerCallback in BtHelper.java" into main

parents e056bdcd aff86a2c
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -603,7 +603,11 @@ public class BtHelper {
                break;
            case BluetoothProfile.LE_AUDIO:
                if (mLeAudio != null && mLeAudioCallback != null) {
                    try {
                        mLeAudio.unregisterCallback(mLeAudioCallback);
                    } catch (Exception e) {
                        Log.e(TAG, "Exception while unregistering callback for LE audio", e);
                    }
                }
                mLeAudio = null;
                mLeAudioCallback = null;
@@ -680,12 +684,21 @@ public class BtHelper {
                    return;
                }
                if (mLeAudio != null && mLeAudioCallback != null) {
                    try {
                        mLeAudio.unregisterCallback(mLeAudioCallback);
                    } catch (Exception e) {
                        Log.e(TAG, "Exception while unregistering callback for LE audio", e);
                    }
                }
                mLeAudio = (BluetoothLeAudio) proxy;
                mLeAudioCallback = new MyLeAudioCallback();
                try{
                    mLeAudio.registerCallback(
                                mContext.getMainExecutor(), mLeAudioCallback);
                } catch (Exception e) {
                    mLeAudioCallback = null;
                    Log.e(TAG, "Exception while registering callback for LE audio", e);
                }
                break;
            case BluetoothProfile.A2DP_SINK:
            case BluetoothProfile.LE_AUDIO_BROADCAST: