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

Commit 6276a30a authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

Merge "audio: add try catch for BluetoothLeAudio.registerCallback in...

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

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3276032



Change-Id: I5ee0b8e200a95587e4a70b08835ed624fe190a8b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c77f880a c50093fb
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: