summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-06-07 23:07:20 -0400
committerMike Lockwood <lockwood@android.com>2009-06-08 08:21:12 -0400
commit5ed2c4ad43f2c3c85a025da04becd2eaa75927a1 (patch)
treeac38b35dc104bfd8185ddcf984f9f2928ab1963e /src
parentd13308674b4ff614b6ade32efde0d7cff6d8dc2a (diff)
downloadpackages_apps_settings-5ed2c4ad43f2c3c85a025da04becd2eaa75927a1.zip
packages_apps_settings-5ed2c4ad43f2c3c85a025da04becd2eaa75927a1.tar.gz
packages_apps_settings-5ed2c4ad43f2c3c85a025da04becd2eaa75927a1.tar.bz2
Listen for changes to location pProvider enabled settings.
This is needed so we can correctly update the network location checkbox if the network location provider is disabled because the user disagreed to the terms of service in a dialog shown by the provider. Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/SecuritySettings.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index c6b19ce..166fa44 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -18,9 +18,11 @@ package com.android.settings;
import android.app.Activity;
+import android.content.ContentQueryMap;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.database.Cursor;
import android.location.LocationManager;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
@@ -32,6 +34,9 @@ import android.provider.Settings;
import android.util.Config;
import android.util.Log;
+import java.util.Observable;
+import java.util.Observer;
+
import com.android.internal.widget.LockPatternUtils;
/**
@@ -62,6 +67,16 @@ public class SecuritySettings extends PreferenceActivity {
private CheckBoxPreference mNetwork;
private CheckBoxPreference mGps;
+ // These provide support for receiving notification when Location Manager settings change.
+ // This is necessary because the Network Location Provider can change settings
+ // if the user does not confirm enabling the provider.
+ private ContentQueryMap mContentQueryMap;
+ private final class SettingsObserver implements Observer {
+ public void update(Observable o, Object arg) {
+ updateToggles();
+ }
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -74,6 +89,14 @@ public class SecuritySettings extends PreferenceActivity {
mNetwork = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_NETWORK);
mGps = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_GPS);
updateToggles();
+
+ // listen for Location Manager settings changes
+ Cursor settingsCursor = getContentResolver().query(Settings.Secure.CONTENT_URI, null,
+ "(" + Settings.System.NAME + "=?)",
+ new String[]{Settings.Secure.LOCATION_PROVIDERS_ALLOWED},
+ null);
+ mContentQueryMap = new ContentQueryMap(settingsCursor, Settings.System.NAME, true, null);
+ mContentQueryMap.addObserver(new SettingsObserver());
}
private PreferenceScreen createPreferenceHierarchy() {