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

Commit bc24ab0e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "HFP: Check for service level connection when connecting SCO"

parents 2900a72a a9e9d278
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -475,6 +475,9 @@ public class HeadsetService extends ProfileService {
        if (!mStateMachine.isConnected()) {
            return false;
        }
        if (!mStateMachine.isSlcConnected()) {
            return false;
        }
        if (mStateMachine.isAudioOn()) {
            return false;
        }
+11 −0
Original line number Diff line number Diff line
@@ -164,6 +164,9 @@ final class HeadsetStateMachine extends StateMachine {
    // Indicates whether audio can be routed to the device.
    private boolean mAudioRouteAllowed = true;

    // Indicate whether service level connection has been established for this device
    private boolean mSlcConnected = false;

    // mCurrentDevice is the device connected before the state changes
    // mTargetDevice is the device to be connected
    // mIncomingDevice is the device connecting to us, valid only in Pending state
@@ -324,6 +327,7 @@ final class HeadsetStateMachine extends StateMachine {
            mPhoneState.listenForPhoneState(false);
            mVoiceRecognitionStarted = false;
            mWaitingForVoiceRecognition = false;
            mSlcConnected = false;
        }

        @Override
@@ -1092,6 +1096,7 @@ final class HeadsetStateMachine extends StateMachine {
        }

        private void processSlcConnected() {
            mSlcConnected = true;
            if (mPhoneProxy != null) {
                try {
                    mPhoneProxy.queryPhoneState();
@@ -1501,6 +1506,7 @@ final class HeadsetStateMachine extends StateMachine {
        }

        private void processSlcConnected() {
            mSlcConnected = true;
            if (mPhoneProxy != null) {
                try {
                    mPhoneProxy.queryPhoneState();
@@ -1954,6 +1960,7 @@ final class HeadsetStateMachine extends StateMachine {
        }

        private void processSlcConnected() {
            mSlcConnected = true;
            if (mPhoneProxy != null) {
                try {
                    mPhoneProxy.queryPhoneState();
@@ -2094,6 +2101,10 @@ final class HeadsetStateMachine extends StateMachine {
        return false;
    }

    boolean isSlcConnected() {
        return mSlcConnected;
    }

    public void setAudioRouteAllowed(boolean allowed) {
        mAudioRouteAllowed = allowed;
    }