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

Commit 79c63000 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

PBAP: Return correct connection state when state machine is done

Check whether the state machine is done, and return
BluetoothProfile.STATE_DISCONNECTED when it is done.

Test: carkits with PBAP
Bug: 70939570
Change-Id: I499e152abcfdc91174745bf74dd9a295419c7001
parent 86ddcab0
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -347,7 +347,18 @@ class PbapStateMachine extends StateMachine {
        }
    }

    /**
     * Get the current connection state of this state machine
     *
     * @return current connection state, one of {@link BluetoothProfile#STATE_DISCONNECTED},
     * {@link BluetoothProfile#STATE_CONNECTING}, {@link BluetoothProfile#STATE_CONNECTED}, or
     * {@link BluetoothProfile#STATE_DISCONNECTING}
     */
    synchronized int getConnectionState() {
        return ((PbapStateBase) getCurrentState()).getConnectionStateInt();
        PbapStateBase state = (PbapStateBase) getCurrentState();
        if (state == null) {
            return BluetoothProfile.STATE_DISCONNECTED;
        }
        return state.getConnectionStateInt();
    }
}