am aeda265c: Merge "Remove or reduce visibility of deprecated methods" into klp-dev

* commit 'aeda265c4dcdd60484f9d1923e3fdcba761112e0':
  Remove or reduce visibility of deprecated methods
This commit is contained in:
Tom O'Neill
2013-08-27 11:28:22 -07:00
committed by Android Git Automerger
3 changed files with 22 additions and 84 deletions

View File

@@ -11959,7 +11959,6 @@ package android.location {
method protected abstract android.location.SettingInjectorService.Status getStatus(); method protected abstract android.location.SettingInjectorService.Status getStatus();
method protected final void onHandleIntent(android.content.Intent); 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 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 { 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 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, int);
method public static int getInt(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; 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, long);
method public static long getLong(android.content.ContentResolver, java.lang.String) throws android.provider.Settings.SettingNotFoundException; 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); 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 putInt(android.content.ContentResolver, java.lang.String, int);
method public static boolean putLong(android.content.ContentResolver, java.lang.String, long); 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 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); 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_ENABLED = "accessibility_enabled";
field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";

View File

@@ -2895,6 +2895,11 @@ public final class Settings {
/** @hide */ /** @hide */
public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { 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); String v = getStringForUser(cr, name, userHandle);
try { try {
return v != null ? Integer.parseInt(v) : def; return v != null ? Integer.parseInt(v) : def;
@@ -2929,13 +2934,13 @@ public final class Settings {
/** @hide */ /** @hide */
public static int getIntForUser(ContentResolver cr, String name, int userHandle) public static int getIntForUser(ContentResolver cr, String name, int userHandle)
throws SettingNotFoundException { 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); String v = getStringForUser(cr, name, userHandle);
try { 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); return Integer.parseInt(v);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new SettingNotFoundException(name); throw new SettingNotFoundException(name);
@@ -3282,15 +3287,18 @@ public final class Settings {
public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
/** /**
* The degree of location access enabled by the user, for use with {@link * The degree of location access enabled by the user.
* #putInt(ContentResolver, String, int)} and {@link #getInt(ContentResolver, String)}. Must * <p/>
* be one of {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link
* {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. * #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"; public static final String LOCATION_MODE = "location_mode";
/** /**
* Location access disabled * Location access disabled.
*/ */
public static final int LOCATION_MODE_OFF = 0; 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_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
* {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
* *
* TODO: remove callers, make private
*
* @param cr the content resolver to use * @param cr the content resolver to use
* @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
* @param userId the userId for which to change mode * @param userId the userId for which to change mode
* @return true if the value was set, false on database errors * @return true if the value was set, false on database errors
* *
* @throws IllegalArgumentException if mode is not one of the supported values * @throws IllegalArgumentException if mode is not one of the supported values
*
* @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and
* {@link #LOCATION_MODE}
*/ */
@Deprecated private static final boolean setLocationModeForUser(ContentResolver cr, int mode,
public static final boolean setLocationModeForUser(ContentResolver cr, int mode, int userId) { int userId) {
synchronized (mLocationSettingsLock) { synchronized (mLocationSettingsLock) {
boolean gps = false; boolean gps = false;
boolean network = false; boolean network = false;
@@ -4461,40 +4464,16 @@ 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 * Thread-safe method for reading the location mode, returns one of
* {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
* {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
* *
* TODO: remove callers, make private
*
* @param cr the content resolver to use * @param cr the content resolver to use
* @param userId the userId for which to read the mode * @param userId the userId for which to read the mode
* @return the location mode * @return the location mode
*
* @deprecated use {@link #getIntForUser(ContentResolver, String, int, int)} and
* {@link #LOCATION_MODE}
*/ */
@Deprecated private static final int getLocationModeForUser(ContentResolver cr, int userId) {
public static final int getLocationModeForUser(ContentResolver cr, int userId) {
synchronized (mLocationSettingsLock) { synchronized (mLocationSettingsLock) {
boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser(
cr, LocationManager.GPS_PROVIDER, userId); 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());
}
} }
/** /**

View File

@@ -101,16 +101,6 @@ public abstract class SettingInjectorService extends IntentService {
*/ */
public static final String SUMMARY_KEY = "summary"; 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. * Name of the bundle key for the string specifying whether the setting is currently enabled.
* *
@@ -132,14 +122,6 @@ public abstract class SettingInjectorService extends IntentService {
public static final String ACTION_INJECTED_SETTING_CHANGED = public static final String ACTION_INJECTED_SETTING_CHANGED =
"com.android.location.InjectedSettingChanged"; "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; private final String mName;
/** /**
@@ -170,7 +152,6 @@ public abstract class SettingInjectorService extends IntentService {
Message message = Message.obtain(); Message message = Message.obtain();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
if (status != null) { if (status != null) {
bundle.putString(STATUS_KEY, status.summary);
bundle.putString(SUMMARY_KEY, status.summary); bundle.putString(SUMMARY_KEY, status.summary);
bundle.putBoolean(ENABLED_KEY, status.enabled); 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, * 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" * 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 * 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}. * 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 * It is possible that the user may click on the setting before you return a false value for