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

Commit f3feef17 authored by Bhasker Neti's avatar Bhasker Neti Committed by Linux Build Service Account
Browse files

Bluetooth: Clening up BT service in error cases.

If the statemachine didnt get response from stack in
8secs for any reason during BT off time, state machine
restores the BT state to on, which is wrong.
Restoring the BT state by restarting the service.

CRs-fixed: 528656
Change-Id: Iac6b1b4ba8ea0b5bd34bae5d672450e4a93fe658
parent fe19c7f2
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -344,8 +344,10 @@ final class AdapterState extends StateMachine {
                    if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = DISABLE_TIMEOUT, isTurningOn=" + isTurningOn + ", isTurningOff=" + isTurningOff);
                    if (DBG) Log.d(TAG,"CURRENT_STATE=PENDING, MESSAGE = DISABLE_TIMEOUT, isTurningOn=" + isTurningOn + ", isTurningOff=" + isTurningOff);
                    errorLog("Error disabling Bluetooth");
                    errorLog("Error disabling Bluetooth");
                    mPendingCommandState.setTurningOff(false);
                    mPendingCommandState.setTurningOff(false);
                    transitionTo(mOnState);
                    transitionTo(mOffState);
                    notifyAdapterStateChange(BluetoothAdapter.STATE_ON);
                    notifyAdapterStateChange(BluetoothAdapter.STATE_OFF);
                    errorLog("Killing the process to force a restart as part cleanup");
                    android.os.Process.killProcess(android.os.Process.myPid());
                    break;
                    break;
                default:
                default:
                    if (DBG) Log.d(TAG,"ERROR: UNEXPECTED MESSAGE: CURRENT_STATE=PENDING, MESSAGE = " + msg.what );
                    if (DBG) Log.d(TAG,"ERROR: UNEXPECTED MESSAGE: CURRENT_STATE=PENDING, MESSAGE = " + msg.what );