summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-06-25 16:39:48 -0400
committerMike Lockwood <lockwood@android.com>2009-06-25 17:16:10 -0400
commitd75fb2f92f237ea9c818551f1826f991be57284c (patch)
tree9f94b3435d9d1b3c6a2a5e5c641c2f046c5a4cb5
parenta4e9f21075b801a4a37b589133820ed8d58d11f7 (diff)
downloadpackages_apps_settings-d75fb2f92f237ea9c818551f1826f991be57284c.zip
packages_apps_settings-d75fb2f92f237ea9c818551f1826f991be57284c.tar.gz
packages_apps_settings-d75fb2f92f237ea9c818551f1826f991be57284c.tar.bz2
Settings: Add preference to enable/disable assisted GPS.
Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r--res/values/strings.xml6
-rw-r--r--res/xml/security_settings.xml6
-rw-r--r--src/com/android/settings/SecuritySettings.java18
3 files changed, 27 insertions, 3 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5df6cf5..e090627 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1143,6 +1143,12 @@
<string name="location_street_level">When locating, accurate to street level (deselect to conserve battery)</string>
<!-- Security & location settings screen, setting summary when Enable GPS satellites check box is clear -->
<string name="location_gps_disabled">Locate to street-level (requires more battery plus view of sky)</string>
+ <!-- Security & location settings screen, setting check box label if Assisted GPS should be enabled -->
+ <string name="assisted_gps">Enable assisted GPS</string>
+ <!-- Security & location settings screen, setting summary when Assisted GPS check box is selected -->
+ <string name="assisted_gps_enabled">Use server to assist GPS (deselect to reduce network usage)</string>
+ <!-- Security & location settings screen, setting summary when Assisted GPS check box is clear -->
+ <string name="assisted_gps_disabled">Use server to assist GPS (select to improve GPS performance)</string>
<!-- Setting title for allow sending location to google -->
<string name="use_location_title">Share with Google</string>
<!-- Title of dialog to user requesting use of location information to improve services -->
diff --git a/res/xml/security_settings.xml b/res/xml/security_settings.xml
index 8dd9d89..5b90dba 100644
--- a/res/xml/security_settings.xml
+++ b/res/xml/security_settings.xml
@@ -33,6 +33,12 @@
android:summaryOff="@string/location_gps_disabled"/>
<CheckBoxPreference
+ android:key="assisted_gps"
+ android:title="@string/assisted_gps"
+ android:summaryOn="@string/assisted_gps_enabled"
+ android:summaryOff="@string/assisted_gps_disabled"/>
+
+ <CheckBoxPreference
android:key="use_location"
android:title="@string/use_location_title"
android:persistent="false"
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index c17e2a0..c9c6c4b 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -70,6 +70,7 @@ public class SecuritySettings extends PreferenceActivity implements
private static final String LOCATION_CATEGORY = "location_category";
private static final String LOCATION_NETWORK = "location_network";
private static final String LOCATION_GPS = "location_gps";
+ private static final String ASSISTED_GPS = "assisted_gps";
// Vendor specific
private static final String GSETTINGS_PROVIDER = "com.google.android.providers.settings";
@@ -81,6 +82,7 @@ public class SecuritySettings extends PreferenceActivity implements
private CheckBoxPreference mNetwork;
private CheckBoxPreference mGps;
+ private CheckBoxPreference mAssistedGps;
// These provide support for receiving notification when Location Manager settings change.
// This is necessary because the Network Location Provider can change settings
@@ -103,6 +105,7 @@ public class SecuritySettings extends PreferenceActivity implements
mNetwork = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_NETWORK);
mGps = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_GPS);
+ mAssistedGps = (CheckBoxPreference) getPreferenceScreen().findPreference(ASSISTED_GPS);
mUseLocation = (CheckBoxPreference) getPreferenceScreen().findPreference(USE_LOCATION);
// Vendor specific
@@ -263,8 +266,13 @@ public class SecuritySettings extends PreferenceActivity implements
Settings.Secure.setLocationProviderEnabled(getContentResolver(),
LocationManager.NETWORK_PROVIDER, mNetwork.isChecked());
} else if (preference == mGps) {
+ boolean enabled = mGps.isChecked();
Settings.Secure.setLocationProviderEnabled(getContentResolver(),
- LocationManager.GPS_PROVIDER, mGps.isChecked());
+ LocationManager.GPS_PROVIDER, enabled);
+ mAssistedGps.setEnabled(enabled);
+ } else if (preference == mAssistedGps) {
+ Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSISTED_GPS_ENABLED,
+ mAssistedGps.isChecked() ? 1 : 0);
} else if (preference == mUseLocation) {
//normally called on the toggle click
if (mUseLocation.isChecked()) {
@@ -306,10 +314,14 @@ public class SecuritySettings extends PreferenceActivity implements
*/
private void updateToggles() {
ContentResolver res = getContentResolver();
+ boolean gpsEnabled = Settings.Secure.isLocationProviderEnabled(
+ res, LocationManager.GPS_PROVIDER);
mNetwork.setChecked(Settings.Secure.isLocationProviderEnabled(
res, LocationManager.NETWORK_PROVIDER));
- mGps.setChecked(Settings.Secure.isLocationProviderEnabled(
- res, LocationManager.GPS_PROVIDER));
+ mGps.setChecked(gpsEnabled);
+ mAssistedGps.setChecked(Settings.Secure.getInt(res,
+ Settings.Secure.ASSISTED_GPS_ENABLED, 2) == 1);
+ mAssistedGps.setEnabled(gpsEnabled);
mUseLocation.setChecked(Settings.Secure.getInt(res,
Settings.Secure.USE_LOCATION_FOR_SERVICES, 2) == 1);
}