Merge "Add @UnsupportedAppUsage annotations"

This commit is contained in:
Mathew Inwood
2018-08-09 11:40:30 +00:00
committed by Gerrit Code Review
3 changed files with 13 additions and 11 deletions

View File

@@ -4415,17 +4415,6 @@ Landroid/service/wallpaper/WallpaperService$Engine;->mPendingXOffset:F
Landroid/service/wallpaper/WallpaperService$Engine;->setFixedSizeAllowed(Z)V
Landroid/service/wallpaper/WallpaperService;->MSG_WINDOW_RESIZED:I
Landroid/speech/IRecognitionListener;->onEvent(ILandroid/os/Bundle;)V
Landroid/speech/tts/TextToSpeech;->getCurrentEngine()Ljava/lang/String;
Landroid/speech/tts/TextToSpeech;->mConnectingServiceConnection:Landroid/speech/tts/TextToSpeech$Connection;
Landroid/speech/tts/TextToSpeech;->mCurrentEngine:Ljava/lang/String;
Landroid/speech/tts/TextToSpeech;->mInitListener:Landroid/speech/tts/TextToSpeech$OnInitListener;
Landroid/speech/tts/TtsEngines;-><init>(Landroid/content/Context;)V
Landroid/speech/tts/TtsEngines;->getEngines()Ljava/util/List;
Landroid/speech/tts/TtsEngines;->getLocalePrefForEngine(Ljava/lang/String;)Ljava/util/Locale;
Landroid/speech/tts/TtsEngines;->getSettingsIntent(Ljava/lang/String;)Landroid/content/Intent;
Landroid/speech/tts/TtsEngines;->normalizeTTSLocale(Ljava/util/Locale;)Ljava/util/Locale;
Landroid/speech/tts/TtsEngines;->parseLocaleString(Ljava/lang/String;)Ljava/util/Locale;
Landroid/speech/tts/TtsEngines;->updateLocalePrefForEngine(Ljava/lang/String;Ljava/util/Locale;)V
Landroid/system/Int32Ref;->value:I
Landroid/system/OsConstants;-><init>()V
Landroid/system/OsConstants;->AF_NETLINK:I

View File

@@ -20,6 +20,7 @@ import android.annotation.Nullable;
import android.annotation.RawRes;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -668,8 +669,10 @@ public class TextToSpeech {
}
private final Context mContext;
@UnsupportedAppUsage
private Connection mConnectingServiceConnection;
private Connection mServiceConnection;
@UnsupportedAppUsage
private OnInitListener mInitListener;
// Written from an unspecified application thread, read from
// a binder thread.
@@ -686,6 +689,7 @@ public class TextToSpeech {
private final Map<CharSequence, Uri> mUtterances;
private final Bundle mParams = new Bundle();
private final TtsEngines mEnginesHelper;
@UnsupportedAppUsage
private volatile String mCurrentEngine = null;
/**
@@ -1425,6 +1429,7 @@ public class TextToSpeech {
* @return the engine currently in use by this TextToSpeech instance.
* @hide
*/
@UnsupportedAppUsage
public String getCurrentEngine() {
return mCurrentEngine;
}

View File

@@ -30,6 +30,7 @@ import android.content.res.XmlResourceParser;
import static android.provider.Settings.Secure.getString;
import android.annotation.UnsupportedAppUsage;
import android.provider.Settings;
import android.speech.tts.TextToSpeech.Engine;
import android.speech.tts.TextToSpeech.EngineInfo;
@@ -101,6 +102,7 @@ public class TtsEngines {
sNormalizeCountry = Collections.unmodifiableMap(normalizeCountry);
}
@UnsupportedAppUsage
public TtsEngines(Context ctx) {
mContext = ctx;
}
@@ -155,6 +157,7 @@ public class TtsEngines {
*
* @return A list of engine info objects. The list can be empty, but never {@code null}.
*/
@UnsupportedAppUsage
public List<EngineInfo> getEngines() {
PackageManager pm = mContext.getPackageManager();
Intent intent = new Intent(Engine.INTENT_ACTION_TTS_SERVICE);
@@ -194,6 +197,7 @@ public class TtsEngines {
/**
* @return an intent that can launch the settings activity for a given tts engine.
*/
@UnsupportedAppUsage
public Intent getSettingsIntent(String engine) {
PackageManager pm = mContext.getPackageManager();
Intent intent = new Intent(Engine.INTENT_ACTION_TTS_SERVICE);
@@ -327,6 +331,7 @@ public class TtsEngines {
* @param engineName the engine to return the locale for.
* @return the locale preference for this engine. Will be non null.
*/
@UnsupportedAppUsage
public Locale getLocalePrefForEngine(String engineName) {
return getLocalePrefForEngine(engineName,
getString(mContext.getContentResolver(), Settings.Secure.TTS_DEFAULT_LOCALE));
@@ -376,6 +381,7 @@ public class TtsEngines {
* country codes ({@link Locale#getISO3Language()} and {@link Locale#getISO3Country()}),
* if it fails to do so, we return null.
*/
@UnsupportedAppUsage
public Locale parseLocaleString(String localeString) {
String language = "", country = "", variant = "";
if (!TextUtils.isEmpty(localeString)) {
@@ -436,6 +442,7 @@ public class TtsEngines {
* This method tries to convert three-letter language and country codes into their two-letter
* equivalents. If it fails to do so, it keeps the value from the TTS locale.
*/
@UnsupportedAppUsage
public static Locale normalizeTTSLocale(Locale ttsLocale) {
String language = ttsLocale.getLanguage();
if (!TextUtils.isEmpty(language)) {
@@ -514,6 +521,7 @@ public class TtsEngines {
* the passed locale is null, an empty string will be serialized; that empty string, when
* read back, will evaluate to {@link Locale#getDefault()}.
*/
@UnsupportedAppUsage
public synchronized void updateLocalePrefForEngine(String engineName, Locale newLocale) {
final String prefList = Settings.Secure.getString(mContext.getContentResolver(),
Settings.Secure.TTS_DEFAULT_LOCALE);