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

Commit 0b68ff45 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add flag to voice interactor for supporting assist gesture

Add an additional flag to the voice-interaction-service declaration
so it can indicate whether it is able to handle the assist gesture.
Use that information in SystemUI so it only starts the voice
interaction session if the service is able to support it.

Change-Id: I62b035ce4f4cf06ee6e7eb0ddc4bf5edbc0e6737
parent 225d3b54
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1200,6 +1200,7 @@ package android {
    field public static final int summaryColumn = 16843426; // 0x10102a2
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsAssistGesture = 16844012; // 0x10104ec
    field public static final int supportsRtl = 16843695; // 0x10103af
    field public static final int supportsSwitchingToNextInputMethod = 16843755; // 0x10103eb
    field public static final int supportsUploading = 16843419; // 0x101029b
@@ -28170,7 +28171,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_SOURCE_ASSIST_GESTURE = 4; // 0x4
    field public static final int START_WITH_ASSIST = 1; // 0x1
    field public static final int START_WITH_SCREENSHOT = 2; // 0x2
  }
+2 −1
Original line number Diff line number Diff line
@@ -1277,6 +1277,7 @@ package android {
    field public static final int summaryColumn = 16843426; // 0x10102a2
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsAssistGesture = 16844012; // 0x10104ec
    field public static final int supportsRtl = 16843695; // 0x10103af
    field public static final int supportsSwitchingToNextInputMethod = 16843755; // 0x10103eb
    field public static final int supportsUploading = 16843419; // 0x101029b
@@ -30241,7 +30242,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_SOURCE_ASSIST_GESTURE = 4; // 0x4
    field public static final int START_WITH_ASSIST = 1; // 0x1
    field public static final int START_WITH_SCREENSHOT = 2; // 0x2
  }
+2 −2
Original line number Diff line number Diff line
@@ -84,9 +84,9 @@ public class VoiceInteractionService extends Service {

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

    IVoiceInteractionService mInterface = new IVoiceInteractionService.Stub() {
        @Override public void ready() {
+8 −5
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public class VoiceInteractionServiceInfo {
    private String mSessionService;
    private String mRecognitionService;
    private String mSettingsActivity;
    private boolean mSupportsAssistGesture;

    public VoiceInteractionServiceInfo(PackageManager pm, ComponentName comp)
            throws PackageManager.NameNotFoundException {
@@ -94,6 +95,9 @@ public class VoiceInteractionServiceInfo {
                    com.android.internal.R.styleable.VoiceInteractionService_recognitionService);
            mSettingsActivity = array.getString(
                    com.android.internal.R.styleable.VoiceInteractionService_settingsActivity);
            mSupportsAssistGesture = array.getBoolean(
                    com.android.internal.R.styleable.VoiceInteractionService_supportsAssistGesture,
                    false);
            array.recycle();
            if (mSessionService == null) {
                mParseError = "No sessionService specified";
@@ -103,11 +107,6 @@ public class VoiceInteractionServiceInfo {
                mParseError = "No recognitionService specified";
                return;
            }
            /* Not yet time
            if (mRecognitionService == null) {
                mParseError = "No recogitionService specified";
                return;
            } */
        } catch (XmlPullParserException e) {
            mParseError = "Error parsing voice interation service meta-data: " + e;
            Log.w(TAG, "error parsing voice interaction service meta-data", e);
@@ -145,4 +144,8 @@ public class VoiceInteractionServiceInfo {
    public String getSettingsActivity() {
        return mSettingsActivity;
    }

    public boolean getSupportsAssistGesture() {
        return mSupportsAssistGesture;
    }
}
+6 −5
Original line number Diff line number Diff line
@@ -83,11 +83,6 @@ interface IVoiceInteractionManagerService {
    int stopRecognition(in IVoiceInteractionService service, int keyphraseId,
            in IRecognitionStatusCallback callback);

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

    /**
     * @return the component name for the currently active voice interaction service
     */
@@ -105,4 +100,10 @@ interface IVoiceInteractionManagerService {
     * Indicates whether there is a voice session running (but not necessarily showing).
     */
    boolean isSessionRunning();

    /**
     * Indicates whether the currently active voice interaction service is capable of handling the
     * assist gesture.
     */
    boolean activeServiceSupportsAssistGesture();
}
Loading