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:
@@ -63,5 +63,7 @@ interface ITts {
|
||||
|
||||
int setEngineByPackageName(in String enginePackageName);
|
||||
|
||||
String getDefaultEngine();
|
||||
String getDefaultEngine();
|
||||
|
||||
boolean areDefaultsEnforced();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user