Loading core/java/android/speech/RecognitionService.java +12 −2 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,8 @@ public abstract class RecognitionService extends Service { private static final int MSG_CANCEL = 3; private static final int MSG_CANCEL = 3; private static final int MSG_RESET = 4; private final Handler mHandler = new Handler() { private final Handler mHandler = new Handler() { @Override @Override public void handleMessage(Message msg) { public void handleMessage(Message msg) { Loading @@ -81,6 +83,10 @@ public abstract class RecognitionService extends Service { break; break; case MSG_CANCEL: case MSG_CANCEL: dispatchCancel((IRecognitionListener) msg.obj); dispatchCancel((IRecognitionListener) msg.obj); break; case MSG_RESET: dispatchClearCallback(); break; } } } } }; }; Loading Loading @@ -128,6 +134,10 @@ public abstract class RecognitionService extends Service { } } } } private void dispatchClearCallback() { mCurrentCallback = null; } private class StartListeningArgs { private class StartListeningArgs { public final Intent mIntent; public final Intent mIntent; Loading Loading @@ -241,7 +251,7 @@ public abstract class RecognitionService extends Service { * @param error code is defined in {@link SpeechRecognizer} * @param error code is defined in {@link SpeechRecognizer} */ */ public void error(int error) throws RemoteException { public void error(int error) throws RemoteException { mCurrentCallback = null; Message.obtain(mHandler, MSG_RESET).sendToTarget(); mListener.onError(error); mListener.onError(error); } } Loading Loading @@ -278,7 +288,7 @@ public abstract class RecognitionService extends Service { * {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter * {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter */ */ public void results(Bundle results) throws RemoteException { public void results(Bundle results) throws RemoteException { mCurrentCallback = null; Message.obtain(mHandler, MSG_RESET).sendToTarget(); mListener.onResults(results); mListener.onResults(results); } } Loading Loading
core/java/android/speech/RecognitionService.java +12 −2 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,8 @@ public abstract class RecognitionService extends Service { private static final int MSG_CANCEL = 3; private static final int MSG_CANCEL = 3; private static final int MSG_RESET = 4; private final Handler mHandler = new Handler() { private final Handler mHandler = new Handler() { @Override @Override public void handleMessage(Message msg) { public void handleMessage(Message msg) { Loading @@ -81,6 +83,10 @@ public abstract class RecognitionService extends Service { break; break; case MSG_CANCEL: case MSG_CANCEL: dispatchCancel((IRecognitionListener) msg.obj); dispatchCancel((IRecognitionListener) msg.obj); break; case MSG_RESET: dispatchClearCallback(); break; } } } } }; }; Loading Loading @@ -128,6 +134,10 @@ public abstract class RecognitionService extends Service { } } } } private void dispatchClearCallback() { mCurrentCallback = null; } private class StartListeningArgs { private class StartListeningArgs { public final Intent mIntent; public final Intent mIntent; Loading Loading @@ -241,7 +251,7 @@ public abstract class RecognitionService extends Service { * @param error code is defined in {@link SpeechRecognizer} * @param error code is defined in {@link SpeechRecognizer} */ */ public void error(int error) throws RemoteException { public void error(int error) throws RemoteException { mCurrentCallback = null; Message.obtain(mHandler, MSG_RESET).sendToTarget(); mListener.onError(error); mListener.onError(error); } } Loading Loading @@ -278,7 +288,7 @@ public abstract class RecognitionService extends Service { * {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter * {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter */ */ public void results(Bundle results) throws RemoteException { public void results(Bundle results) throws RemoteException { mCurrentCallback = null; Message.obtain(mHandler, MSG_RESET).sendToTarget(); mListener.onResults(results); mListener.onResults(results); } } Loading