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

Commit b24f19e4 authored by Sanket Agarwal's avatar Sanket Agarwal
Browse files

Cleanup state while transitioning to disconnected.

If we forgot to reset state while transitioning to disconnected in HFP
it could meant that further processing is stopped since the state is
unclean.

Bug: b/31088373
Change-Id: I032efd2dfd4f39db901c9f82bccdf452060e4d86
parent c22a1eeb
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ final class HeadsetClientStateMachine extends StateMachine {
    static final int TERMINATE_SPECIFIC_CALL = 53;

    // Timeouts.
    static final int CONNECTING_TIMEOUT_MS = 5000;
    static final int CONNECTING_TIMEOUT_MS = 10000;  // 10s

    static final int MAX_HFP_SCO_VOICE_CALL_VOLUME = 15; // HFP 1.5 spec.
    static final int MIN_HFP_SCO_VOICE_CALL_VOLUME = 1; // HFP 1.5 spec.
@@ -920,6 +920,8 @@ final class HeadsetClientStateMachine extends StateMachine {
            mVoiceRecognitionActive = HeadsetClientHalConstants.VR_STATE_STOPPED;
            mInBandRingtone = HeadsetClientHalConstants.IN_BAND_RING_NOT_PROVIDED;

            mCurrentDevice = null;

            mCalls.clear();
            mCallsUpdate.clear();

@@ -1113,7 +1115,6 @@ final class HeadsetClientStateMachine extends StateMachine {
                case HeadsetClientHalConstants.CONNECTION_STATE_DISCONNECTED:
                    broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED,
                            BluetoothProfile.STATE_CONNECTING);
                    mCurrentDevice = null;
                    transitionTo(mDisconnected);
                    break;

@@ -1667,7 +1668,6 @@ final class HeadsetClientStateMachine extends StateMachine {
                        broadcastConnectionState(mCurrentDevice,
                                BluetoothProfile.STATE_DISCONNECTED,
                                BluetoothProfile.STATE_CONNECTED);
                        mCurrentDevice = null;
                        transitionTo(mDisconnected);
                    } else {
                        Log.e(TAG, "Disconnected from unknown device: " + device);
@@ -1851,7 +1851,6 @@ final class HeadsetClientStateMachine extends StateMachine {
                        broadcastConnectionState(mCurrentDevice,
                                BluetoothProfile.STATE_DISCONNECTED,
                                BluetoothProfile.STATE_CONNECTED);
                        mCurrentDevice = null;
                        transitionTo(mDisconnected);
                    } else {
                        Log.e(TAG, "Disconnected from unknown device: " + device);