Skip to content

Commit 3734966

Browse files
Hansong ZhangChris Manton
authored andcommitted
Bluetooth: Check state correctly when client wants to bind
Use mState instead of mEnable to check Bluetooth server status. mEnable is used to indicate whether the next action is enabling or disabling the Bluetooth stack, whereas mState indicates the current state. Test: atest FrameworksServicesTests Bug: 173941366 Change-Id: I335f1e33fe84a9dd7e9227dd55d54fcae7c0ec4b
1 parent 23ace73 commit 3734966

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

services/core/java/com/android/server/BluetoothManagerService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ public IBluetoothGatt getBluetoothGatt() {
12361236
@Override
12371237
public boolean bindBluetoothProfileService(int bluetoothProfile,
12381238
IBluetoothProfileServiceConnection proxy) {
1239-
if (!mEnable) {
1239+
if (mState != BluetoothAdapter.STATE_ON) {
12401240
if (DBG) {
12411241
Slog.d(TAG, "Trying to bind to profile: " + bluetoothProfile
12421242
+ ", while Bluetooth was disabled");
@@ -1400,7 +1400,7 @@ private boolean bindService() {
14001400
mBluetoothLock.readLock().unlock();
14011401
}
14021402

1403-
if (!mEnable || state != BluetoothAdapter.STATE_ON) {
1403+
if (state != BluetoothAdapter.STATE_ON) {
14041404
if (DBG) {
14051405
Slog.d(TAG, "Unable to bindService while Bluetooth is disabled");
14061406
}

0 commit comments

Comments
 (0)