am 639fd0e9
: am 025a5dc6
: am 108f5493
: am 3551a59b
: Merge "Work on issue #21516866: Implement voice interaction in ResolverActivity" into mnc-dev
* commit '639fd0e9d8ecb59f8d15b3f1e5ec7a6ae6cc3161': Work on issue #21516866: Implement voice interaction in ResolverActivity
This commit is contained in:
@ -28812,6 +28812,7 @@ package android.service.voice {
|
|||||||
ctor public VoiceInteractionSession(android.content.Context);
|
ctor public VoiceInteractionSession(android.content.Context);
|
||||||
ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
|
ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
|
||||||
method public void closeSystemDialogs();
|
method public void closeSystemDialogs();
|
||||||
|
method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
|
||||||
method public void finish();
|
method public void finish();
|
||||||
method public android.content.Context getContext();
|
method public android.content.Context getContext();
|
||||||
method public int getDisabledShowContext();
|
method public int getDisabledShowContext();
|
||||||
|
@ -30964,6 +30964,7 @@ package android.service.voice {
|
|||||||
ctor public VoiceInteractionSession(android.content.Context);
|
ctor public VoiceInteractionSession(android.content.Context);
|
||||||
ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
|
ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
|
||||||
method public void closeSystemDialogs();
|
method public void closeSystemDialogs();
|
||||||
|
method public void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
|
||||||
method public void finish();
|
method public void finish();
|
||||||
method public android.content.Context getContext();
|
method public android.content.Context getContext();
|
||||||
method public int getDisabledShowContext();
|
method public int getDisabledShowContext();
|
||||||
|
@ -1864,7 +1864,10 @@ public class Activity extends ContextThemeWrapper
|
|||||||
nci.children = children;
|
nci.children = children;
|
||||||
nci.fragments = fragments;
|
nci.fragments = fragments;
|
||||||
nci.loaders = loaders;
|
nci.loaders = loaders;
|
||||||
nci.voiceInteractor = mVoiceInteractor;
|
if (mVoiceInteractor != null) {
|
||||||
|
mVoiceInteractor.retainInstance();
|
||||||
|
nci.voiceInteractor = mVoiceInteractor;
|
||||||
|
}
|
||||||
return nci;
|
return nci;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5547,6 +5550,9 @@ public class Activity extends ContextThemeWrapper
|
|||||||
|
|
||||||
mFragments.dumpLoaders(innerPrefix, fd, writer, args);
|
mFragments.dumpLoaders(innerPrefix, fd, writer, args);
|
||||||
mFragments.getFragmentManager().dump(innerPrefix, fd, writer, args);
|
mFragments.getFragmentManager().dump(innerPrefix, fd, writer, args);
|
||||||
|
if (mVoiceInteractor != null) {
|
||||||
|
mVoiceInteractor.dump(innerPrefix, fd, writer, args);
|
||||||
|
}
|
||||||
|
|
||||||
if (getWindow() != null &&
|
if (getWindow() != null &&
|
||||||
getWindow().peekDecorView() != null &&
|
getWindow().peekDecorView() != null &&
|
||||||
|
@ -27,6 +27,7 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
|
import android.util.DebugUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import com.android.internal.app.IVoiceInteractor;
|
import com.android.internal.app.IVoiceInteractor;
|
||||||
import com.android.internal.app.IVoiceInteractorCallback;
|
import com.android.internal.app.IVoiceInteractorCallback;
|
||||||
@ -34,6 +35,8 @@ import com.android.internal.app.IVoiceInteractorRequest;
|
|||||||
import com.android.internal.os.HandlerCaller;
|
import com.android.internal.os.HandlerCaller;
|
||||||
import com.android.internal.os.SomeArgs;
|
import com.android.internal.os.SomeArgs;
|
||||||
|
|
||||||
|
import java.io.FileDescriptor;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,6 +71,7 @@ public final class VoiceInteractor {
|
|||||||
|
|
||||||
Context mContext;
|
Context mContext;
|
||||||
Activity mActivity;
|
Activity mActivity;
|
||||||
|
boolean mRetaining;
|
||||||
|
|
||||||
final HandlerCaller mHandlerCaller;
|
final HandlerCaller mHandlerCaller;
|
||||||
final HandlerCaller.Callback mHandlerCallerCallback = new HandlerCaller.Callback() {
|
final HandlerCaller.Callback mHandlerCallerCallback = new HandlerCaller.Callback() {
|
||||||
@ -272,6 +276,29 @@ public final class VoiceInteractor {
|
|||||||
public void onDetached() {
|
public void onDetached() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder(128);
|
||||||
|
DebugUtils.buildShortClassTag(this, sb);
|
||||||
|
sb.append(" ");
|
||||||
|
sb.append(getRequestTypeName());
|
||||||
|
sb.append(" name=");
|
||||||
|
sb.append(mName);
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
writer.print(prefix); writer.print("mRequestInterface=");
|
||||||
|
writer.println(mRequestInterface.asBinder());
|
||||||
|
writer.print(prefix); writer.print("mActivity="); writer.println(mActivity);
|
||||||
|
writer.print(prefix); writer.print("mName="); writer.println(mName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRequestTypeName() {
|
||||||
|
return "Request";
|
||||||
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
mRequestInterface = null;
|
mRequestInterface = null;
|
||||||
mContext = null;
|
mContext = null;
|
||||||
@ -333,6 +360,18 @@ public final class VoiceInteractor {
|
|||||||
public void onConfirmationResult(boolean confirmed, Bundle result) {
|
public void onConfirmationResult(boolean confirmed, Bundle result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mPrompt="); writer.println(mPrompt);
|
||||||
|
if (mExtras != null) {
|
||||||
|
writer.print(prefix); writer.print("mExtras="); writer.println(mExtras);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRequestTypeName() {
|
||||||
|
return "Confirmation";
|
||||||
|
}
|
||||||
|
|
||||||
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
||||||
IVoiceInteractorCallback callback) throws RemoteException {
|
IVoiceInteractorCallback callback) throws RemoteException {
|
||||||
return interactor.startConfirmation(packageName, callback, mPrompt, mExtras);
|
return interactor.startConfirmation(packageName, callback, mPrompt, mExtras);
|
||||||
@ -515,6 +554,38 @@ public final class VoiceInteractor {
|
|||||||
public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
|
public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mPrompt="); writer.println(mPrompt);
|
||||||
|
if (mOptions != null) {
|
||||||
|
writer.print(prefix); writer.println("Options:");
|
||||||
|
for (int i=0; i<mOptions.length; i++) {
|
||||||
|
Option op = mOptions[i];
|
||||||
|
writer.print(prefix); writer.print(" #"); writer.print(i); writer.println(":");
|
||||||
|
writer.print(prefix); writer.print(" mLabel="); writer.println(op.mLabel);
|
||||||
|
writer.print(prefix); writer.print(" mIndex="); writer.println(op.mIndex);
|
||||||
|
if (op.mSynonyms != null && op.mSynonyms.size() > 0) {
|
||||||
|
writer.print(prefix); writer.println(" Synonyms:");
|
||||||
|
for (int j=0; j<op.mSynonyms.size(); j++) {
|
||||||
|
writer.print(prefix); writer.print(" #"); writer.print(j);
|
||||||
|
writer.print(": "); writer.println(op.mSynonyms.get(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (op.mExtras != null) {
|
||||||
|
writer.print(prefix); writer.print(" mExtras=");
|
||||||
|
writer.println(op.mExtras);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mExtras != null) {
|
||||||
|
writer.print(prefix); writer.print("mExtras="); writer.println(mExtras);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRequestTypeName() {
|
||||||
|
return "PickOption";
|
||||||
|
}
|
||||||
|
|
||||||
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
||||||
IVoiceInteractorCallback callback) throws RemoteException {
|
IVoiceInteractorCallback callback) throws RemoteException {
|
||||||
return interactor.startPickOption(packageName, callback, mPrompt, mOptions, mExtras);
|
return interactor.startPickOption(packageName, callback, mPrompt, mOptions, mExtras);
|
||||||
@ -560,6 +631,18 @@ public final class VoiceInteractor {
|
|||||||
public void onCompleteResult(Bundle result) {
|
public void onCompleteResult(Bundle result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mPrompt="); writer.println(mPrompt);
|
||||||
|
if (mExtras != null) {
|
||||||
|
writer.print(prefix); writer.print("mExtras="); writer.println(mExtras);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRequestTypeName() {
|
||||||
|
return "CompleteVoice";
|
||||||
|
}
|
||||||
|
|
||||||
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
||||||
IVoiceInteractorCallback callback) throws RemoteException {
|
IVoiceInteractorCallback callback) throws RemoteException {
|
||||||
return interactor.startCompleteVoice(packageName, callback, mPrompt, mExtras);
|
return interactor.startCompleteVoice(packageName, callback, mPrompt, mExtras);
|
||||||
@ -607,6 +690,18 @@ public final class VoiceInteractor {
|
|||||||
public void onAbortResult(Bundle result) {
|
public void onAbortResult(Bundle result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mPrompt="); writer.println(mPrompt);
|
||||||
|
if (mExtras != null) {
|
||||||
|
writer.print(prefix); writer.print("mExtras="); writer.println(mExtras);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRequestTypeName() {
|
||||||
|
return "AbortVoice";
|
||||||
|
}
|
||||||
|
|
||||||
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
||||||
IVoiceInteractorCallback callback) throws RemoteException {
|
IVoiceInteractorCallback callback) throws RemoteException {
|
||||||
return interactor.startAbortVoice(packageName, callback, mPrompt, mExtras);
|
return interactor.startAbortVoice(packageName, callback, mPrompt, mExtras);
|
||||||
@ -650,6 +745,18 @@ public final class VoiceInteractor {
|
|||||||
public void onCommandResult(boolean isCompleted, Bundle result) {
|
public void onCommandResult(boolean isCompleted, Bundle result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mCommand="); writer.println(mCommand);
|
||||||
|
if (mArgs != null) {
|
||||||
|
writer.print(prefix); writer.print("mArgs="); writer.println(mArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRequestTypeName() {
|
||||||
|
return "Command";
|
||||||
|
}
|
||||||
|
|
||||||
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
|
||||||
IVoiceInteractorCallback callback) throws RemoteException {
|
IVoiceInteractorCallback callback) throws RemoteException {
|
||||||
return interactor.startCommand(packageName, callback, mCommand, mArgs);
|
return interactor.startCommand(packageName, callback, mCommand, mArgs);
|
||||||
@ -721,6 +828,30 @@ public final class VoiceInteractor {
|
|||||||
return mVisualPrompt;
|
return mVisualPrompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder(128);
|
||||||
|
DebugUtils.buildShortClassTag(this, sb);
|
||||||
|
if (mVisualPrompt != null && mVoicePrompts != null && mVoicePrompts.length == 1
|
||||||
|
&& mVisualPrompt.equals(mVoicePrompts[0])) {
|
||||||
|
sb.append(" ");
|
||||||
|
sb.append(mVisualPrompt);
|
||||||
|
} else {
|
||||||
|
if (mVisualPrompt != null) {
|
||||||
|
sb.append(" visual="); sb.append(mVisualPrompt);
|
||||||
|
}
|
||||||
|
if (mVoicePrompts != null) {
|
||||||
|
sb.append(", voice=");
|
||||||
|
for (int i=0; i<mVoicePrompts.length; i++) {
|
||||||
|
if (i > 0) sb.append(" | ");
|
||||||
|
sb.append(mVoicePrompts[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/** Constructor to support Parcelable behavior. */
|
/** Constructor to support Parcelable behavior. */
|
||||||
Prompt(Parcel in) {
|
Prompt(Parcel in) {
|
||||||
mVoicePrompts = in.readCharSequenceArray();
|
mVoicePrompts = in.readCharSequenceArray();
|
||||||
@ -773,7 +904,7 @@ public final class VoiceInteractor {
|
|||||||
if (N < 1) {
|
if (N < 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ArrayList<Request> list = new ArrayList<Request>(N);
|
ArrayList<Request> list = new ArrayList<>(N);
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
list.add(mActiveRequests.valueAt(i));
|
list.add(mActiveRequests.valueAt(i));
|
||||||
}
|
}
|
||||||
@ -781,6 +912,7 @@ public final class VoiceInteractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void attachActivity(Activity activity) {
|
void attachActivity(Activity activity) {
|
||||||
|
mRetaining = false;
|
||||||
if (mActivity == activity) {
|
if (mActivity == activity) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -797,6 +929,10 @@ public final class VoiceInteractor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void retainInstance() {
|
||||||
|
mRetaining = true;
|
||||||
|
}
|
||||||
|
|
||||||
void detachActivity() {
|
void detachActivity() {
|
||||||
ArrayList<Request> reqs = makeRequestList();
|
ArrayList<Request> reqs = makeRequestList();
|
||||||
if (reqs != null) {
|
if (reqs != null) {
|
||||||
@ -807,6 +943,16 @@ public final class VoiceInteractor {
|
|||||||
req.mContext = null;
|
req.mContext = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!mRetaining) {
|
||||||
|
reqs = makeRequestList();
|
||||||
|
if (reqs != null) {
|
||||||
|
for (int i=0; i<reqs.size(); i++) {
|
||||||
|
Request req = reqs.get(i);
|
||||||
|
req.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mActiveRequests.clear();
|
||||||
|
}
|
||||||
mContext = null;
|
mContext = null;
|
||||||
mActivity = null;
|
mActivity = null;
|
||||||
}
|
}
|
||||||
@ -902,4 +1048,22 @@ public final class VoiceInteractor {
|
|||||||
throw new RuntimeException("Voice interactor has died", e);
|
throw new RuntimeException("Voice interactor has died", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
String innerPrefix = prefix + " ";
|
||||||
|
if (mActiveRequests.size() > 0) {
|
||||||
|
writer.print(prefix); writer.println("Active voice requests:");
|
||||||
|
for (int i=0; i<mActiveRequests.size(); i++) {
|
||||||
|
Request req = mActiveRequests.valueAt(i);
|
||||||
|
writer.print(prefix); writer.print(" #"); writer.print(i);
|
||||||
|
writer.print(": ");
|
||||||
|
writer.println(req);
|
||||||
|
req.dump(innerPrefix, fd, writer, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writer.print(prefix); writer.println("VoiceInteractor misc state:");
|
||||||
|
writer.print(prefix); writer.print(" mInteractor=");
|
||||||
|
writer.println(mInteractor.asBinder());
|
||||||
|
writer.print(prefix); writer.print(" mActivity="); writer.println(mActivity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,9 @@ import android.os.Handler;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
|
import android.util.DebugUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@ -55,6 +57,8 @@ import com.android.internal.app.IVoiceInteractorRequest;
|
|||||||
import com.android.internal.os.HandlerCaller;
|
import com.android.internal.os.HandlerCaller;
|
||||||
import com.android.internal.os.SomeArgs;
|
import com.android.internal.os.SomeArgs;
|
||||||
|
|
||||||
|
import java.io.FileDescriptor;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
@ -369,6 +373,34 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder(128);
|
||||||
|
DebugUtils.buildShortClassTag(this, sb);
|
||||||
|
sb.append(" ");
|
||||||
|
sb.append(mInterface.asBinder());
|
||||||
|
sb.append(" pkg=");
|
||||||
|
sb.append(mCallingPackage);
|
||||||
|
sb.append(" uid=");
|
||||||
|
UserHandle.formatUid(sb, mCallingUid);
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
writer.print(prefix); writer.print("mInterface=");
|
||||||
|
writer.println(mInterface.asBinder());
|
||||||
|
writer.print(prefix); writer.print("mCallingPackage="); writer.print(mCallingPackage);
|
||||||
|
writer.print(" mCallingUid="); UserHandle.formatUid(writer, mCallingUid);
|
||||||
|
writer.println();
|
||||||
|
writer.print(prefix); writer.print("mCallback=");
|
||||||
|
writer.println(mCallback.asBinder());
|
||||||
|
if (mExtras != null) {
|
||||||
|
writer.print(prefix); writer.print("mExtras=");
|
||||||
|
writer.println(mExtras);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -422,6 +454,12 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mPrompt=");
|
||||||
|
writer.println(mPrompt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -504,6 +542,34 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) {
|
VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) {
|
||||||
sendPickOptionResult(true, selections, result);
|
sendPickOptionResult(true, selections, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mPrompt=");
|
||||||
|
writer.println(mPrompt);
|
||||||
|
if (mOptions != null) {
|
||||||
|
writer.print(prefix); writer.println("Options:");
|
||||||
|
for (int i=0; i<mOptions.length; i++) {
|
||||||
|
VoiceInteractor.PickOptionRequest.Option op = mOptions[i];
|
||||||
|
writer.print(prefix); writer.print(" #"); writer.print(i); writer.println(":");
|
||||||
|
writer.print(prefix); writer.print(" mLabel=");
|
||||||
|
writer.println(op.getLabel());
|
||||||
|
writer.print(prefix); writer.print(" mIndex=");
|
||||||
|
writer.println(op.getIndex());
|
||||||
|
if (op.countSynonyms() > 0) {
|
||||||
|
writer.print(prefix); writer.println(" Synonyms:");
|
||||||
|
for (int j=0; j<op.countSynonyms(); j++) {
|
||||||
|
writer.print(prefix); writer.print(" #"); writer.print(j);
|
||||||
|
writer.print(": "); writer.println(op.getSynonymAt(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (op.getExtras() != null) {
|
||||||
|
writer.print(prefix); writer.print(" mExtras=");
|
||||||
|
writer.println(op.getExtras());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -557,6 +623,12 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mPrompt=");
|
||||||
|
writer.println(mPrompt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -607,6 +679,12 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mPrompt=");
|
||||||
|
writer.println(mPrompt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -661,6 +739,12 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
public void sendResult(Bundle result) {
|
public void sendResult(Bundle result) {
|
||||||
sendCommandResult(true, result);
|
sendCommandResult(true, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
super.dump(prefix, fd, writer, args);
|
||||||
|
writer.print(prefix); writer.print("mCommand=");
|
||||||
|
writer.println(mCommand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final int MSG_START_CONFIRMATION = 1;
|
static final int MSG_START_CONFIRMATION = 1;
|
||||||
@ -1446,4 +1530,37 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
*/
|
*/
|
||||||
public void onCancelRequest(Request request) {
|
public void onCancelRequest(Request request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the Service's state into the given stream. This gets invoked by
|
||||||
|
* {@link VoiceInteractionSessionService} when its Service
|
||||||
|
* {@link android.app.Service#dump} method is called.
|
||||||
|
*
|
||||||
|
* @param prefix Text to print at the front of each line.
|
||||||
|
* @param fd The raw file descriptor that the dump is being sent to.
|
||||||
|
* @param writer The PrintWriter to which you should dump your state. This will be
|
||||||
|
* closed for you after you return.
|
||||||
|
* @param args additional arguments to the dump request.
|
||||||
|
*/
|
||||||
|
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
writer.print(prefix); writer.print("mToken="); writer.println(mToken);
|
||||||
|
writer.print(prefix); writer.print("mTheme=#"); writer.println(Integer.toHexString(mTheme));
|
||||||
|
writer.print(prefix); writer.print("mInitialized="); writer.println(mInitialized);
|
||||||
|
writer.print(prefix); writer.print("mWindowAdded="); writer.print(mWindowAdded);
|
||||||
|
writer.print(" mWindowVisible="); writer.println(mWindowVisible);
|
||||||
|
writer.print(prefix); writer.print("mWindowWasVisible="); writer.print(mWindowWasVisible);
|
||||||
|
writer.print(" mInShowWindow="); writer.println(mInShowWindow);
|
||||||
|
if (mActiveRequests.size() > 0) {
|
||||||
|
writer.print(prefix); writer.println("Active requests:");
|
||||||
|
String innerPrefix = prefix + " ";
|
||||||
|
for (int i=0; i<mActiveRequests.size(); i++) {
|
||||||
|
Request req = mActiveRequests.valueAt(i);
|
||||||
|
writer.print(prefix); writer.print(" #"); writer.print(i);
|
||||||
|
writer.print(": ");
|
||||||
|
writer.println(req);
|
||||||
|
req.dump(innerPrefix, fd, writer, args);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,9 @@ import com.android.internal.app.IVoiceInteractionManagerService;
|
|||||||
import com.android.internal.os.HandlerCaller;
|
import com.android.internal.os.HandlerCaller;
|
||||||
import com.android.internal.os.SomeArgs;
|
import com.android.internal.os.SomeArgs;
|
||||||
|
|
||||||
|
import java.io.FileDescriptor;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An active voice interaction session, initiated by a {@link VoiceInteractionService}.
|
* An active voice interaction session, initiated by a {@link VoiceInteractionService}.
|
||||||
*/
|
*/
|
||||||
@ -101,6 +104,16 @@ public abstract class VoiceInteractionSessionService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
if (mSession == null) {
|
||||||
|
writer.println("(no active session)");
|
||||||
|
} else {
|
||||||
|
writer.println("VoiceInteractionSession:");
|
||||||
|
mSession.dump(" ", fd, writer, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void doNewSession(IBinder token, Bundle args, int startFlags) {
|
void doNewSession(IBinder token, Bundle args, int startFlags) {
|
||||||
if (mSession != null) {
|
if (mSession != null) {
|
||||||
mSession.doDestroy();
|
mSession.doDestroy();
|
||||||
|
@ -500,7 +500,7 @@ public class ResolverActivity extends Activity {
|
|||||||
mPackageMonitor.unregister();
|
mPackageMonitor.unregister();
|
||||||
mRegistered = false;
|
mRegistered = false;
|
||||||
}
|
}
|
||||||
if ((getIntent().getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
|
if ((getIntent().getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0 && !isVoiceInteraction()) {
|
||||||
// This resolver is in the unusual situation where it has been
|
// This resolver is in the unusual situation where it has been
|
||||||
// launched at the top of a new task. We don't let it be added
|
// launched at the top of a new task. We don't let it be added
|
||||||
// to the recent tasks shown to the user, and we need to make sure
|
// to the recent tasks shown to the user, and we need to make sure
|
||||||
@ -810,8 +810,13 @@ public class ResolverActivity extends Activity {
|
|||||||
|
|
||||||
void configureContentView(List<Intent> payloadIntents, Intent[] initialIntents,
|
void configureContentView(List<Intent> payloadIntents, Intent[] initialIntents,
|
||||||
List<ResolveInfo> rList, boolean alwaysUseOption) {
|
List<ResolveInfo> rList, boolean alwaysUseOption) {
|
||||||
|
// The last argument of createAdapter is whether to do special handling
|
||||||
|
// of the last used choice to highlight it in the list. We need to always
|
||||||
|
// turn this off when running under voice interaction, since it results in
|
||||||
|
// a more complicated UI that the current voice interaction flow is not able
|
||||||
|
// to handle.
|
||||||
mAdapter = createAdapter(this, payloadIntents, initialIntents, rList,
|
mAdapter = createAdapter(this, payloadIntents, initialIntents, rList,
|
||||||
mLaunchedFromUid, alwaysUseOption);
|
mLaunchedFromUid, alwaysUseOption && !isVoiceInteraction());
|
||||||
|
|
||||||
final int layoutId;
|
final int layoutId;
|
||||||
if (mAdapter.hasFilteredItem()) {
|
if (mAdapter.hasFilteredItem()) {
|
||||||
|
@ -65,7 +65,7 @@ final class DreamController {
|
|||||||
private final Intent mDreamingStoppedIntent = new Intent(Intent.ACTION_DREAMING_STOPPED)
|
private final Intent mDreamingStoppedIntent = new Intent(Intent.ACTION_DREAMING_STOPPED)
|
||||||
.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
|
.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
|
||||||
|
|
||||||
private final Intent mCloseNotificationShadeIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
private final Intent mCloseNotificationShadeIntent;
|
||||||
|
|
||||||
private DreamRecord mCurrentDream;
|
private DreamRecord mCurrentDream;
|
||||||
|
|
||||||
@ -92,6 +92,8 @@ final class DreamController {
|
|||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
mIWindowManager = WindowManagerGlobal.getWindowManagerService();
|
mIWindowManager = WindowManagerGlobal.getWindowManagerService();
|
||||||
|
mCloseNotificationShadeIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||||
|
mCloseNotificationShadeIntent.putExtra("reason", "dream");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dump(PrintWriter pw) {
|
public void dump(PrintWriter pw) {
|
||||||
|
@ -72,7 +72,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(intent.getAction())) {
|
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(intent.getAction())) {
|
||||||
String reason = intent.getStringExtra("reason");
|
String reason = intent.getStringExtra("reason");
|
||||||
if (!CLOSE_REASON_VOICE_INTERACTION.equals(reason)) {
|
if (!CLOSE_REASON_VOICE_INTERACTION.equals(reason) && !"dream".equals(reason)) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mActiveSession != null && mActiveSession.mSession != null) {
|
if (mActiveSession != null && mActiveSession.mSession != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -72,6 +72,7 @@ public class MainInteractionSession extends VoiceInteractionSession
|
|||||||
VoiceInteractor.PickOptionRequest.Option[] mPendingOptions;
|
VoiceInteractor.PickOptionRequest.Option[] mPendingOptions;
|
||||||
CharSequence mPendingPrompt;
|
CharSequence mPendingPrompt;
|
||||||
Request mPendingRequest;
|
Request mPendingRequest;
|
||||||
|
int mCurrentTask = -1;
|
||||||
|
|
||||||
MainInteractionSession(Context context) {
|
MainInteractionSession(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -313,6 +314,27 @@ public class MainInteractionSession extends VoiceInteractionSession
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTaskStarted(Intent intent, int taskId) {
|
||||||
|
super.onTaskStarted(intent, taskId);
|
||||||
|
mCurrentTask = taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTaskFinished(Intent intent, int taskId) {
|
||||||
|
super.onTaskFinished(intent, taskId);
|
||||||
|
if (mCurrentTask == taskId) {
|
||||||
|
mCurrentTask = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLockscreenShown() {
|
||||||
|
if (mCurrentTask < 0) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean[] onGetSupportedCommands(String[] commands) {
|
public boolean[] onGetSupportedCommands(String[] commands) {
|
||||||
boolean[] res = new boolean[commands.length];
|
boolean[] res = new boolean[commands.length];
|
||||||
|
Reference in New Issue
Block a user