diff options
| -rw-r--r-- | core/java/android/speech/tts/FileSynthesisCallback.java | 22 | ||||
| -rw-r--r-- | core/java/android/speech/tts/TextToSpeechService.java | 3 |
2 files changed, 8 insertions, 17 deletions
diff --git a/core/java/android/speech/tts/FileSynthesisCallback.java b/core/java/android/speech/tts/FileSynthesisCallback.java index 2b882d3154a6..c7a4ccc183e8 100644 --- a/core/java/android/speech/tts/FileSynthesisCallback.java +++ b/core/java/android/speech/tts/FileSynthesisCallback.java @@ -15,6 +15,7 @@ */ package android.speech.tts; +import android.annotation.NonNull; import android.media.AudioFormat; import android.speech.tts.TextToSpeechService.UtteranceProgressDispatcher; import android.util.Log; @@ -46,7 +47,6 @@ class FileSynthesisCallback extends AbstractSynthesisCallback { private FileChannel mFileChannel; private final UtteranceProgressDispatcher mDispatcher; - private final Object mCallerIdentity; private boolean mStarted = false; private boolean mDone = false; @@ -54,12 +54,11 @@ class FileSynthesisCallback extends AbstractSynthesisCallback { /** Status code of synthesis */ protected int mStatusCode; - FileSynthesisCallback(FileChannel fileChannel, UtteranceProgressDispatcher dispatcher, - Object callerIdentity, boolean clientIsUsingV2) { + FileSynthesisCallback(@NonNull FileChannel fileChannel, + @NonNull UtteranceProgressDispatcher dispatcher, boolean clientIsUsingV2) { super(clientIsUsingV2); mFileChannel = fileChannel; mDispatcher = dispatcher; - mCallerIdentity = callerIdentity; mStatusCode = TextToSpeech.SUCCESS; } @@ -75,9 +74,7 @@ class FileSynthesisCallback extends AbstractSynthesisCallback { mStatusCode = TextToSpeech.STOPPED; cleanUp(); - if (mDispatcher != null) { - mDispatcher.dispatchOnStop(); - } + mDispatcher.dispatchOnStop(); } } @@ -134,9 +131,7 @@ class FileSynthesisCallback extends AbstractSynthesisCallback { mAudioFormat = audioFormat; mChannelCount = channelCount; - if (mDispatcher != null) { - mDispatcher.dispatchOnStart(); - } + mDispatcher.dispatchOnStart(); fileChannel = mFileChannel; } @@ -214,8 +209,7 @@ class FileSynthesisCallback extends AbstractSynthesisCallback { if (DBG) Log.d(TAG, "Request has been aborted."); return errorCodeOnStop(); } - if (mDispatcher != null && mStatusCode != TextToSpeech.SUCCESS && - mStatusCode != TextToSpeech.STOPPED) { + if (mStatusCode != TextToSpeech.SUCCESS && mStatusCode != TextToSpeech.STOPPED) { mDispatcher.dispatchOnError(mStatusCode); return TextToSpeech.ERROR; } @@ -239,9 +233,7 @@ class FileSynthesisCallback extends AbstractSynthesisCallback { synchronized (mStateLock) { closeFile(); - if (mDispatcher != null) { - mDispatcher.dispatchOnSuccess(); - } + mDispatcher.dispatchOnSuccess(); return TextToSpeech.SUCCESS; } } catch (IOException ex) { diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java index c3aed753efbd..8c355d8d63de 100644 --- a/core/java/android/speech/tts/TextToSpeechService.java +++ b/core/java/android/speech/tts/TextToSpeechService.java @@ -1032,8 +1032,7 @@ public abstract class TextToSpeechService extends Service { @Override protected AbstractSynthesisCallback createSynthesisCallback() { - return new FileSynthesisCallback(mFileOutputStream.getChannel(), - this, getCallerIdentity(), false); + return new FileSynthesisCallback(mFileOutputStream.getChannel(), this, false); } @Override |