Loading api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -29028,6 +29028,7 @@ package android.speech { method public void bufferReceived(byte[]) throws android.os.RemoteException; method public void bufferReceived(byte[]) throws android.os.RemoteException; method public void endOfSpeech() throws android.os.RemoteException; method public void endOfSpeech() throws android.os.RemoteException; method public void error(int) throws android.os.RemoteException; method public void error(int) throws android.os.RemoteException; method public int getCallingUid(); method public void partialResults(android.os.Bundle) throws android.os.RemoteException; method public void partialResults(android.os.Bundle) throws android.os.RemoteException; method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; method public void results(android.os.Bundle) throws android.os.RemoteException; method public void results(android.os.Bundle) throws android.os.RemoteException; api/system-current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -31154,6 +31154,7 @@ package android.speech { method public void bufferReceived(byte[]) throws android.os.RemoteException; method public void bufferReceived(byte[]) throws android.os.RemoteException; method public void endOfSpeech() throws android.os.RemoteException; method public void endOfSpeech() throws android.os.RemoteException; method public void error(int) throws android.os.RemoteException; method public void error(int) throws android.os.RemoteException; method public int getCallingUid(); method public void partialResults(android.os.Bundle) throws android.os.RemoteException; method public void partialResults(android.os.Bundle) throws android.os.RemoteException; method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; method public void results(android.os.Bundle) throws android.os.RemoteException; method public void results(android.os.Bundle) throws android.os.RemoteException; core/java/android/speech/RecognitionService.java +20 −6 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.SdkConstant.SdkConstantType; import android.app.Service; import android.app.Service; import android.content.Intent; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Bundle; import android.os.Bundle; import android.os.Handler; import android.os.Handler; import android.os.IBinder; import android.os.IBinder; Loading Loading @@ -78,7 +79,7 @@ public abstract class RecognitionService extends Service { switch (msg.what) { switch (msg.what) { case MSG_START_LISTENING: case MSG_START_LISTENING: StartListeningArgs args = (StartListeningArgs) msg.obj; StartListeningArgs args = (StartListeningArgs) msg.obj; dispatchStartListening(args.mIntent, args.mListener); dispatchStartListening(args.mIntent, args.mListener, args.mCallingUid); break; break; case MSG_STOP_LISTENING: case MSG_STOP_LISTENING: dispatchStopListening((IRecognitionListener) msg.obj); dispatchStopListening((IRecognitionListener) msg.obj); Loading @@ -93,7 +94,8 @@ public abstract class RecognitionService extends Service { } } }; }; private void dispatchStartListening(Intent intent, final IRecognitionListener listener) { private void dispatchStartListening(Intent intent, final IRecognitionListener listener, int callingUid) { if (mCurrentCallback == null) { if (mCurrentCallback == null) { if (DBG) Log.d(TAG, "created new mCurrentCallback, listener = " + listener.asBinder()); if (DBG) Log.d(TAG, "created new mCurrentCallback, listener = " + listener.asBinder()); try { try { Loading @@ -107,7 +109,7 @@ public abstract class RecognitionService extends Service { Log.e(TAG, "dead listener on startListening"); Log.e(TAG, "dead listener on startListening"); return; return; } } mCurrentCallback = new Callback(listener); mCurrentCallback = new Callback(listener, callingUid); RecognitionService.this.onStartListening(intent, mCurrentCallback); RecognitionService.this.onStartListening(intent, mCurrentCallback); } else { } else { try { try { Loading Loading @@ -155,10 +157,12 @@ public abstract class RecognitionService extends Service { public final Intent mIntent; public final Intent mIntent; public final IRecognitionListener mListener; public final IRecognitionListener mListener; public final int mCallingUid; public StartListeningArgs(Intent intent, IRecognitionListener listener) { public StartListeningArgs(Intent intent, IRecognitionListener listener, int callingUid) { this.mIntent = intent; this.mIntent = intent; this.mListener = listener; this.mListener = listener; this.mCallingUid = callingUid; } } } } Loading Loading @@ -227,9 +231,11 @@ public abstract class RecognitionService extends Service { */ */ public class Callback { public class Callback { private final IRecognitionListener mListener; private final IRecognitionListener mListener; private final int mCallingUid; private Callback(IRecognitionListener listener) { private Callback(IRecognitionListener listener, int callingUid) { mListener = listener; mListener = listener; mCallingUid = callingUid; } } /** /** Loading Loading @@ -314,6 +320,14 @@ public abstract class RecognitionService extends Service { public void rmsChanged(float rmsdB) throws RemoteException { public void rmsChanged(float rmsdB) throws RemoteException { mListener.onRmsChanged(rmsdB); mListener.onRmsChanged(rmsdB); } } /** * Return the Linux uid assigned to the process that sent you the current transaction that * is being processed. This is obtained from {@link Binder#getCallingUid()}. */ public int getCallingUid() { return mCallingUid; } } } /** Binder of the recognition service */ /** Binder of the recognition service */ Loading @@ -331,7 +345,7 @@ public abstract class RecognitionService extends Service { if (service != null && service.checkPermissions(listener)) { if (service != null && service.checkPermissions(listener)) { service.mHandler.sendMessage(Message.obtain(service.mHandler, service.mHandler.sendMessage(Message.obtain(service.mHandler, MSG_START_LISTENING, service.new StartListeningArgs( MSG_START_LISTENING, service.new StartListeningArgs( recognizerIntent, listener))); recognizerIntent, listener, Binder.getCallingUid()))); } } } } Loading Loading
api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -29028,6 +29028,7 @@ package android.speech { method public void bufferReceived(byte[]) throws android.os.RemoteException; method public void bufferReceived(byte[]) throws android.os.RemoteException; method public void endOfSpeech() throws android.os.RemoteException; method public void endOfSpeech() throws android.os.RemoteException; method public void error(int) throws android.os.RemoteException; method public void error(int) throws android.os.RemoteException; method public int getCallingUid(); method public void partialResults(android.os.Bundle) throws android.os.RemoteException; method public void partialResults(android.os.Bundle) throws android.os.RemoteException; method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; method public void results(android.os.Bundle) throws android.os.RemoteException; method public void results(android.os.Bundle) throws android.os.RemoteException;
api/system-current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -31154,6 +31154,7 @@ package android.speech { method public void bufferReceived(byte[]) throws android.os.RemoteException; method public void bufferReceived(byte[]) throws android.os.RemoteException; method public void endOfSpeech() throws android.os.RemoteException; method public void endOfSpeech() throws android.os.RemoteException; method public void error(int) throws android.os.RemoteException; method public void error(int) throws android.os.RemoteException; method public int getCallingUid(); method public void partialResults(android.os.Bundle) throws android.os.RemoteException; method public void partialResults(android.os.Bundle) throws android.os.RemoteException; method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException; method public void results(android.os.Bundle) throws android.os.RemoteException; method public void results(android.os.Bundle) throws android.os.RemoteException;
core/java/android/speech/RecognitionService.java +20 −6 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.SdkConstant.SdkConstantType; import android.app.Service; import android.app.Service; import android.content.Intent; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Bundle; import android.os.Bundle; import android.os.Handler; import android.os.Handler; import android.os.IBinder; import android.os.IBinder; Loading Loading @@ -78,7 +79,7 @@ public abstract class RecognitionService extends Service { switch (msg.what) { switch (msg.what) { case MSG_START_LISTENING: case MSG_START_LISTENING: StartListeningArgs args = (StartListeningArgs) msg.obj; StartListeningArgs args = (StartListeningArgs) msg.obj; dispatchStartListening(args.mIntent, args.mListener); dispatchStartListening(args.mIntent, args.mListener, args.mCallingUid); break; break; case MSG_STOP_LISTENING: case MSG_STOP_LISTENING: dispatchStopListening((IRecognitionListener) msg.obj); dispatchStopListening((IRecognitionListener) msg.obj); Loading @@ -93,7 +94,8 @@ public abstract class RecognitionService extends Service { } } }; }; private void dispatchStartListening(Intent intent, final IRecognitionListener listener) { private void dispatchStartListening(Intent intent, final IRecognitionListener listener, int callingUid) { if (mCurrentCallback == null) { if (mCurrentCallback == null) { if (DBG) Log.d(TAG, "created new mCurrentCallback, listener = " + listener.asBinder()); if (DBG) Log.d(TAG, "created new mCurrentCallback, listener = " + listener.asBinder()); try { try { Loading @@ -107,7 +109,7 @@ public abstract class RecognitionService extends Service { Log.e(TAG, "dead listener on startListening"); Log.e(TAG, "dead listener on startListening"); return; return; } } mCurrentCallback = new Callback(listener); mCurrentCallback = new Callback(listener, callingUid); RecognitionService.this.onStartListening(intent, mCurrentCallback); RecognitionService.this.onStartListening(intent, mCurrentCallback); } else { } else { try { try { Loading Loading @@ -155,10 +157,12 @@ public abstract class RecognitionService extends Service { public final Intent mIntent; public final Intent mIntent; public final IRecognitionListener mListener; public final IRecognitionListener mListener; public final int mCallingUid; public StartListeningArgs(Intent intent, IRecognitionListener listener) { public StartListeningArgs(Intent intent, IRecognitionListener listener, int callingUid) { this.mIntent = intent; this.mIntent = intent; this.mListener = listener; this.mListener = listener; this.mCallingUid = callingUid; } } } } Loading Loading @@ -227,9 +231,11 @@ public abstract class RecognitionService extends Service { */ */ public class Callback { public class Callback { private final IRecognitionListener mListener; private final IRecognitionListener mListener; private final int mCallingUid; private Callback(IRecognitionListener listener) { private Callback(IRecognitionListener listener, int callingUid) { mListener = listener; mListener = listener; mCallingUid = callingUid; } } /** /** Loading Loading @@ -314,6 +320,14 @@ public abstract class RecognitionService extends Service { public void rmsChanged(float rmsdB) throws RemoteException { public void rmsChanged(float rmsdB) throws RemoteException { mListener.onRmsChanged(rmsdB); mListener.onRmsChanged(rmsdB); } } /** * Return the Linux uid assigned to the process that sent you the current transaction that * is being processed. This is obtained from {@link Binder#getCallingUid()}. */ public int getCallingUid() { return mCallingUid; } } } /** Binder of the recognition service */ /** Binder of the recognition service */ Loading @@ -331,7 +345,7 @@ public abstract class RecognitionService extends Service { if (service != null && service.checkPermissions(listener)) { if (service != null && service.checkPermissions(listener)) { service.mHandler.sendMessage(Message.obtain(service.mHandler, service.mHandler.sendMessage(Message.obtain(service.mHandler, MSG_START_LISTENING, service.new StartListeningArgs( MSG_START_LISTENING, service.new StartListeningArgs( recognizerIntent, listener))); recognizerIntent, listener, Binder.getCallingUid()))); } } } } Loading