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 'a599dafe4ffc3e6cc4953a7e3d33f4da80aabf45' into froyo-plus-aosp

* commit 'a599dafe4ffc3e6cc4953a7e3d33f4da80aabf45':
  Fix for bug 2548048 - it was impossible for applications to discover
This commit is contained in:
Charles Chen
2010-03-29 18:41:48 -07:00
committed by Android Git Automerger
3 changed files with 54 additions and 1 deletions

View File

@@ -63,5 +63,7 @@ interface ITts {
int setEngineByPackageName(in String enginePackageName);
String getDefaultEngine();
String getDefaultEngine();
boolean areDefaultsEnforced();
}

View File

@@ -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;
}
}
}
}