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
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 8c38b66..9ce7cf2 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -1236,7 +1236,7 @@
     @Override
     public boolean bindBluetoothProfileService(int bluetoothProfile,
             IBluetoothProfileServiceConnection proxy) {
-        if (!mEnable) {
+        if (mState != BluetoothAdapter.STATE_ON) {
             if (DBG) {
                 Slog.d(TAG, "Trying to bind to profile: " + bluetoothProfile
                         + ", while Bluetooth was disabled");
@@ -1400,7 +1400,7 @@
                 mBluetoothLock.readLock().unlock();
             }
 
-            if (!mEnable || state != BluetoothAdapter.STATE_ON) {
+            if (state != BluetoothAdapter.STATE_ON) {
                 if (DBG) {
                     Slog.d(TAG, "Unable to bindService while Bluetooth is disabled");
                 }