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

Commit 548cc04b authored by SongFerngWang's avatar SongFerngWang Committed by SongFerng Wang
Browse files

[LeAudioBroadcast] avoid the system register mBroadcastCallback again

There is a "java.lang.IllegalArgumentException: This callback has
already been registered". The system did not disconnect and notifiy
service connect, and it caused the system register the callback again.

Bug: 238374344
Bug: 234312198
Test: build pass.
Change-Id: Iaec1d9d9458add983f3a06f5c30414bce3ce5be5
parent f9257ef0
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -87,19 +87,23 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
            if (DEBUG) {
                Log.d(TAG, "Bluetooth service connected");
            }
            if(!mIsProfileReady) {
                mService = (BluetoothLeBroadcast) proxy;
                mIsProfileReady = true;
                registerServiceCallBack(mExecutor, mBroadcastCallback);
            }
        }

        @Override
        public void onServiceDisconnected(int profile) {
            if (DEBUG) {
                Log.d(TAG, "Bluetooth service disconnected");
            }
            if(mIsProfileReady) {
                mIsProfileReady = false;
                unregisterServiceCallBack(mBroadcastCallback);
            }
        }
    };

    private final BluetoothLeBroadcast.Callback mBroadcastCallback =