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

Commit 5ddfecc9 authored by Ajay Kumar's avatar Ajay Kumar Committed by Steve Kondik
Browse files

Bluetooth: Unbind only in case of OFF state

In MESSAGE_SAVE_NAME_AND_ADDRESS,BT manager
calls unbindandfinish without checking BT
adapter state which if not OFF, will lead
to improper cleanup. Unbind will get called
but cleanup will not happen.

Change-Id: Ibfc70c51a95f8b80f331090e322ba3ebb88f6c03
CRs-Fixed: 652260
parent ae707cc1
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -753,6 +753,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                }
                case MESSAGE_SAVE_NAME_AND_ADDRESS: {
                    boolean unbind = false;
                    boolean waitonofftimeout = false;
                    if (DBG) Log.d(TAG,"MESSAGE_SAVE_NAME_AND_ADDRESS");
                    synchronized(mConnection) {
                        if (!mEnable && mBluetooth != null) {
@@ -808,8 +809,10 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                            mHandler.sendMessage(getMsg);
                        }
                    }
                    if (!mEnable && mBluetooth != null) waitForOnOff(false, true);
                    if (unbind) {
                    if (!mEnable && mBluetooth != null) {
                        waitonofftimeout = waitForOnOff(false, true);
                    }
                    if (unbind && waitonofftimeout) {
                        unbindAndFinish();
                    }
                    break;