am 74f3d396: Merge "Allow different visual and voice assist prompts" into mnc-dev
* commit '74f3d396712a805f5d2c6c1bb769c92b815dec87': Allow different visual and voice assist prompts
This commit is contained in:
@@ -5498,7 +5498,8 @@ package android.app {
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.AbortVoiceRequest extends android.app.VoiceInteractor.Request {
|
||||
ctor public VoiceInteractor.AbortVoiceRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
ctor public VoiceInteractor.AbortVoiceRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
|
||||
ctor public deprecated VoiceInteractor.AbortVoiceRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
method public void onAbortResult(android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -5508,17 +5509,20 @@ package android.app {
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.CompleteVoiceRequest extends android.app.VoiceInteractor.Request {
|
||||
ctor public VoiceInteractor.CompleteVoiceRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
ctor public VoiceInteractor.CompleteVoiceRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
|
||||
ctor public deprecated VoiceInteractor.CompleteVoiceRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
method public void onCompleteResult(android.os.Bundle);
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.ConfirmationRequest extends android.app.VoiceInteractor.Request {
|
||||
ctor public VoiceInteractor.ConfirmationRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
ctor public VoiceInteractor.ConfirmationRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
|
||||
ctor public deprecated VoiceInteractor.ConfirmationRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
method public void onConfirmationResult(boolean, android.os.Bundle);
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.PickOptionRequest extends android.app.VoiceInteractor.Request {
|
||||
ctor public VoiceInteractor.PickOptionRequest(java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
ctor public VoiceInteractor.PickOptionRequest(android.app.VoiceInteractor.Prompt, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
ctor public deprecated VoiceInteractor.PickOptionRequest(java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
method public void onPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -5537,6 +5541,17 @@ package android.app {
|
||||
field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.PickOptionRequest.Option> CREATOR;
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.Prompt implements android.os.Parcelable {
|
||||
ctor public VoiceInteractor.Prompt(java.lang.CharSequence[], java.lang.CharSequence);
|
||||
ctor public VoiceInteractor.Prompt(java.lang.CharSequence);
|
||||
method public int countVoicePrompts();
|
||||
method public int describeContents();
|
||||
method public java.lang.CharSequence getVisualPrompt();
|
||||
method public java.lang.CharSequence getVoicePromptAt(int);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.Prompt> CREATOR;
|
||||
}
|
||||
|
||||
public static abstract class VoiceInteractor.Request {
|
||||
method public void cancel();
|
||||
method public android.app.Activity getActivity();
|
||||
@@ -28987,7 +29002,8 @@ package android.service.voice {
|
||||
}
|
||||
|
||||
public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
|
||||
method public java.lang.CharSequence getMessage();
|
||||
method public deprecated java.lang.CharSequence getMessage();
|
||||
method public android.app.VoiceInteractor.Prompt getVoicePrompt();
|
||||
method public void sendAbortResult(android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -28998,12 +29014,14 @@ package android.service.voice {
|
||||
}
|
||||
|
||||
public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
|
||||
method public java.lang.CharSequence getMessage();
|
||||
method public deprecated java.lang.CharSequence getMessage();
|
||||
method public android.app.VoiceInteractor.Prompt getVoicePrompt();
|
||||
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 deprecated java.lang.CharSequence getPrompt();
|
||||
method public android.app.VoiceInteractor.Prompt getVoicePrompt();
|
||||
method public void sendConfirmationResult(boolean, android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -29019,7 +29037,8 @@ package android.service.voice {
|
||||
|
||||
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 deprecated java.lang.CharSequence getPrompt();
|
||||
method public android.app.VoiceInteractor.Prompt getVoicePrompt();
|
||||
method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -5594,7 +5594,8 @@ package android.app {
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.AbortVoiceRequest extends android.app.VoiceInteractor.Request {
|
||||
ctor public VoiceInteractor.AbortVoiceRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
ctor public VoiceInteractor.AbortVoiceRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
|
||||
ctor public deprecated VoiceInteractor.AbortVoiceRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
method public void onAbortResult(android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -5604,17 +5605,20 @@ package android.app {
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.CompleteVoiceRequest extends android.app.VoiceInteractor.Request {
|
||||
ctor public VoiceInteractor.CompleteVoiceRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
ctor public VoiceInteractor.CompleteVoiceRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
|
||||
ctor public deprecated VoiceInteractor.CompleteVoiceRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
method public void onCompleteResult(android.os.Bundle);
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.ConfirmationRequest extends android.app.VoiceInteractor.Request {
|
||||
ctor public VoiceInteractor.ConfirmationRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
ctor public VoiceInteractor.ConfirmationRequest(android.app.VoiceInteractor.Prompt, android.os.Bundle);
|
||||
ctor public deprecated VoiceInteractor.ConfirmationRequest(java.lang.CharSequence, android.os.Bundle);
|
||||
method public void onConfirmationResult(boolean, android.os.Bundle);
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.PickOptionRequest extends android.app.VoiceInteractor.Request {
|
||||
ctor public VoiceInteractor.PickOptionRequest(java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
ctor public VoiceInteractor.PickOptionRequest(android.app.VoiceInteractor.Prompt, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
ctor public deprecated VoiceInteractor.PickOptionRequest(java.lang.CharSequence, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
method public void onPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -5633,6 +5637,17 @@ package android.app {
|
||||
field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.PickOptionRequest.Option> CREATOR;
|
||||
}
|
||||
|
||||
public static class VoiceInteractor.Prompt implements android.os.Parcelable {
|
||||
ctor public VoiceInteractor.Prompt(java.lang.CharSequence[], java.lang.CharSequence);
|
||||
ctor public VoiceInteractor.Prompt(java.lang.CharSequence);
|
||||
method public int countVoicePrompts();
|
||||
method public int describeContents();
|
||||
method public java.lang.CharSequence getVisualPrompt();
|
||||
method public java.lang.CharSequence getVoicePromptAt(int);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.Prompt> CREATOR;
|
||||
}
|
||||
|
||||
public static abstract class VoiceInteractor.Request {
|
||||
method public void cancel();
|
||||
method public android.app.Activity getActivity();
|
||||
@@ -31120,7 +31135,8 @@ package android.service.voice {
|
||||
}
|
||||
|
||||
public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
|
||||
method public java.lang.CharSequence getMessage();
|
||||
method public deprecated java.lang.CharSequence getMessage();
|
||||
method public android.app.VoiceInteractor.Prompt getVoicePrompt();
|
||||
method public void sendAbortResult(android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -31131,12 +31147,14 @@ package android.service.voice {
|
||||
}
|
||||
|
||||
public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
|
||||
method public java.lang.CharSequence getMessage();
|
||||
method public deprecated java.lang.CharSequence getMessage();
|
||||
method public android.app.VoiceInteractor.Prompt getVoicePrompt();
|
||||
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 deprecated java.lang.CharSequence getPrompt();
|
||||
method public android.app.VoiceInteractor.Prompt getVoicePrompt();
|
||||
method public void sendConfirmationResult(boolean, android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -31152,7 +31170,8 @@ package android.service.voice {
|
||||
|
||||
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 deprecated java.lang.CharSequence getPrompt();
|
||||
method public android.app.VoiceInteractor.Prompt getVoicePrompt();
|
||||
method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
|
||||
}
|
||||
|
||||
@@ -17,3 +17,4 @@
|
||||
package android.app;
|
||||
|
||||
parcelable VoiceInteractor.PickOptionRequest.Option;
|
||||
parcelable VoiceInteractor.Prompt;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.app;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
@@ -257,7 +259,7 @@ public class VoiceInteractor {
|
||||
* so the user can give a confirmation.
|
||||
*/
|
||||
public static class ConfirmationRequest extends Request {
|
||||
final CharSequence mPrompt;
|
||||
final Prompt mPrompt;
|
||||
final Bundle mExtras;
|
||||
|
||||
/**
|
||||
@@ -266,11 +268,23 @@ public class VoiceInteractor {
|
||||
* should be spoken.
|
||||
* @param extras Additional optional information or null.
|
||||
*/
|
||||
public ConfirmationRequest(CharSequence prompt, Bundle extras) {
|
||||
public ConfirmationRequest(@Nullable Prompt prompt, @Nullable Bundle extras) {
|
||||
mPrompt = prompt;
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new confirmation request.
|
||||
* @param prompt Optional confirmation to speak to the user or null if nothing
|
||||
* should be spoken.
|
||||
* @param extras Additional optional information or null.
|
||||
* @deprecated Prefer the version that takes a {@link Prompt}.
|
||||
*/
|
||||
public ConfirmationRequest(CharSequence prompt, Bundle extras) {
|
||||
mPrompt = (prompt != null ? new Prompt(prompt) : null);
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
public void onConfirmationResult(boolean confirmed, Bundle result) {
|
||||
}
|
||||
|
||||
@@ -288,7 +302,7 @@ public class VoiceInteractor {
|
||||
* either {@link #onPickOptionResult} or {@link #onCancel()}.
|
||||
*/
|
||||
public static class PickOptionRequest extends Request {
|
||||
final CharSequence mPrompt;
|
||||
final Prompt mPrompt;
|
||||
final Option[] mOptions;
|
||||
final Bundle mExtras;
|
||||
|
||||
@@ -417,12 +431,27 @@ public class VoiceInteractor {
|
||||
* @param options The set of {@link Option}s the user is selecting from.
|
||||
* @param extras Additional optional information or null.
|
||||
*/
|
||||
public PickOptionRequest(CharSequence prompt, Option[] options, Bundle extras) {
|
||||
public PickOptionRequest(@Nullable Prompt prompt, Option[] options,
|
||||
@Nullable Bundle extras) {
|
||||
mPrompt = prompt;
|
||||
mOptions = options;
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new pick option request.
|
||||
* @param prompt Optional question to be asked of the user when the options are
|
||||
* presented or null if nothing should be asked.
|
||||
* @param options The set of {@link Option}s the user is selecting from.
|
||||
* @param extras Additional optional information or null.
|
||||
* @deprecated Prefer the version that takes a {@link Prompt}.
|
||||
*/
|
||||
public PickOptionRequest(CharSequence prompt, Option[] options, Bundle extras) {
|
||||
mPrompt = (prompt != null ? new Prompt(prompt) : null);
|
||||
mOptions = options;
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a single option is confirmed or narrowed to one of several options.
|
||||
* @param finished True if the voice interaction has finished making a selection, in
|
||||
@@ -451,17 +480,29 @@ public class VoiceInteractor {
|
||||
* interaction task.
|
||||
*/
|
||||
public static class CompleteVoiceRequest extends Request {
|
||||
final CharSequence mMessage;
|
||||
final Prompt mPrompt;
|
||||
final Bundle mExtras;
|
||||
|
||||
/**
|
||||
* Create a new completed voice interaction request.
|
||||
* @param prompt Optional message to speak to the user about the completion status of
|
||||
* the task or null if nothing should be spoken.
|
||||
* @param extras Additional optional information or null.
|
||||
*/
|
||||
public CompleteVoiceRequest(@Nullable Prompt prompt, @Nullable Bundle extras) {
|
||||
mPrompt = prompt;
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new completed voice interaction request.
|
||||
* @param message Optional message to speak to the user about the completion status of
|
||||
* the task or null if nothing should be spoken.
|
||||
* @param extras Additional optional information or null.
|
||||
* @deprecated Prefer the version that takes a {@link Prompt}.
|
||||
*/
|
||||
public CompleteVoiceRequest(CharSequence message, Bundle extras) {
|
||||
mMessage = message;
|
||||
mPrompt = (message != null ? new Prompt(message) : null);
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
@@ -470,7 +511,7 @@ public class VoiceInteractor {
|
||||
|
||||
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
||||
IVoiceInteractorCallback callback) throws RemoteException {
|
||||
return interactor.startCompleteVoice(packageName, callback, mMessage, mExtras);
|
||||
return interactor.startCompleteVoice(packageName, callback, mPrompt, mExtras);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,17 +527,29 @@ public class VoiceInteractor {
|
||||
* interaction task.
|
||||
*/
|
||||
public static class AbortVoiceRequest extends Request {
|
||||
final CharSequence mMessage;
|
||||
final Prompt mPrompt;
|
||||
final Bundle mExtras;
|
||||
|
||||
/**
|
||||
* Create a new voice abort request.
|
||||
* @param prompt Optional message to speak to the user indicating why the task could
|
||||
* not be completed by voice or null if nothing should be spoken.
|
||||
* @param extras Additional optional information or null.
|
||||
*/
|
||||
public AbortVoiceRequest(@Nullable Prompt prompt, @Nullable Bundle extras) {
|
||||
mPrompt = prompt;
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new voice abort request.
|
||||
* @param message Optional message to speak to the user indicating why the task could
|
||||
* not be completed by voice or null if nothing should be spoken.
|
||||
* @param extras Additional optional information or null.
|
||||
* @deprecated Prefer the version that takes a {@link Prompt}.
|
||||
*/
|
||||
public AbortVoiceRequest(CharSequence message, Bundle extras) {
|
||||
mMessage = message;
|
||||
mPrompt = (message != null ? new Prompt(message) : null);
|
||||
mExtras = extras;
|
||||
}
|
||||
|
||||
@@ -505,7 +558,7 @@ public class VoiceInteractor {
|
||||
|
||||
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
||||
IVoiceInteractorCallback callback) throws RemoteException {
|
||||
return interactor.startAbortVoice(packageName, callback, mMessage, mExtras);
|
||||
return interactor.startAbortVoice(packageName, callback, mPrompt, mExtras);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +603,101 @@ public class VoiceInteractor {
|
||||
IVoiceInteractorCallback callback) throws RemoteException {
|
||||
return interactor.startCommand(packageName, callback, mCommand, mArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of voice prompts to use with the voice interaction system to confirm an action, select
|
||||
* an option, or do similar operations. Multiple voice prompts may be provided for variety. A
|
||||
* visual prompt must be provided, which might not match the spoken version. For example, the
|
||||
* confirmation "Are you sure you want to purchase this item?" might use a visual label like
|
||||
* "Purchase item".
|
||||
*/
|
||||
public static class Prompt implements Parcelable {
|
||||
// Mandatory voice prompt. Must contain at least one item, which must not be null.
|
||||
private final CharSequence[] mVoicePrompts;
|
||||
|
||||
// Mandatory visual prompt.
|
||||
private final CharSequence mVisualPrompt;
|
||||
|
||||
/**
|
||||
* Constructs a prompt set.
|
||||
* @param voicePrompts An array of one or more voice prompts. Must not be empty or null.
|
||||
* @param visualPrompt A prompt to display on the screen. Must not be null.
|
||||
*/
|
||||
public Prompt(@NonNull CharSequence[] voicePrompts, @NonNull CharSequence visualPrompt) {
|
||||
if (voicePrompts == null) {
|
||||
throw new NullPointerException("voicePrompts must not be null");
|
||||
}
|
||||
if (voicePrompts.length == 0) {
|
||||
throw new IllegalArgumentException("voicePrompts must not be empty");
|
||||
}
|
||||
if (visualPrompt == null) {
|
||||
throw new NullPointerException("visualPrompt must not be null");
|
||||
}
|
||||
this.mVoicePrompts = voicePrompts;
|
||||
this.mVisualPrompt = visualPrompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a prompt set with single prompt used for all interactions. This is most useful
|
||||
* in test apps. Non-trivial apps should prefer the detailed constructor.
|
||||
*/
|
||||
public Prompt(@NonNull CharSequence prompt) {
|
||||
this.mVoicePrompts = new CharSequence[] { prompt };
|
||||
this.mVisualPrompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a prompt to use for voice interactions.
|
||||
*/
|
||||
@NonNull
|
||||
public CharSequence getVoicePromptAt(int index) {
|
||||
return mVoicePrompts[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of different voice prompts.
|
||||
*/
|
||||
public int countVoicePrompts() {
|
||||
return mVoicePrompts.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the prompt to use for visual display.
|
||||
*/
|
||||
@NonNull
|
||||
public CharSequence getVisualPrompt() {
|
||||
return mVisualPrompt;
|
||||
}
|
||||
|
||||
/** Constructor to support Parcelable behavior. */
|
||||
Prompt(Parcel in) {
|
||||
mVoicePrompts = in.readCharSequenceArray();
|
||||
mVisualPrompt = in.readCharSequence();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeCharSequenceArray(mVoicePrompts);
|
||||
dest.writeCharSequence(mVisualPrompt);
|
||||
}
|
||||
|
||||
public static final Creator<Prompt> CREATOR
|
||||
= new Creator<Prompt>() {
|
||||
public Prompt createFromParcel(Parcel in) {
|
||||
return new Prompt(in);
|
||||
}
|
||||
|
||||
public Prompt[] newArray(int size) {
|
||||
return new Prompt[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
VoiceInteractor(IVoiceInteractor interactor, Context context, Activity activity,
|
||||
Looper looper) {
|
||||
@@ -631,7 +778,7 @@ public class VoiceInteractor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the supported commands available from the VoiceinteractionService.
|
||||
* Queries the supported commands available from the VoiceInteractionService.
|
||||
* The command is a string that describes the generic operation to be performed.
|
||||
* An example might be "org.example.commands.PICK_DATE" to ask the user to pick
|
||||
* a date. (Note: This is not an actual working example.)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.service.voice;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Dialog;
|
||||
import android.app.Instrumentation;
|
||||
import android.app.VoiceInteractor;
|
||||
@@ -122,7 +123,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
final IVoiceInteractor mInteractor = new IVoiceInteractor.Stub() {
|
||||
@Override
|
||||
public IVoiceInteractorRequest startConfirmation(String callingPackage,
|
||||
IVoiceInteractorCallback callback, CharSequence prompt, Bundle extras) {
|
||||
IVoiceInteractorCallback callback, VoiceInteractor.Prompt prompt, Bundle extras) {
|
||||
ConfirmationRequest request = new ConfirmationRequest(callingPackage,
|
||||
Binder.getCallingUid(), callback, VoiceInteractionSession.this,
|
||||
prompt, extras);
|
||||
@@ -134,7 +135,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
|
||||
@Override
|
||||
public IVoiceInteractorRequest startPickOption(String callingPackage,
|
||||
IVoiceInteractorCallback callback, CharSequence prompt,
|
||||
IVoiceInteractorCallback callback, VoiceInteractor.Prompt prompt,
|
||||
VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
|
||||
PickOptionRequest request = new PickOptionRequest(callingPackage,
|
||||
Binder.getCallingUid(), callback, VoiceInteractionSession.this,
|
||||
@@ -147,7 +148,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
|
||||
@Override
|
||||
public IVoiceInteractorRequest startCompleteVoice(String callingPackage,
|
||||
IVoiceInteractorCallback callback, CharSequence message, Bundle extras) {
|
||||
IVoiceInteractorCallback callback, VoiceInteractor.Prompt message, Bundle extras) {
|
||||
CompleteVoiceRequest request = new CompleteVoiceRequest(callingPackage,
|
||||
Binder.getCallingUid(), callback, VoiceInteractionSession.this,
|
||||
message, extras);
|
||||
@@ -159,7 +160,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
|
||||
@Override
|
||||
public IVoiceInteractorRequest startAbortVoice(String callingPackage,
|
||||
IVoiceInteractorCallback callback, CharSequence message, Bundle extras) {
|
||||
IVoiceInteractorCallback callback, VoiceInteractor.Prompt message, Bundle extras) {
|
||||
AbortVoiceRequest request = new AbortVoiceRequest(callingPackage,
|
||||
Binder.getCallingUid(), callback, VoiceInteractionSession.this,
|
||||
message, extras);
|
||||
@@ -404,10 +405,10 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
* VoiceInteractor.ConfirmationRequest}.
|
||||
*/
|
||||
public static final class ConfirmationRequest extends Request {
|
||||
final CharSequence mPrompt;
|
||||
final VoiceInteractor.Prompt mPrompt;
|
||||
|
||||
ConfirmationRequest(String packageName, int uid, IVoiceInteractorCallback callback,
|
||||
VoiceInteractionSession session, CharSequence prompt, Bundle extras) {
|
||||
VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
|
||||
super(packageName, uid, callback, session, extras);
|
||||
mPrompt = prompt;
|
||||
}
|
||||
@@ -417,10 +418,22 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
* {@link android.app.VoiceInteractor.ConfirmationRequest
|
||||
* VoiceInteractor.ConfirmationRequest}.
|
||||
*/
|
||||
public CharSequence getPrompt() {
|
||||
@Nullable
|
||||
public VoiceInteractor.Prompt getVoicePrompt() {
|
||||
return mPrompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the prompt informing the user of what will happen, as per
|
||||
* {@link android.app.VoiceInteractor.ConfirmationRequest
|
||||
* VoiceInteractor.ConfirmationRequest}.
|
||||
* @deprecated Prefer {@link #getVoicePrompt()} which allows multiple voice prompts.
|
||||
*/
|
||||
@Nullable
|
||||
public CharSequence getPrompt() {
|
||||
return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report that the voice interactor has confirmed the operation with the user, resulting
|
||||
* in a call to
|
||||
@@ -437,11 +450,11 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
* {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
|
||||
*/
|
||||
public static final class PickOptionRequest extends Request {
|
||||
final CharSequence mPrompt;
|
||||
final VoiceInteractor.Prompt mPrompt;
|
||||
final VoiceInteractor.PickOptionRequest.Option[] mOptions;
|
||||
|
||||
PickOptionRequest(String packageName, int uid, IVoiceInteractorCallback callback,
|
||||
VoiceInteractionSession session, CharSequence prompt,
|
||||
VoiceInteractionSession session, VoiceInteractor.Prompt prompt,
|
||||
VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
|
||||
super(packageName, uid, callback, session, extras);
|
||||
mPrompt = prompt;
|
||||
@@ -452,10 +465,21 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
* Return the prompt informing the user of what they are picking, as per
|
||||
* {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
|
||||
*/
|
||||
public CharSequence getPrompt() {
|
||||
@Nullable
|
||||
public VoiceInteractor.Prompt getVoicePrompt() {
|
||||
return mPrompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the prompt informing the user of what they are picking, as per
|
||||
* {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
|
||||
* @deprecated Prefer {@link #getVoicePrompt()} which allows multiple voice prompts.
|
||||
*/
|
||||
@Nullable
|
||||
public CharSequence getPrompt() {
|
||||
return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the set of options the user is picking from, as per
|
||||
* {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
|
||||
@@ -494,12 +518,12 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
* VoiceInteractor.CompleteVoiceRequest}.
|
||||
*/
|
||||
public static final class CompleteVoiceRequest extends Request {
|
||||
final CharSequence mMessage;
|
||||
final VoiceInteractor.Prompt mPrompt;
|
||||
|
||||
CompleteVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback,
|
||||
VoiceInteractionSession session, CharSequence message, Bundle extras) {
|
||||
VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
|
||||
super(packageName, uid, callback, session, extras);
|
||||
mMessage = message;
|
||||
mPrompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -507,8 +531,20 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
* {@link android.app.VoiceInteractor.CompleteVoiceRequest
|
||||
* VoiceInteractor.CompleteVoiceRequest}.
|
||||
*/
|
||||
@Nullable
|
||||
public VoiceInteractor.Prompt getVoicePrompt() {
|
||||
return mPrompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the message informing the user of the completion, as per
|
||||
* {@link android.app.VoiceInteractor.CompleteVoiceRequest
|
||||
* VoiceInteractor.CompleteVoiceRequest}.
|
||||
* @deprecated Prefer {@link #getVoicePrompt()} which allows a separate visual message.
|
||||
*/
|
||||
@Nullable
|
||||
public CharSequence getMessage() {
|
||||
return mMessage;
|
||||
return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -527,20 +563,31 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
* {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
|
||||
*/
|
||||
public static final class AbortVoiceRequest extends Request {
|
||||
final CharSequence mMessage;
|
||||
final VoiceInteractor.Prompt mPrompt;
|
||||
|
||||
AbortVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback,
|
||||
VoiceInteractionSession session, CharSequence message, Bundle extras) {
|
||||
VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
|
||||
super(packageName, uid, callback, session, extras);
|
||||
mMessage = message;
|
||||
mPrompt = prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the message informing the user of the problem, as per
|
||||
* {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
|
||||
*/
|
||||
@Nullable
|
||||
public VoiceInteractor.Prompt getVoicePrompt() {
|
||||
return mPrompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the message informing the user of the problem, as per
|
||||
* {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
|
||||
* @deprecated Prefer {@link #getVoicePrompt()} which allows a separate visual message.
|
||||
*/
|
||||
@Nullable
|
||||
public CharSequence getMessage() {
|
||||
return mMessage;
|
||||
return (mPrompt != null ? mPrompt.getVoicePromptAt(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1035,7 +1082,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
||||
public void onCreate(Bundle args) {
|
||||
doOnCreate();
|
||||
}
|
||||
|
||||
|
||||
/** @hide */
|
||||
public void onCreate(Bundle args, int showFlags) {
|
||||
doOnCreate();
|
||||
|
||||
@@ -27,14 +27,14 @@ import com.android.internal.app.IVoiceInteractorRequest;
|
||||
*/
|
||||
interface IVoiceInteractor {
|
||||
IVoiceInteractorRequest startConfirmation(String callingPackage,
|
||||
IVoiceInteractorCallback callback, CharSequence prompt, in Bundle extras);
|
||||
IVoiceInteractorCallback callback, in VoiceInteractor.Prompt prompt, in Bundle extras);
|
||||
IVoiceInteractorRequest startPickOption(String callingPackage,
|
||||
IVoiceInteractorCallback callback, CharSequence prompt,
|
||||
IVoiceInteractorCallback callback, in VoiceInteractor.Prompt prompt,
|
||||
in VoiceInteractor.PickOptionRequest.Option[] options, in Bundle extras);
|
||||
IVoiceInteractorRequest startCompleteVoice(String callingPackage,
|
||||
IVoiceInteractorCallback callback, CharSequence message, in Bundle extras);
|
||||
IVoiceInteractorCallback callback, in VoiceInteractor.Prompt prompt, in Bundle extras);
|
||||
IVoiceInteractorRequest startAbortVoice(String callingPackage,
|
||||
IVoiceInteractorCallback callback, CharSequence message, in Bundle extras);
|
||||
IVoiceInteractorCallback callback, in VoiceInteractor.Prompt prompt, in Bundle extras);
|
||||
IVoiceInteractorRequest startCommand(String callingPackage,
|
||||
IVoiceInteractorCallback callback, String command, in Bundle extras);
|
||||
boolean[] supportsCommands(String callingPackage, in String[] commands);
|
||||
|
||||
Reference in New Issue
Block a user