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

Commit 629d03f1 authored by Charles Chen's avatar Charles Chen Committed by Android Git Automerger
Browse files

am a599dafe: Merge "Fix for bug 2548048 - it was impossible for applications...

am a599dafe: Merge "Fix for bug 2548048 - it was impossible for applications to discover if their TTS settings were being overridden by the user or not." into froyo

Merge commit 'a599dafe' into froyo-plus-aosp

* commit 'a599dafe':
  Fix for bug 2548048 - it was impossible for applications to discover
parents e7eb3a35 a599dafe
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -64,4 +64,6 @@ interface ITts {
    int setEngineByPackageName(in String enginePackageName);

    String getDefaultEngine();

    boolean areDefaultsEnforced();
}
+41 −0
Original line number Diff line number Diff line
@@ -1379,4 +1379,45 @@ public class TextToSpeech {
            }
        }
    }


    /**
     * Returns whether or not the user is forcing their defaults to override the
     * Text-To-Speech settings set by applications.
     *
     * @return Whether or not defaults are enforced.
     *
     * @hide
     */
    public boolean areDefaultsEnforced() {
        synchronized (mStartLock) {
            boolean defaultsEnforced = false;
            if (!mStarted) {
                return defaultsEnforced;
            }
            try {
                defaultsEnforced = mITts.areDefaultsEnforced();
            } catch (RemoteException e) {
                // TTS died; restart it.
                Log.e("TextToSpeech.java - areDefaultsEnforced", "RemoteException");
                e.printStackTrace();
                mStarted = false;
                initTts();
            } catch (NullPointerException e) {
                // TTS died; restart it.
                Log.e("TextToSpeech.java - areDefaultsEnforced", "NullPointerException");
                e.printStackTrace();
                mStarted = false;
                initTts();
            } catch (IllegalStateException e) {
                // TTS died; restart it.
                Log.e("TextToSpeech.java - areDefaultsEnforced", "IllegalStateException");
                e.printStackTrace();
                mStarted = false;
                initTts();
            } finally {
                return defaultsEnforced;
            }
        }
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -1445,6 +1445,16 @@ public class TtsService extends Service implements OnCompletionListener {
            return mSelf.getDefaultEngine();
        }

        /**
         * Returns whether or not the user is forcing their defaults to override the
         * Text-To-Speech settings set by applications.
         *
         * @return Whether or not defaults are enforced.
         */
        public boolean areDefaultsEnforced() {
            return mSelf.isDefaultEnforced();
        }

    };

}