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

Commit 93ec05ca authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Rework voice interaction session lifecycle."

parents d8495183 ffeecb1b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -27657,7 +27657,7 @@ package android.service.voice {
    method public android.os.IBinder onBind(android.content.Intent);
    method public void onReady();
    method public void onShutdown();
    method public void startSession(android.os.Bundle, int);
    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_WITH_ASSIST = 1; // 0x1
@@ -27669,6 +27669,7 @@ package android.service.voice {
    method public void finish();
    method public android.view.LayoutInflater getLayoutInflater();
    method public android.app.Dialog getWindow();
    method public void hide();
    method public void hideWindow();
    method public void onAbortVoice(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
    method public void onBackPressed();
@@ -27683,14 +27684,17 @@ package android.service.voice {
    method public void onDestroy();
    method public boolean[] onGetSupportedCommands(android.service.voice.VoiceInteractionSession.Caller, java.lang.String[]);
    method public void onHandleAssist(android.os.Bundle);
    method public void onHide();
    method public boolean onKeyDown(int, android.view.KeyEvent);
    method public boolean onKeyLongPress(int, android.view.KeyEvent);
    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
    method public boolean onKeyUp(int, android.view.KeyEvent);
    method public void onShow(android.os.Bundle, int);
    method public void onTaskFinished(android.content.Intent, int);
    method public void onTaskStarted(android.content.Intent, int);
    method public void setContentView(android.view.View);
    method public void setTheme(int);
    method public void show();
    method public void showWindow();
    method public void startVoiceActivity(android.content.Intent);
  }
+5 −1
Original line number Diff line number Diff line
@@ -29346,7 +29346,7 @@ package android.service.voice {
    method public android.os.IBinder onBind(android.content.Intent);
    method public void onReady();
    method public void onShutdown();
    method public void startSession(android.os.Bundle, int);
    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_WITH_ASSIST = 1; // 0x1
@@ -29358,6 +29358,7 @@ package android.service.voice {
    method public void finish();
    method public android.view.LayoutInflater getLayoutInflater();
    method public android.app.Dialog getWindow();
    method public void hide();
    method public void hideWindow();
    method public void onAbortVoice(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
    method public void onBackPressed();
@@ -29372,14 +29373,17 @@ package android.service.voice {
    method public void onDestroy();
    method public boolean[] onGetSupportedCommands(android.service.voice.VoiceInteractionSession.Caller, java.lang.String[]);
    method public void onHandleAssist(android.os.Bundle);
    method public void onHide();
    method public boolean onKeyDown(int, android.view.KeyEvent);
    method public boolean onKeyLongPress(int, android.view.KeyEvent);
    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
    method public boolean onKeyUp(int, android.view.KeyEvent);
    method public void onShow(android.os.Bundle, int);
    method public void onTaskFinished(android.content.Intent, int);
    method public void onTaskStarted(android.content.Intent, int);
    method public void setContentView(android.view.View);
    method public void setTheme(int);
    method public void show();
    method public void showWindow();
    method public void startVoiceActivity(android.content.Intent);
  }
+2 −2
Original line number Diff line number Diff line
@@ -156,8 +156,8 @@ public class VoiceInteractor {

        @Override
        public void deliverCancel(IVoiceInteractorRequest request) throws RemoteException {
            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(
                    MSG_CANCEL_RESULT, request));
            mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageOO(
                    MSG_CANCEL_RESULT, request, null));
        }
    };

+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.os.Bundle;
 * @hide
 */
oneway interface IVoiceInteractionSession {
    void show(in Bundle sessionArgs, int flags);
    void hide();
    void handleAssist(in Bundle assistData);
    void taskStarted(in Intent intent, int taskId);
    void taskFinished(in Intent intent, int taskId);
+10 −5
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public class VoiceInteractionService extends Service {
    public static final String SERVICE_META_DATA = "android.voice_interaction";

    /**
     * Flag for use with {@link #startSession}: request that the session be started with
     * Flag for use with {@link #showSession: request that the session be started with
     * assist data from the currently focused activity.
     */
    public static final int START_WITH_ASSIST = 1<<0;
@@ -139,19 +139,24 @@ public class VoiceInteractionService extends Service {
    }

    /**
     * Initiate the execution of a new {@link android.service.voice.VoiceInteractionSession}.
     * Request that the associated {@link android.service.voice.VoiceInteractionSession} be
     * shown to the user, starting it if necessary.
     * @param args Arbitrary arguments that will be propagated to the session.
     */
    public void startSession(Bundle args, int flags) {
    public void showSession(Bundle args, int flags) {
        if (mSystemService == null) {
            throw new IllegalStateException("Not available until onReady() is called");
        }
        try {
            mSystemService.startSession(mInterface, args, flags);
            mSystemService.showSession(mInterface, args, flags);
        } catch (RemoteException e) {
        }
    }

    /** @hide */
    public void startSession(Bundle args, int flags) {
        showSession(args, flags);
    }
    /** @hide */
    public void startSession(Bundle args) {
        startSession(args, 0);
@@ -174,7 +179,7 @@ public class VoiceInteractionService extends Service {
    /**
     * Called during service initialization to tell you when the system is ready
     * to receive interaction from it. You should generally do initialization here
     * rather than in {@link #onCreate}. Methods such as {@link #startSession} and
     * rather than in {@link #onCreate}. Methods such as {@link #showSession} and
     * {@link #createAlwaysOnHotwordDetector}
     * will not be operational until this point.
     */
Loading