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

Commit 616be430 authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Send out a broadcast intent when BT voice dialing is shut down.

This broadcast can be used by voice dialing applications to stop
themselves.

Change-Id: Ia9f5b6bc4cbfd18bddc40f98170463b613a9c329
parent 4b1aab6e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -107,6 +107,9 @@ final class HeadsetStateMachine extends StateMachine {
        BluetoothUuid.Handsfree,
    };

    private static final String ACTION_VOICE_COMMAND_STOP =
            "com.android.internal.intent.action.VOICE_COMMAND_STOP";

    private Disconnected mDisconnected;
    private Pending mPending;
    private Connected mConnected;
@@ -124,6 +127,7 @@ final class HeadsetStateMachine extends StateMachine {
    private AtPhonebook mPhonebook;

    private static Intent sVoiceCommandIntent;
    private static Intent sVoiceCommandStopIntent;

    private HeadsetPhoneState mPhoneState;
    private int mAudioState;
@@ -195,6 +199,9 @@ final class HeadsetStateMachine extends StateMachine {
            sVoiceCommandIntent = new Intent(Intent.ACTION_VOICE_COMMAND);
            sVoiceCommandIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }
        if (sVoiceCommandStopIntent == null) {
            sVoiceCommandStopIntent = new Intent(ACTION_VOICE_COMMAND_STOP);
        }

        addState(mDisconnected);
        addState(mPending);
@@ -1128,6 +1135,7 @@ final class HeadsetStateMachine extends StateMachine {
                atResponseCodeNative(HeadsetHalConstants.AT_RESPONSE_OK, 0);
                mVoiceRecognitionStarted = false;
                mWaitingForVoiceRecognition = false;
                mService.sendBroadcast(sVoiceCommandStopIntent);
                if (!isInCall()) {
                    disconnectAudioNative(getByteAddress(mCurrentDevice));
                    mAudioManager.setParameters("A2dpSuspended=false");