Merge "Fix issue #22124996: VI: Command Request not Active" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1cf8b0b6bf
@@ -650,7 +650,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
class MyCallbacks implements HandlerCaller.Callback, SoftInputWindow.Callback {
|
class MyCallbacks implements HandlerCaller.Callback, SoftInputWindow.Callback {
|
||||||
@Override
|
@Override
|
||||||
public void executeMessage(Message msg) {
|
public void executeMessage(Message msg) {
|
||||||
SomeArgs args;
|
SomeArgs args = null;
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case MSG_START_CONFIRMATION:
|
case MSG_START_CONFIRMATION:
|
||||||
if (DEBUG) Log.d(TAG, "onConfirm: req=" + msg.obj);
|
if (DEBUG) Log.d(TAG, "onConfirm: req=" + msg.obj);
|
||||||
@@ -676,6 +676,8 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
args = (SomeArgs)msg.obj;
|
args = (SomeArgs)msg.obj;
|
||||||
if (DEBUG) Log.d(TAG, "onGetSupportedCommands: cmds=" + args.arg1);
|
if (DEBUG) Log.d(TAG, "onGetSupportedCommands: cmds=" + args.arg1);
|
||||||
args.arg1 = onGetSupportedCommands((String[]) args.arg1);
|
args.arg1 = onGetSupportedCommands((String[]) args.arg1);
|
||||||
|
args.complete();
|
||||||
|
args = null;
|
||||||
break;
|
break;
|
||||||
case MSG_CANCEL:
|
case MSG_CANCEL:
|
||||||
if (DEBUG) Log.d(TAG, "onCancel: req=" + ((Request)msg.obj));
|
if (DEBUG) Log.d(TAG, "onCancel: req=" + ((Request)msg.obj));
|
||||||
@@ -723,6 +725,9 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall
|
|||||||
doHide();
|
doHide();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (args != null) {
|
||||||
|
args.recycle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -73,6 +73,16 @@ public final class SomeArgs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void complete() {
|
||||||
|
synchronized (this) {
|
||||||
|
if (mWaitState != WAIT_WAITING) {
|
||||||
|
throw new IllegalStateException("Not waiting");
|
||||||
|
}
|
||||||
|
mWaitState = WAIT_FINISHED;
|
||||||
|
notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void recycle() {
|
public void recycle() {
|
||||||
if (mInPool) {
|
if (mInPool) {
|
||||||
throw new IllegalStateException("Already recycled.");
|
throw new IllegalStateException("Already recycled.");
|
||||||
|
|||||||
@@ -103,6 +103,14 @@ public class TestInteractionActivity extends Activity implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
mInteractor.submitRequest(mCurrentRequest, REQUEST_CONFIRM);
|
mInteractor.submitRequest(mCurrentRequest, REQUEST_CONFIRM);
|
||||||
|
String[] cmds = new String[] {
|
||||||
|
"com.android.test.voiceinteraction.COMMAND",
|
||||||
|
"com.example.foo.bar"
|
||||||
|
};
|
||||||
|
boolean sup[] = mInteractor.supportsCommands(cmds);
|
||||||
|
for (int i=0; i<cmds.length; i++) {
|
||||||
|
mLog.append(cmds[i] + ": " + (sup[i] ? "SUPPORTED" : "NOT SUPPORTED") + "\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "Restarting with active confirmation: " + mCurrentRequest);
|
Log.i(TAG, "Restarting with active confirmation: " + mCurrentRequest);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user