Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90e5650f authored by Narayan Kamath's avatar Narayan Kamath
Browse files

Few minor TTS clean ups.

(a) Remove unnecessary null check.
(b) Remove unused function.
(c) Clean up for TextToSpeech#shutdown.

Change-Id: I3ec5bccc327437064da130634a14aaf7d48eca4d
parent be4ad4ac
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -94,14 +94,12 @@ class AudioPlaybackHandler {
            //
            // (Even if it did, all it would result in is a warning message).
            mQueue.add(new ListEntry(SYNTHESIS_DONE, token, HIGH_PRIORITY));
        } else  {
            if (token != null) {
                if (token.getType() == MessageParams.TYPE_AUDIO) {
        } else if (token.getType() == MessageParams.TYPE_AUDIO) {
            ((AudioMessageParams) token).getPlayer().stop();
            // No cleanup required for audio messages.
        } else if (token.getType() == MessageParams.TYPE_SILENCE) {
            ((SilenceMessageParams) token).getConditionVariable().open();
                }
            }
            // No cleanup required for silence messages.
        }
    }

+8 −0
Original line number Diff line number Diff line
@@ -581,6 +581,14 @@ public class TextToSpeech {
                service.setCallback(getPackageName(), null);
                service.stop(getPackageName());
                mServiceConnection.disconnect();
                // Context#unbindService does not result in a call to
                // ServiceConnection#onServiceDisconnected. As a result, the
                // service ends up being destroyed (if there are no other open
                // connections to it) but the process lives on and the
                // ServiceConnection continues to refer to the destroyed service.
                //
                // This leads to tons of log spam about SynthThread being dead.
                mServiceConnection = null;
                mCurrentEngine = null;
                return null;
            }
+0 −4
Original line number Diff line number Diff line
@@ -767,10 +767,6 @@ public abstract class TextToSpeechService extends Service {
            mCallbacks.setCallback(packageName, cb);
        }

        private boolean isDefault(String lang, String country, String variant) {
            return Locale.getDefault().equals(new Locale(lang, country, variant));
        }

        private String intern(String in) {
            // The input parameter will be non null.
            return in.intern();