diff options
author | Tom O'Neill <tomo@google.com> | 2013-08-27 18:23:18 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-27 18:23:18 +0000 |
commit | aeda265c4dcdd60484f9d1923e3fdcba761112e0 (patch) | |
tree | 6c1b24ea691ce159eb6bb5208ecfae210b368824 | |
parent | d220a830f4fb0e13e31d7632eb04f70fedd31e97 (diff) | |
parent | 7f6f45723adea684529dd9b7465d798f10c3acbf (diff) | |
download | frameworks_base-aeda265c4dcdd60484f9d1923e3fdcba761112e0.zip frameworks_base-aeda265c4dcdd60484f9d1923e3fdcba761112e0.tar.gz frameworks_base-aeda265c4dcdd60484f9d1923e3fdcba761112e0.tar.bz2 |
Merge "Remove or reduce visibility of deprecated methods" into klp-dev
-rw-r--r-- | api/current.txt | 5 | ||||
-rw-r--r-- | core/java/android/provider/Settings.java | 80 | ||||
-rw-r--r-- | location/java/android/location/SettingInjectorService.java | 21 |
3 files changed, 22 insertions, 84 deletions
diff --git a/api/current.txt b/api/current.txt index b51e8d3..3325dc6 100644 --- a/api/current.txt +++ b/api/current.txt @@ -11959,7 +11959,6 @@ package android.location { method protected abstract android.location.SettingInjectorService.Status getStatus(); method protected final void onHandleIntent(android.content.Intent); field public static final java.lang.String ACTION_INJECTED_SETTING_CHANGED = "com.android.location.InjectedSettingChanged"; - field public static final deprecated java.lang.String UPDATE_INTENT = "com.android.location.InjectedSettingChanged"; } public static final class SettingInjectorService.Status { @@ -21300,8 +21299,6 @@ package android.provider { method public static float getFloat(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; method public static int getInt(android.content.ContentResolver, java.lang.String, int); method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; - method public static final deprecated int getLocationMode(android.content.ContentResolver); - method public static final deprecated int getLocationModeForUser(android.content.ContentResolver, int); method public static long getLong(android.content.ContentResolver, java.lang.String, long); method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; method public static java.lang.String getString(android.content.ContentResolver, java.lang.String); @@ -21311,8 +21308,6 @@ package android.provider { method public static boolean putInt(android.content.ContentResolver, java.lang.String, int); method public static boolean putLong(android.content.ContentResolver, java.lang.String, long); method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String); - method public static final deprecated void setLocationMode(android.content.ContentResolver, int); - method public static final deprecated boolean setLocationModeForUser(android.content.ContentResolver, int, int); method public static final deprecated void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean); field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled"; field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 1d68241..24dbf0e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2895,6 +2895,11 @@ public final class Settings { /** @hide */ public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { + if (LOCATION_MODE.equals(name)) { + // HACK ALERT: temporary hack to work around b/10491283. + // TODO: once b/10491283 fixed, remove this hack + return getLocationModeForUser(cr, userHandle); + } String v = getStringForUser(cr, name, userHandle); try { return v != null ? Integer.parseInt(v) : def; @@ -2929,13 +2934,13 @@ public final class Settings { /** @hide */ public static int getIntForUser(ContentResolver cr, String name, int userHandle) throws SettingNotFoundException { + if (LOCATION_MODE.equals(name)) { + // HACK ALERT: temporary hack to work around b/10491283. + // TODO: once b/10491283 fixed, remove this hack + return getLocationModeForUser(cr, userHandle); + } String v = getStringForUser(cr, name, userHandle); try { - if (LOCATION_MODE.equals(name)) { - // HACK ALERT: temporary hack to work around b/10491283. - // TODO: once b/10491283 fixed, remove this hack - return getLocationModeForUser(cr, userHandle); - } return Integer.parseInt(v); } catch (NumberFormatException e) { throw new SettingNotFoundException(name); @@ -3282,15 +3287,18 @@ public final class Settings { public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; /** - * The degree of location access enabled by the user, for use with {@link - * #putInt(ContentResolver, String, int)} and {@link #getInt(ContentResolver, String)}. Must - * be one of {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, - * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. + * The degree of location access enabled by the user. + * <p/> + * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link + * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link + * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link + * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location + * modes that might be added in the future. */ public static final String LOCATION_MODE = "location_mode"; /** - * Location access disabled + * Location access disabled. */ public static final int LOCATION_MODE_OFF = 0; /** @@ -4420,20 +4428,15 @@ public final class Settings { * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. * - * TODO: remove callers, make private - * * @param cr the content resolver to use * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} * @param userId the userId for which to change mode * @return true if the value was set, false on database errors * * @throws IllegalArgumentException if mode is not one of the supported values - * - * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and - * {@link #LOCATION_MODE} */ - @Deprecated - public static final boolean setLocationModeForUser(ContentResolver cr, int mode, int userId) { + private static final boolean setLocationModeForUser(ContentResolver cr, int mode, + int userId) { synchronized (mLocationSettingsLock) { boolean gps = false; boolean network = false; @@ -4462,39 +4465,15 @@ public final class Settings { } /** - * Thread-safe method for setting the location mode to one of - * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, - * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. - * - * TODO: remove callers, delete - * - * @param cr the content resolver to use - * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} - * - * @throws IllegalArgumentException if mode is not one of the supported values - * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE} - */ - @Deprecated - public static final void setLocationMode(ContentResolver cr, int mode) { - setLocationModeForUser(cr, mode, UserHandle.myUserId()); - } - - /** * Thread-safe method for reading the location mode, returns one of * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. * - * TODO: remove callers, make private - * * @param cr the content resolver to use * @param userId the userId for which to read the mode * @return the location mode - * - * @deprecated use {@link #getIntForUser(ContentResolver, String, int, int)} and - * {@link #LOCATION_MODE} */ - @Deprecated - public static final int getLocationModeForUser(ContentResolver cr, int userId) { + private static final int getLocationModeForUser(ContentResolver cr, int userId) { synchronized (mLocationSettingsLock) { boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( cr, LocationManager.GPS_PROVIDER, userId); @@ -4511,23 +4490,6 @@ public final class Settings { } } } - - /** - * Thread-safe method for reading the location mode, returns one of - * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, - * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. - * - * TODO: remove callers, delete - * - * @param cr the content resolver to use - * @return the location mode - * - * @deprecated use {@link #getInt(ContentResolver, String, int)} and {@link #LOCATION_MODE} - */ - @Deprecated - public static final int getLocationMode(ContentResolver cr) { - return getLocationModeForUser(cr, UserHandle.myUserId()); - } } /** diff --git a/location/java/android/location/SettingInjectorService.java b/location/java/android/location/SettingInjectorService.java index 7e8137c..0b0f05d 100644 --- a/location/java/android/location/SettingInjectorService.java +++ b/location/java/android/location/SettingInjectorService.java @@ -102,16 +102,6 @@ public abstract class SettingInjectorService extends IntentService { public static final String SUMMARY_KEY = "summary"; /** - * TODO: delete after switching SettingsInjector to use {@link #SUMMARY_KEY}. - * - * @deprecated use {@link #SUMMARY_KEY} - * - * @hide - */ - @Deprecated - public static final String STATUS_KEY = "status"; - - /** * Name of the bundle key for the string specifying whether the setting is currently enabled. * * @hide @@ -132,14 +122,6 @@ public abstract class SettingInjectorService extends IntentService { public static final String ACTION_INJECTED_SETTING_CHANGED = "com.android.location.InjectedSettingChanged"; - /** - * TODO: delete after switching callers to use {@link #ACTION_INJECTED_SETTING_CHANGED}. - * - * @deprecated use {@link #ACTION_INJECTED_SETTING_CHANGED} - */ - @Deprecated - public static final String UPDATE_INTENT = ACTION_INJECTED_SETTING_CHANGED; - private final String mName; /** @@ -170,7 +152,6 @@ public abstract class SettingInjectorService extends IntentService { Message message = Message.obtain(); Bundle bundle = new Bundle(); if (status != null) { - bundle.putString(STATUS_KEY, status.summary); bundle.putString(SUMMARY_KEY, status.summary); bundle.putBoolean(ENABLED_KEY, status.enabled); } @@ -214,7 +195,7 @@ public abstract class SettingInjectorService extends IntentService { * choosing to hide a setting. Instead you should provide a {@code enabled} value of false, * which will gray the setting out and disable the link from "Settings > Location" * to your setting activity. One reason why you might choose to do this is if - * {@link android.provider.Settings.Secure#getLocationMode(android.content.ContentResolver)} + * {@link android.provider.Settings.Secure#LOCATION_MODE} * is {@link android.provider.Settings.Secure#LOCATION_MODE_OFF}. * * It is possible that the user may click on the setting before you return a false value for |