summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/settings/SecuritySettings.java24
2 files changed, 25 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 96d7c60..e1a9bcd 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1174,7 +1174,7 @@
<!-- Title of dialog to user requesting use of location information to improve services -->
<string name="use_location_summary">Allow Google to use location for improved search and other services</string>
<!-- Message of dialog to user requesting use of location information -->
- <string name="use_location_warning_message">Allow Google to use location for improved search results and other services</string>
+ <string name="use_location_warning_message">Do you want to allow Google to use location for improved search results and other services?</string>
<!-- Agree -->
<string name="agree">Agree</string>
<!-- Disagree -->
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index c8933dc..677432c 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -25,6 +25,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
import android.database.Cursor;
import android.location.LocationManager;
@@ -68,6 +69,9 @@ public class SecuritySettings extends PreferenceActivity implements
private static final String KEY_TACTILE_FEEDBACK_ENABLED = "tactilefeedback";
private static final int CONFIRM_PATTERN_THEN_DISABLE_AND_CLEAR_REQUEST_CODE = 55;
+ private static final String PREFS_NAME = "location_prefs";
+ private static final String PREFS_USE_LOCATION = "use_location";
+
private LockPatternUtils mLockPatternUtils;
private CheckBoxPreference mLockEnabled;
private CheckBoxPreference mVisiblePattern;
@@ -335,6 +339,8 @@ public class SecuritySettings extends PreferenceActivity implements
mUseLocation.setChecked(true);
}
+ if (hasAgreedToUseLocation()) return;
+
CharSequence msg = getResources().getText(R.string.use_location_warning_message);
mUseLocationDialog = new AlertDialog.Builder(this).setMessage(msg)
.setTitle(R.string.use_location_title)
@@ -427,6 +433,7 @@ public class SecuritySettings extends PreferenceActivity implements
if (which == DialogInterface.BUTTON_POSITIVE) {
//updateProviders();
mOkClicked = true;
+ setAgreedToUseLocation(true);
} else {
// Reset the toggle
mUseLocation.setChecked(false);
@@ -462,6 +469,23 @@ public class SecuritySettings extends PreferenceActivity implements
}
}
+ private boolean hasAgreedToUseLocation() {
+ SharedPreferences sp = getSharedPreferences(PREFS_NAME, 0);
+ if (sp == null) {
+ return false;
+ }
+ return sp.getBoolean(PREFS_USE_LOCATION, false);
+ }
+
+ private void setAgreedToUseLocation(boolean agreed) {
+ if (agreed) {
+ SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putBoolean(PREFS_USE_LOCATION, true);
+ editor.commit();
+ }
+ }
+
private class CstorHelper implements DialogInterface.OnClickListener,
DialogInterface.OnDismissListener,
DialogInterface.OnCancelListener {