Merge "Bluetooth: Check state correctly when client wants to bind"

This commit is contained in:
Treehugger Robot
2020-12-11 19:13:44 +00:00
committed by Gerrit Code Review

View File

@@ -1265,7 +1265,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
@Override @Override
public boolean bindBluetoothProfileService(int bluetoothProfile, public boolean bindBluetoothProfileService(int bluetoothProfile,
IBluetoothProfileServiceConnection proxy) { IBluetoothProfileServiceConnection proxy) {
if (!mEnable) { if (mState != BluetoothAdapter.STATE_ON) {
if (DBG) { if (DBG) {
Slog.d(TAG, "Trying to bind to profile: " + bluetoothProfile Slog.d(TAG, "Trying to bind to profile: " + bluetoothProfile
+ ", while Bluetooth was disabled"); + ", while Bluetooth was disabled");
@@ -1431,7 +1431,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
mBluetoothLock.readLock().unlock(); mBluetoothLock.readLock().unlock();
} }
if (!mEnable || state != BluetoothAdapter.STATE_ON) { if (state != BluetoothAdapter.STATE_ON) {
if (DBG) { if (DBG) {
Slog.d(TAG, "Unable to bindService while Bluetooth is disabled"); Slog.d(TAG, "Unable to bindService while Bluetooth is disabled");
} }