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

Commit c2bfd9dc authored by Srini S's avatar Srini S Committed by Android (Google) Code Review
Browse files

Merge "Add ACTION_STOP_VOICE_COMMAND intent" into main

parents 4a6a454b c252d1c0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11691,6 +11691,7 @@ package android.content {
    field public static final String ACTION_SHOW_APP_INFO = "android.intent.action.SHOW_APP_INFO";
    field public static final String ACTION_SHOW_WORK_APPS = "android.intent.action.SHOW_WORK_APPS";
    field public static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN";
    field @FlaggedApi("android.content.flags.stop_voice_command") public static final String ACTION_STOP_VOICE_COMMAND = "android.intent.action.STOP_VOICE_COMMAND";
    field public static final String ACTION_SYNC = "android.intent.action.SYNC";
    field public static final String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL";
    field public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED";
+79 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.content;
import static android.content.ContentProvider.maybeAddUserId;
import static android.content.flags.Flags.FLAG_STOP_VOICE_COMMAND;
import static android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE;
import static android.security.Flags.FLAG_FRP_ENFORCEMENT;
import static android.security.Flags.FLAG_PREVENT_INTENT_REDIRECT;
@@ -1577,7 +1578,53 @@ public class Intent implements Parcelable, Cloneable {
    /**
     * Activity Action: Start Voice Command.
     * <p>Input: Nothing.
     *
     * <p>
     * For apps targeting or running on devices with SDK version
     * {@link android.os.Build.VERSION_CODES#BAKLAVA} or lower, the extras
     * {@link android.bluetooth.BluetoothDevice#EXTRA_DEVICE} and
     * {@link android.bluetooth.BluetoothProfile#EXTRA_PROFILE} are not
     * included as part of the intent.
     * For apps targeting versions higher than
     * {@link android.os.Build.VERSION_CODES#BAKLAVA}, the extras
     * {@link android.bluetooth.BluetoothDevice#EXTRA_DEVICE} and
     * {@link android.bluetooth.BluetoothProfile#EXTRA_PROFILE} are included as
     * part of the intent.
     *
     * <p>Information about the extras is below.
     * <ul>
     *   <li><em>{@link android.bluetooth.BluetoothDevice#EXTRA_DEVICE}</em>
     *       indicates the {@link android.bluetooth.BluetoothDevice} which
     *       initiated this request.</li>
     *   <li><em>{@link android.bluetooth.BluetoothProfile#EXTRA_PROFILE}</em>
     *       indicates the profile (e.g., {@link android.bluetooth.BluetoothProfile#HEADSET}
     *       or {@link android.bluetooth.BluetoothProfile#LE_AUDIO}) which triggered this
     *       request.</li>
     * </ul>
     *
     * <p>
     * Additionally, if the {@link android.bluetooth.BluetoothProfile#EXTRA_PROFILE}
     * is {@link android.bluetooth.BluetoothProfile#HEADSET}, the app should call
     * the following APIs to start voice assistant session.
     * <ul>
     *   <li>{@link android.bluetooth.BluetoothHeadset#startVoiceRecognition}</li>
     *   <li>{@link android.media.AudioRecord#setPreferredDevice()} for the
     *       {@link android.media.AudioDeviceInfo#TYPE_BLUETOOTH_SCO} device
     *       whose MAC address matches the address received in
     *       {@link android.bluetooth.BluetoothDevice#EXTRA_DEVICE}</li>
     *   <li>{@link android.media.AudioRecord#startRecording()}</li>
     * </ul>
     * <p>
     * If the {@link android.bluetooth.BluetoothProfile#EXTRA_PROFILE} is
     * {@link android.bluetooth.BluetoothProfile#LE_AUDIO}, the app should call
     * the following APIs to start voice assistant session.
     * <ul>
     *   <li>{@link android.media.AudioRecord#setPreferredDevice()} for the
     *       {@link android.media.AudioDeviceInfo#TYPE_BLE_HEADSET} device
     *       whose MAC address matches the address received in
     *       {@link android.bluetooth.BluetoothDevice#EXTRA_DEVICE}</li>
     *   <li>{@link android.media.AudioRecord#startRecording()}</li>
     * </ul>
     * <p>Output: Nothing.
     * <p class="note">
     * In some cases, a matching Activity may not exist, so ensure you
@@ -1586,6 +1633,37 @@ public class Intent implements Parcelable, Cloneable {
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
    /**
     * Broadcast Action: Stop Voice Command.
     *
     * <p>The intent will have the following extra values.
     * <ul>
     *   <li><em>{@link android.bluetooth.BluetoothDevice#EXTRA_DEVICE}</em>
     *       indicates the BluetoothDevice which initiated this request.</li>
     *   <li><em>{@link android.bluetooth.BluetoothProfile#EXTRA_PROFILE}</em>
     *       indicates the profile (e.g., {@link android.bluetooth.BluetoothProfile#HEADSET}
     *       or {@link android.bluetooth.BluetoothProfile#LE_AUDIO}) which
     *       triggered this request.</li>
     * </ul>
     *
     * <p>
     * Additionally, if the {@link android.bluetooth.BluetoothProfile#EXTRA_PROFILE}
     * is {@link android.bluetooth.BluetoothProfile#HEADSET}, the app should call
     * {@link android.bluetooth.BluetoothHeadset#stopVoiceRecognition} to stop
     * voice assistant session.
     * If the {@link android.bluetooth.BluetoothProfile#EXTRA_PROFILE} is
     * {@link android.bluetooth.BluetoothProfile#LE_AUDIO}, the app should call
     * {@link android.media.AudioRecord#stop()} to stop voice assistant session.
     *
     * <p class="note">This is a protected intent that can only be sent
     * by the system.
     */
    @FlaggedApi(FLAG_STOP_VOICE_COMMAND)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @BroadcastBehavior(includeBackground = true)
    public static final String ACTION_STOP_VOICE_COMMAND
            = "android.intent.action.STOP_VOICE_COMMAND";
    /**
     * Activity Action: Start action associated with long pressing on the
     * search key.
+8 −0
Original line number Diff line number Diff line
@@ -18,3 +18,11 @@ flag {
         purpose: PURPOSE_BUGFIX
     }
}

flag {
    name: "stop_voice_command"
    is_exported: true
    namespace: "bluetooth"
    description: "Feature flag to stop voice assistant session"
    bug: "419049796"
}
+3 −0
Original line number Diff line number Diff line
@@ -855,6 +855,9 @@
    <protected-broadcast android:name="android.service.ondeviceintelligence.MODEL_UNLOADED" />
    <protected-broadcast android:name="android.telephony.satellite.action.SATELLITE_START_NON_EMERGENCY_SESSION" />

    <!-- Added in 25Q4 -->
    <protected-broadcast android:name="android.intent.action.STOP_VOICE_COMMAND" />


    <!-- ====================================================================== -->
    <!--                          RUNTIME PERMISSIONS                           -->