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

Commit bc585908 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 am: 6276a30a

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



Change-Id: I9acd6ca4ebf050e55d3fe4f4215e813c4e09b8f0
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents d8df5cad 6276a30a
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -605,7 +605,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;
@@ -682,12 +686,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: