[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
This commit is contained in:
committed by
SongFerng Wang
parent
f9257ef01b
commit
548cc04bf6
@@ -87,9 +87,11 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Bluetooth service connected");
|
||||
}
|
||||
mService = (BluetoothLeBroadcast) proxy;
|
||||
mIsProfileReady = true;
|
||||
registerServiceCallBack(mExecutor, mBroadcastCallback);
|
||||
if(!mIsProfileReady) {
|
||||
mService = (BluetoothLeBroadcast) proxy;
|
||||
mIsProfileReady = true;
|
||||
registerServiceCallBack(mExecutor, mBroadcastCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,8 +99,10 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Bluetooth service disconnected");
|
||||
}
|
||||
mIsProfileReady = false;
|
||||
unregisterServiceCallBack(mBroadcastCallback);
|
||||
if(mIsProfileReady) {
|
||||
mIsProfileReady = false;
|
||||
unregisterServiceCallBack(mBroadcastCallback);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user