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

Commit 25e12abc authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add ability to start voice interaction session directly

Add internal API's for SystemUI to start a voice interaction session
directly, without using an intent.

Make the assist gesture use that ability, if available.

Change-Id: I88ce3c7514714eb45666884847193585a07417a9
parent 0feaaafd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28170,6 +28170,7 @@ package android.service.voice {
    method public void showSession(android.os.Bundle, int);
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.voice.VoiceInteractionService";
    field public static final java.lang.String SERVICE_META_DATA = "android.voice_interaction";
    field public static final int START_SOURCE_SYSTEM = 4; // 0x4
    field public static final int START_WITH_ASSIST = 1; // 0x1
    field public static final int START_WITH_SCREENSHOT = 2; // 0x2
  }
+1 −0
Original line number Diff line number Diff line
@@ -30241,6 +30241,7 @@ package android.service.voice {
    method public void showSession(android.os.Bundle, int);
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.voice.VoiceInteractionService";
    field public static final java.lang.String SERVICE_META_DATA = "android.voice_interaction";
    field public static final int START_SOURCE_SYSTEM = 4; // 0x4
    field public static final int START_WITH_ASSIST = 1; // 0x1
    field public static final int START_WITH_SCREENSHOT = 2; // 0x2
  }
+6 −0
Original line number Diff line number Diff line
@@ -82,6 +82,12 @@ public class VoiceInteractionService extends Service {
     */
    public static final int START_WITH_SCREENSHOT = 1<<1;

    /**
     * Flag for use with {@link #showSession}: indicate that the session has been started from the
     * system.
     */
    public static final int START_SOURCE_SYSTEM = 1<<2;

    IVoiceInteractionService mInterface = new IVoiceInteractionService.Stub() {
        @Override public void ready() {
            mHandler.sendEmptyMessage(MSG_READY);
+16 −0
Original line number Diff line number Diff line
@@ -80,4 +80,20 @@ interface IVoiceInteractionManagerService {
     */
    int stopRecognition(in IVoiceInteractionService service, int keyphraseId,
            in IRecognitionStatusCallback callback);

    /**
     * Indicates whether any voice interaction service is currently active.
     */
    boolean isServiceActive();

    /**
     * Shows the session for the currently active service. Used to start a new session from system
     * affordances.
     */
    void showSessionForActiveService();

    /**
     * Indicates whether there is a voice session running (but not necessarily showing).
     */
    boolean isSessionRunning();
}
+8 −0
Original line number Diff line number Diff line
@@ -3009,6 +3009,14 @@
        android:description="@string/permdesc_bindCarrierMessagingService"
        android:protectionLevel="signature|system" />

    <!-- Allows an application to interact with the currently active
         {@link android.service.voice.VoiceInteractionService}.
         @hide -->
    <permission android:name="android.permission.ACCESS_VOICE_INTERACTION_SERVICE"
        android:protectionLevel="signature"
        android:description="@string/permdesc_accessVoiceInteractionService"
        android:label="@string/permlab_accessVoiceInteractionService" />

    <!-- The system process is explicitly the only one allowed to launch the
         confirmation UI for full backup/restore -->
    <uses-permission android:name="android.permission.CONFIRM_FULL_BACKUP"/>
Loading