Loading core/java/android/speech/tts/AudioMessageParams.java +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ class AudioMessageParams extends MessageParams { private final BlockingMediaPlayer mPlayer; AudioMessageParams(UtteranceProgressDispatcher dispatcher, String callingApp, BlockingMediaPlayer player) { super(dispatcher, callingApp); Object callerIdentity, BlockingMediaPlayer player) { super(dispatcher, callerIdentity); mPlayer = player; } Loading core/java/android/speech/tts/AudioPlaybackHandler.java +7 −7 Original line number Diff line number Diff line Loading @@ -110,19 +110,19 @@ class AudioPlaybackHandler { // synchronization). // ----------------------------------------------------- synchronized public void removePlaybackItems(String callingApp) { if (DBG_THREADING) Log.d(TAG, "Removing all callback items for : " + callingApp); removeMessages(callingApp); synchronized public void removePlaybackItems(Object callerIdentity) { if (DBG_THREADING) Log.d(TAG, "Removing all callback items for : " + callerIdentity); removeMessages(callerIdentity); final MessageParams current = getCurrentParams(); if (current != null && TextUtils.equals(callingApp, current.getCallingApp())) { if (current != null && (current.getCallerIdentity() == callerIdentity)) { stop(current); } final MessageParams lastSynthesis = mLastSynthesisRequest; if (lastSynthesis != null && lastSynthesis != current && TextUtils.equals(callingApp, lastSynthesis.getCallingApp())) { (lastSynthesis.getCallerIdentity() == callerIdentity)) { stop(lastSynthesis); } } Loading Loading @@ -232,7 +232,7 @@ class AudioPlaybackHandler { /* * Remove all messages that originate from a given calling app. */ synchronized private void removeMessages(String callingApp) { synchronized private void removeMessages(Object callerIdentity) { Iterator<ListEntry> it = mQueue.iterator(); while (it.hasNext()) { Loading @@ -240,7 +240,7 @@ class AudioPlaybackHandler { // The null check is to prevent us from removing control messages, // such as a shutdown message. if (current.mMessage != null && callingApp.equals(current.mMessage.getCallingApp())) { current.mMessage.getCallerIdentity() == callerIdentity) { it.remove(); } } Loading core/java/android/speech/tts/EventLogTags.logtags +2 −2 Original line number Diff line number Diff line Loading @@ -2,5 +2,5 @@ option java_package android.speech.tts; 76001 tts_speak_success (engine|3),(caller|3),(length|1),(locale|3),(rate|1),(pitch|1),(engine_latency|2|3),(engine_total|2|3),(audio_latency|2|3) 76002 tts_speak_failure (engine|3),(caller|3),(length|1),(locale|3),(rate|1),(pitch|1) 76001 tts_speak_success (engine|3),(caller_uid|1),(caller_pid|1),(length|1),(locale|3),(rate|1),(pitch|1),(engine_latency|2|3),(engine_total|2|3),(audio_latency|2|3) 76002 tts_speak_failure (engine|3),(caller_uid|1),(caller_pid|1),(length|1),(locale|3),(rate|1),(pitch|1) core/java/android/speech/tts/EventLogger.java +7 −6 Original line number Diff line number Diff line Loading @@ -30,8 +30,9 @@ import android.text.TextUtils; */ class EventLogger { private final SynthesisRequest mRequest; private final String mCallingApp; private final String mServiceApp; private final int mCallerUid; private final int mCallerPid; private final long mReceivedTime; private long mPlaybackStartTime = -1; private volatile long mRequestProcessingStartTime = -1; Loading @@ -42,10 +43,10 @@ class EventLogger { private volatile boolean mStopped = false; private boolean mLogWritten = false; EventLogger(SynthesisRequest request, String callingApp, String serviceApp) { EventLogger(SynthesisRequest request, int callerUid, int callerPid, String serviceApp) { mRequest = request; mCallingApp = callingApp; mCallerUid = callerUid; mCallerPid = callerPid; mServiceApp = serviceApp; mReceivedTime = SystemClock.elapsedRealtime(); } Loading Loading @@ -122,7 +123,7 @@ class EventLogger { // onPlaybackStart() should normally always be called if an // error does not occur. if (mError || mPlaybackStartTime == -1 || mEngineCompleteTime == -1) { EventLogTags.writeTtsSpeakFailure(mServiceApp, mCallingApp, EventLogTags.writeTtsSpeakFailure(mServiceApp, mCallerUid, mCallerPid, getUtteranceLength(), getLocaleString(), mRequest.getSpeechRate(), mRequest.getPitch()); return; Loading @@ -138,7 +139,7 @@ class EventLogger { final long audioLatency = mPlaybackStartTime - mReceivedTime; final long engineLatency = mEngineStartTime - mRequestProcessingStartTime; final long engineTotal = mEngineCompleteTime - mRequestProcessingStartTime; EventLogTags.writeTtsSpeakSuccess(mServiceApp, mCallingApp, EventLogTags.writeTtsSpeakSuccess(mServiceApp, mCallerUid, mCallerPid, getUtteranceLength(), getLocaleString(), mRequest.getSpeechRate(), mRequest.getPitch(), engineLatency, engineTotal, audioLatency); Loading core/java/android/speech/tts/ITextToSpeechService.aidl +16 −16 Original line number Diff line number Diff line Loading @@ -30,47 +30,47 @@ interface ITextToSpeechService { /** * Tells the engine to synthesize some speech and play it back. * * @param callingApp The package name of the calling app. Used to connect requests * callbacks and to clear requests when the calling app is stopping. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. * @param text The text to synthesize. * @param queueMode Determines what to do to requests already in the queue. * @param param Request parameters. */ int speak(in String callingApp, in String text, in int queueMode, in Bundle params); int speak(in IBinder callingInstance, in String text, in int queueMode, in Bundle params); /** * Tells the engine to synthesize some speech and write it to a file. * * @param callingApp The package name of the calling app. Used to connect requests * callbacks and to clear requests when the calling app is stopping. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. * @param text The text to synthesize. * @param filename The file to write the synthesized audio to. * @param param Request parameters. */ int synthesizeToFile(in String callingApp, in String text, int synthesizeToFile(in IBinder callingInstance, in String text, in String filename, in Bundle params); /** * Plays an existing audio resource. * * @param callingApp The package name of the calling app. Used to connect requests * callbacks and to clear requests when the calling app is stopping. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. * @param audioUri URI for the audio resource (a file or android.resource URI) * @param queueMode Determines what to do to requests already in the queue. * @param param Request parameters. */ int playAudio(in String callingApp, in Uri audioUri, in int queueMode, in Bundle params); int playAudio(in IBinder callingInstance, in Uri audioUri, in int queueMode, in Bundle params); /** * Plays silence. * * @param callingApp The package name of the calling app. Used to connect requests * callbacks and to clear requests when the calling app is stopping. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. * @param duration Number of milliseconds of silence to play. * @param queueMode Determines what to do to requests already in the queue. * @param param Request parameters. */ int playSilence(in String callingApp, in long duration, in int queueMode, in Bundle params); int playSilence(in IBinder callingInstance, in long duration, in int queueMode, in Bundle params); /** * Checks whether the service is currently playing some audio. Loading @@ -81,10 +81,10 @@ interface ITextToSpeechService { * Interrupts the current utterance (if from the given app) and removes any utterances * in the queue that are from the given app. * * @param callingApp Package name of the app whose utterances * should be interrupted and cleared. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. */ int stop(in String callingApp); int stop(in IBinder callingInstance); /** * Returns the language, country and variant currently being used by the TTS engine. Loading Loading @@ -150,6 +150,6 @@ interface ITextToSpeechService { * @param callingApp Package name for the app whose utterance the callback will handle. * @param cb The callback. */ void setCallback(in String callingApp, ITextToSpeechCallback cb); void setCallback(in IBinder caller, ITextToSpeechCallback cb); } Loading
core/java/android/speech/tts/AudioMessageParams.java +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ class AudioMessageParams extends MessageParams { private final BlockingMediaPlayer mPlayer; AudioMessageParams(UtteranceProgressDispatcher dispatcher, String callingApp, BlockingMediaPlayer player) { super(dispatcher, callingApp); Object callerIdentity, BlockingMediaPlayer player) { super(dispatcher, callerIdentity); mPlayer = player; } Loading
core/java/android/speech/tts/AudioPlaybackHandler.java +7 −7 Original line number Diff line number Diff line Loading @@ -110,19 +110,19 @@ class AudioPlaybackHandler { // synchronization). // ----------------------------------------------------- synchronized public void removePlaybackItems(String callingApp) { if (DBG_THREADING) Log.d(TAG, "Removing all callback items for : " + callingApp); removeMessages(callingApp); synchronized public void removePlaybackItems(Object callerIdentity) { if (DBG_THREADING) Log.d(TAG, "Removing all callback items for : " + callerIdentity); removeMessages(callerIdentity); final MessageParams current = getCurrentParams(); if (current != null && TextUtils.equals(callingApp, current.getCallingApp())) { if (current != null && (current.getCallerIdentity() == callerIdentity)) { stop(current); } final MessageParams lastSynthesis = mLastSynthesisRequest; if (lastSynthesis != null && lastSynthesis != current && TextUtils.equals(callingApp, lastSynthesis.getCallingApp())) { (lastSynthesis.getCallerIdentity() == callerIdentity)) { stop(lastSynthesis); } } Loading Loading @@ -232,7 +232,7 @@ class AudioPlaybackHandler { /* * Remove all messages that originate from a given calling app. */ synchronized private void removeMessages(String callingApp) { synchronized private void removeMessages(Object callerIdentity) { Iterator<ListEntry> it = mQueue.iterator(); while (it.hasNext()) { Loading @@ -240,7 +240,7 @@ class AudioPlaybackHandler { // The null check is to prevent us from removing control messages, // such as a shutdown message. if (current.mMessage != null && callingApp.equals(current.mMessage.getCallingApp())) { current.mMessage.getCallerIdentity() == callerIdentity) { it.remove(); } } Loading
core/java/android/speech/tts/EventLogTags.logtags +2 −2 Original line number Diff line number Diff line Loading @@ -2,5 +2,5 @@ option java_package android.speech.tts; 76001 tts_speak_success (engine|3),(caller|3),(length|1),(locale|3),(rate|1),(pitch|1),(engine_latency|2|3),(engine_total|2|3),(audio_latency|2|3) 76002 tts_speak_failure (engine|3),(caller|3),(length|1),(locale|3),(rate|1),(pitch|1) 76001 tts_speak_success (engine|3),(caller_uid|1),(caller_pid|1),(length|1),(locale|3),(rate|1),(pitch|1),(engine_latency|2|3),(engine_total|2|3),(audio_latency|2|3) 76002 tts_speak_failure (engine|3),(caller_uid|1),(caller_pid|1),(length|1),(locale|3),(rate|1),(pitch|1)
core/java/android/speech/tts/EventLogger.java +7 −6 Original line number Diff line number Diff line Loading @@ -30,8 +30,9 @@ import android.text.TextUtils; */ class EventLogger { private final SynthesisRequest mRequest; private final String mCallingApp; private final String mServiceApp; private final int mCallerUid; private final int mCallerPid; private final long mReceivedTime; private long mPlaybackStartTime = -1; private volatile long mRequestProcessingStartTime = -1; Loading @@ -42,10 +43,10 @@ class EventLogger { private volatile boolean mStopped = false; private boolean mLogWritten = false; EventLogger(SynthesisRequest request, String callingApp, String serviceApp) { EventLogger(SynthesisRequest request, int callerUid, int callerPid, String serviceApp) { mRequest = request; mCallingApp = callingApp; mCallerUid = callerUid; mCallerPid = callerPid; mServiceApp = serviceApp; mReceivedTime = SystemClock.elapsedRealtime(); } Loading Loading @@ -122,7 +123,7 @@ class EventLogger { // onPlaybackStart() should normally always be called if an // error does not occur. if (mError || mPlaybackStartTime == -1 || mEngineCompleteTime == -1) { EventLogTags.writeTtsSpeakFailure(mServiceApp, mCallingApp, EventLogTags.writeTtsSpeakFailure(mServiceApp, mCallerUid, mCallerPid, getUtteranceLength(), getLocaleString(), mRequest.getSpeechRate(), mRequest.getPitch()); return; Loading @@ -138,7 +139,7 @@ class EventLogger { final long audioLatency = mPlaybackStartTime - mReceivedTime; final long engineLatency = mEngineStartTime - mRequestProcessingStartTime; final long engineTotal = mEngineCompleteTime - mRequestProcessingStartTime; EventLogTags.writeTtsSpeakSuccess(mServiceApp, mCallingApp, EventLogTags.writeTtsSpeakSuccess(mServiceApp, mCallerUid, mCallerPid, getUtteranceLength(), getLocaleString(), mRequest.getSpeechRate(), mRequest.getPitch(), engineLatency, engineTotal, audioLatency); Loading
core/java/android/speech/tts/ITextToSpeechService.aidl +16 −16 Original line number Diff line number Diff line Loading @@ -30,47 +30,47 @@ interface ITextToSpeechService { /** * Tells the engine to synthesize some speech and play it back. * * @param callingApp The package name of the calling app. Used to connect requests * callbacks and to clear requests when the calling app is stopping. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. * @param text The text to synthesize. * @param queueMode Determines what to do to requests already in the queue. * @param param Request parameters. */ int speak(in String callingApp, in String text, in int queueMode, in Bundle params); int speak(in IBinder callingInstance, in String text, in int queueMode, in Bundle params); /** * Tells the engine to synthesize some speech and write it to a file. * * @param callingApp The package name of the calling app. Used to connect requests * callbacks and to clear requests when the calling app is stopping. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. * @param text The text to synthesize. * @param filename The file to write the synthesized audio to. * @param param Request parameters. */ int synthesizeToFile(in String callingApp, in String text, int synthesizeToFile(in IBinder callingInstance, in String text, in String filename, in Bundle params); /** * Plays an existing audio resource. * * @param callingApp The package name of the calling app. Used to connect requests * callbacks and to clear requests when the calling app is stopping. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. * @param audioUri URI for the audio resource (a file or android.resource URI) * @param queueMode Determines what to do to requests already in the queue. * @param param Request parameters. */ int playAudio(in String callingApp, in Uri audioUri, in int queueMode, in Bundle params); int playAudio(in IBinder callingInstance, in Uri audioUri, in int queueMode, in Bundle params); /** * Plays silence. * * @param callingApp The package name of the calling app. Used to connect requests * callbacks and to clear requests when the calling app is stopping. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. * @param duration Number of milliseconds of silence to play. * @param queueMode Determines what to do to requests already in the queue. * @param param Request parameters. */ int playSilence(in String callingApp, in long duration, in int queueMode, in Bundle params); int playSilence(in IBinder callingInstance, in long duration, in int queueMode, in Bundle params); /** * Checks whether the service is currently playing some audio. Loading @@ -81,10 +81,10 @@ interface ITextToSpeechService { * Interrupts the current utterance (if from the given app) and removes any utterances * in the queue that are from the given app. * * @param callingApp Package name of the app whose utterances * should be interrupted and cleared. * @param callingInstance a binder representing the identity of the calling * TextToSpeech object. */ int stop(in String callingApp); int stop(in IBinder callingInstance); /** * Returns the language, country and variant currently being used by the TTS engine. Loading Loading @@ -150,6 +150,6 @@ interface ITextToSpeechService { * @param callingApp Package name for the app whose utterance the callback will handle. * @param cb The callback. */ void setCallback(in String callingApp, ITextToSpeechCallback cb); void setCallback(in IBinder caller, ITextToSpeechCallback cb); }