summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom O'Neill <tomo@google.com>2013-08-27 10:53:15 -0700
committerTom O'Neill <tomo@google.com>2013-08-27 10:53:15 -0700
commit7f6f45723adea684529dd9b7465d798f10c3acbf (patch)
tree09f8e28dfb2fff373306c9ba1f509151269df6c3
parent4a9c7fec662315d9da48f0f5f99313f270424b48 (diff)
downloadframeworks_base-7f6f45723adea684529dd9b7465d798f10c3acbf.zip
frameworks_base-7f6f45723adea684529dd9b7465d798f10c3acbf.tar.gz
frameworks_base-7f6f45723adea684529dd9b7465d798f10c3acbf.tar.bz2
Remove or reduce visibility of deprecated methods
- Fix additional getInt() path, restores the location settings screen functionality. - Should fix "unresolved link" build breakages in git_klp-dev-plus-aosp-without-vendor, which is much more persnickety than klp-dev for some reason. - Add warning that we may add additional location modes in the future. - Finish fix for b/10461763 and b/10461474 Change-Id: Id7155e3a0d7526a377d446018ef3bdb057bad3a6
-rw-r--r--api/current.txt5
-rw-r--r--core/java/android/provider/Settings.java80
-rw-r--r--location/java/android/location/SettingInjectorService.java21
3 files changed, 22 insertions, 84 deletions
diff --git a/api/current.txt b/api/current.txt
index 5b63983..d5fae2a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -11958,7 +11958,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 {
@@ -21299,8 +21298,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);
@@ -21310,8 +21307,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