Resign ourselves to using legacy storage of location setting
- Too many apps assume the storage is based on the legacy storage
mechanism, it's not worth changing.
- Bug: 10491283
Change-Id: I287b1c70c30e74f3f1140b6ee3398900ebf305bb
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 14be2aa..729c4a6 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4291,8 +4291,7 @@
public static boolean putStringForUser(ContentResolver resolver, String name, String value,
int userHandle) {
if (LOCATION_MODE.equals(name)) {
- // HACK ALERT: temporary hack to work around b/10491283.
- // TODO: once b/10491283 fixed, remove this hack
+ // Map LOCATION_MODE to underlying location provider storage API
return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle);
}
if (MOVED_TO_GLOBAL.contains(name)) {
@@ -4339,8 +4338,7 @@
/** @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
+ // Map from to underlying location provider storage API to location mode
return getLocationModeForUser(cr, userHandle);
}
String v = getStringForUser(cr, name, userHandle);
@@ -4378,8 +4376,7 @@
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
+ // Map from to underlying location provider storage API to location mode
return getLocationModeForUser(cr, userHandle);
}
String v = getStringForUser(cr, name, userHandle);
@@ -6546,6 +6543,8 @@
* 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}.
+ * Necessary because the mode is a composite of the underlying location provider
+ * settings.
*
* @param cr the content resolver to use
* @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
@@ -6599,7 +6598,8 @@
/**
* 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}.
+ * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. Necessary
+ * because the mode is a composite of the underlying location provider settings.
*
* @param cr the content resolver to use
* @param userId the userId for which to read the mode