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

Commit 2ee5c368 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Update VoiceInteractionService from API review.

This may even manage to retain compatibility with existing
binaries!  (For now.)

Change-Id: I3b1386287a6b9b20b57ac2e2444fd6f458837277
parent 4573dddc
Loading
Loading
Loading
Loading
+42 −21
Original line number Diff line number Diff line
@@ -28888,11 +28888,9 @@ 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_ASSIST_GESTURE = 4; // 0x4
    field public static final int START_WITH_ASSIST = 1; // 0x1
  }
  public abstract class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
  public class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
    ctor public VoiceInteractionSession(android.content.Context);
    ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
    method public void finish();
@@ -28900,20 +28898,15 @@ package android.service.voice {
    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();
    method public abstract void onCancel(android.service.voice.VoiceInteractionSession.Request);
    method public void onCancelRequest(android.service.voice.VoiceInteractionSession.Request);
    method public void onCloseSystemDialogs();
    method public abstract void onCommand(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.String, android.os.Bundle);
    method public void onCompleteVoice(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
    method public void onComputeInsets(android.service.voice.VoiceInteractionSession.Insets);
    method public void onConfigurationChanged(android.content.res.Configuration);
    method public abstract void onConfirm(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
    method public void onCreate(android.os.Bundle, int);
    method public void onCreate();
    method public android.view.View onCreateContentView();
    method public void onDestroy();
    method public boolean[] onGetSupportedCommands(android.service.voice.VoiceInteractionSession.Caller, java.lang.String[]);
    method public boolean[] onGetSupportedCommands(java.lang.String[]);
    method public void onHandleAssist(android.os.Bundle, android.app.AssistStructure, android.app.AssistContent);
    method public void onHide();
    method public boolean onKeyDown(int, android.view.KeyEvent);
@@ -28921,7 +28914,11 @@ package android.service.voice {
    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
    method public boolean onKeyUp(int, android.view.KeyEvent);
    method public void onLowMemory();
    method public abstract void onPickOption(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
    method public void onRequestAbortVoice(android.service.voice.VoiceInteractionSession.AbortVoiceRequest);
    method public void onRequestCommand(android.service.voice.VoiceInteractionSession.CommandRequest);
    method public void onRequestCompleteVoice(android.service.voice.VoiceInteractionSession.CompleteVoiceRequest);
    method public void onRequestConfirmation(android.service.voice.VoiceInteractionSession.ConfirmationRequest);
    method public void onRequestPickOption(android.service.voice.VoiceInteractionSession.PickOptionRequest);
    method public void onShow(android.os.Bundle, int);
    method public void onTaskFinished(android.content.Intent, int);
    method public void onTaskStarted(android.content.Intent, int);
@@ -28929,12 +28926,31 @@ package android.service.voice {
    method public void setContentView(android.view.View);
    method public void setKeepAwake(boolean);
    method public void setTheme(int);
    method public void show();
    method public void showWindow();
    method public void show(android.os.Bundle, int);
    method public void startVoiceActivity(android.content.Intent);
    field public static final int SHOW_SOURCE_ASSIST_GESTURE = 4; // 0x4
    field public static final int SHOW_WITH_ASSIST = 1; // 0x1
  }
  public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public java.lang.CharSequence getMessage();
    method public void sendAbortResult(android.os.Bundle);
  }
  public static class VoiceInteractionSession.Caller {
  public static final class VoiceInteractionSession.CommandRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public java.lang.String getCommand();
    method public void sendIntermediateResult(android.os.Bundle);
    method public void sendResult(android.os.Bundle);
  }
  public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public java.lang.CharSequence getMessage();
    method public void sendCompleteResult(android.os.Bundle);
  }
  public static final class VoiceInteractionSession.ConfirmationRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public java.lang.CharSequence getPrompt();
    method public void sendConfirmationResult(boolean, android.os.Bundle);
  }
  public static final class VoiceInteractionSession.Insets {
@@ -28947,13 +28963,18 @@ package android.service.voice {
    field public final android.graphics.Region touchableRegion;
  }
  public static final class VoiceInteractionSession.PickOptionRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public android.app.VoiceInteractor.PickOptionRequest.Option[] getOptions();
    method public java.lang.CharSequence getPrompt();
    method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
    method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
  }
  public static class VoiceInteractionSession.Request {
    method public void sendAbortVoiceResult(android.os.Bundle);
    method public void sendCancelResult();
    method public void sendCommandResult(boolean, android.os.Bundle);
    method public void sendCompleteVoiceResult(android.os.Bundle);
    method public void sendConfirmResult(boolean, android.os.Bundle);
    method public void sendPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
    method public void cancel();
    method public java.lang.String getCallingPackage();
    method public int getCallingUid();
    method public android.os.Bundle getExtras();
  }
  public abstract class VoiceInteractionSessionService extends android.app.Service {
+42 −21
Original line number Diff line number Diff line
@@ -31014,11 +31014,9 @@ 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_ASSIST_GESTURE = 4; // 0x4
    field public static final int START_WITH_ASSIST = 1; // 0x1
  }
  public abstract class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
  public class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
    ctor public VoiceInteractionSession(android.content.Context);
    ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
    method public void finish();
@@ -31026,20 +31024,15 @@ package android.service.voice {
    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();
    method public abstract void onCancel(android.service.voice.VoiceInteractionSession.Request);
    method public void onCancelRequest(android.service.voice.VoiceInteractionSession.Request);
    method public void onCloseSystemDialogs();
    method public abstract void onCommand(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.String, android.os.Bundle);
    method public void onCompleteVoice(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
    method public void onComputeInsets(android.service.voice.VoiceInteractionSession.Insets);
    method public void onConfigurationChanged(android.content.res.Configuration);
    method public abstract void onConfirm(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.os.Bundle);
    method public void onCreate(android.os.Bundle, int);
    method public void onCreate();
    method public android.view.View onCreateContentView();
    method public void onDestroy();
    method public boolean[] onGetSupportedCommands(android.service.voice.VoiceInteractionSession.Caller, java.lang.String[]);
    method public boolean[] onGetSupportedCommands(java.lang.String[]);
    method public void onHandleAssist(android.os.Bundle, android.app.AssistStructure, android.app.AssistContent);
    method public void onHide();
    method public boolean onKeyDown(int, android.view.KeyEvent);
@@ -31047,7 +31040,11 @@ package android.service.voice {
    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
    method public boolean onKeyUp(int, android.view.KeyEvent);
    method public void onLowMemory();
    method public abstract void onPickOption(android.service.voice.VoiceInteractionSession.Caller, android.service.voice.VoiceInteractionSession.Request, java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
    method public void onRequestAbortVoice(android.service.voice.VoiceInteractionSession.AbortVoiceRequest);
    method public void onRequestCommand(android.service.voice.VoiceInteractionSession.CommandRequest);
    method public void onRequestCompleteVoice(android.service.voice.VoiceInteractionSession.CompleteVoiceRequest);
    method public void onRequestConfirmation(android.service.voice.VoiceInteractionSession.ConfirmationRequest);
    method public void onRequestPickOption(android.service.voice.VoiceInteractionSession.PickOptionRequest);
    method public void onShow(android.os.Bundle, int);
    method public void onTaskFinished(android.content.Intent, int);
    method public void onTaskStarted(android.content.Intent, int);
@@ -31055,12 +31052,31 @@ package android.service.voice {
    method public void setContentView(android.view.View);
    method public void setKeepAwake(boolean);
    method public void setTheme(int);
    method public void show();
    method public void showWindow();
    method public void show(android.os.Bundle, int);
    method public void startVoiceActivity(android.content.Intent);
    field public static final int SHOW_SOURCE_ASSIST_GESTURE = 4; // 0x4
    field public static final int SHOW_WITH_ASSIST = 1; // 0x1
  }
  public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public java.lang.CharSequence getMessage();
    method public void sendAbortResult(android.os.Bundle);
  }
  public static class VoiceInteractionSession.Caller {
  public static final class VoiceInteractionSession.CommandRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public java.lang.String getCommand();
    method public void sendIntermediateResult(android.os.Bundle);
    method public void sendResult(android.os.Bundle);
  }
  public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public java.lang.CharSequence getMessage();
    method public void sendCompleteResult(android.os.Bundle);
  }
  public static final class VoiceInteractionSession.ConfirmationRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public java.lang.CharSequence getPrompt();
    method public void sendConfirmationResult(boolean, android.os.Bundle);
  }
  public static final class VoiceInteractionSession.Insets {
@@ -31073,13 +31089,18 @@ package android.service.voice {
    field public final android.graphics.Region touchableRegion;
  }
  public static final class VoiceInteractionSession.PickOptionRequest extends android.service.voice.VoiceInteractionSession.Request {
    method public android.app.VoiceInteractor.PickOptionRequest.Option[] getOptions();
    method public java.lang.CharSequence getPrompt();
    method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
    method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
  }
  public static class VoiceInteractionSession.Request {
    method public void sendAbortVoiceResult(android.os.Bundle);
    method public void sendCancelResult();
    method public void sendCommandResult(boolean, android.os.Bundle);
    method public void sendCompleteVoiceResult(android.os.Bundle);
    method public void sendConfirmResult(boolean, android.os.Bundle);
    method public void sendPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
    method public void cancel();
    method public java.lang.String getCallingPackage();
    method public int getCallingUid();
    method public android.os.Bundle getExtras();
  }
  public abstract class VoiceInteractionSessionService extends android.app.Service {
+1 −1
Original line number Diff line number Diff line
@@ -508,7 +508,7 @@ public class VoiceInteractor {
    }

    /**
     * Execute an extended command using the trusted system VoiceInteractionService.
     * Execute a vendor-specific command using the trusted system VoiceInteractionService.
     * This allows an Activity to request additional information from the user needed to
     * complete an action (e.g. booking a table might have several possible times that the
     * user could select from or an app might need the user to agree to a terms of service).
+4 −19
Original line number Diff line number Diff line
@@ -70,25 +70,6 @@ public class VoiceInteractionService extends Service {
     */
    public static final String SERVICE_META_DATA = "android.voice_interaction";

    /**
     * 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;

    /**
     * @hide
     * Flag for use with {@link #showSession}: request that the session be started with
     * a screen shot of the currently focused activity.
     */
    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 assist gesture.
     */
    public static final int START_SOURCE_ASSIST_GESTURE = 1<<2;

    IVoiceInteractionService mInterface = new IVoiceInteractionService.Stub() {
        @Override public void ready() {
            mHandler.sendEmptyMessage(MSG_READY);
@@ -176,6 +157,10 @@ public class VoiceInteractionService extends Service {
     * 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.
     * @param flags Indicates additional optional behavior that should be performed.  May
     * be {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST}
     * to request that the system generate and deliver assist data on the current foreground
     * app as part of showing the session UI.
     */
    public void showSession(Bundle args, int flags) {
        if (mSystemService == null) {
+387 −123

File changed.

Preview size limit exceeded, changes collapsed.

Loading