AI 144257: am: CL 144256 Need to show opt-in screen for location collection.
Added a screen to the setup wizard, after login, to ask user to opt-in for location collection. Added a dialog to Settings when user turns on Network location. Fixed a security permission issue in LocationManagerService related to this change. Original author: yamasani Merged from: //branches/cupcake/... Automated import of CL 144257
This commit is contained in:

committed by
The Android Open Source Project
parent
f9e024198d
commit
4bfdcd3e5f
@@ -1102,6 +1102,14 @@
|
|||||||
<string name="location_street_level">When locating, accurate to street level (deselect to conserve battery)</string>
|
<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 -->
|
<!-- 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>
|
<string name="location_gps_disabled">Locate to street-level (requires more battery plus view of sky)</string>
|
||||||
|
<!-- Title of warning dialog to user that location information will be logged -->
|
||||||
|
<string name="location_warning_title">Location consent</string>
|
||||||
|
<!-- Warning text to user that location information will be logged -->
|
||||||
|
<string name="location_warning_message">"Allow Google's location service to collect anonymous and aggregate location data. Collection will occur regardless of whether any applications are active."</string>
|
||||||
|
<!-- Agree button-->
|
||||||
|
<string name="agree">Agree</string>
|
||||||
|
<!-- Disagree button-->
|
||||||
|
<string name="disagree">Disagree</string>
|
||||||
|
|
||||||
<!-- About -->
|
<!-- About -->
|
||||||
<!-- Main settings screen, setting title for the user to go into the About phone screen -->
|
<!-- Main settings screen, setting title for the user to go into the About phone screen -->
|
||||||
|
@@ -18,7 +18,9 @@ package com.android.settings;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
@@ -38,7 +40,7 @@ import com.android.internal.widget.LockPatternUtils;
|
|||||||
* Gesture lock pattern settings.
|
* Gesture lock pattern settings.
|
||||||
*/
|
*/
|
||||||
public class SecuritySettings extends PreferenceActivity
|
public class SecuritySettings extends PreferenceActivity
|
||||||
implements SharedPreferences.OnSharedPreferenceChangeListener {
|
implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
|
||||||
|
|
||||||
// Lock Settings
|
// Lock Settings
|
||||||
|
|
||||||
@@ -64,6 +66,9 @@ public class SecuritySettings extends PreferenceActivity
|
|||||||
private CheckBoxPreference mGps;
|
private CheckBoxPreference mGps;
|
||||||
private LocationManager mLocationManager;
|
private LocationManager mLocationManager;
|
||||||
|
|
||||||
|
// To track whether Agree was clicked in the Network location warning dialog
|
||||||
|
private boolean mOkClicked;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -79,7 +84,6 @@ public class SecuritySettings extends PreferenceActivity
|
|||||||
|
|
||||||
mNetwork = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_NETWORK);
|
mNetwork = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_NETWORK);
|
||||||
mGps = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_GPS);
|
mGps = (CheckBoxPreference) getPreferenceScreen().findPreference(LOCATION_GPS);
|
||||||
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
|
||||||
updateToggles();
|
updateToggles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,11 +188,46 @@ public class SecuritySettings extends PreferenceActivity
|
|||||||
} else if (preference == mShowPassword) {
|
} else if (preference == mShowPassword) {
|
||||||
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
|
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
|
||||||
mShowPassword.isChecked() ? 1 : 0);
|
mShowPassword.isChecked() ? 1 : 0);
|
||||||
|
} else if (preference == mNetwork) {
|
||||||
|
//normally called on the toggle click
|
||||||
|
if (mNetwork.isChecked()) {
|
||||||
|
// Show a warning to the user that location data will be shared
|
||||||
|
mOkClicked = false;
|
||||||
|
new AlertDialog.Builder(this).setMessage(
|
||||||
|
getResources().getString(R.string.location_warning_message))
|
||||||
|
.setTitle(R.string.location_warning_title)
|
||||||
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.setPositiveButton(R.string.agree, this)
|
||||||
|
.setNegativeButton(R.string.disagree, this)
|
||||||
|
.show()
|
||||||
|
.setOnDismissListener(this);
|
||||||
|
} else {
|
||||||
|
updateProviders();
|
||||||
|
}
|
||||||
|
} else if (preference == mGps) {
|
||||||
|
updateProviders();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
|
updateProviders();
|
||||||
|
mOkClicked = true;
|
||||||
|
} else {
|
||||||
|
// Reset the toggle
|
||||||
|
mNetwork.setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
// Assuming that onClick gets called first
|
||||||
|
if (!mOkClicked) {
|
||||||
|
mNetwork.setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creates toggles for each available location provider
|
* Creates toggles for each available location provider
|
||||||
*/
|
*/
|
||||||
@@ -233,12 +272,6 @@ public class SecuritySettings extends PreferenceActivity
|
|||||||
return allowedProviders;
|
return allowedProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
|
||||||
if (LOCATION_NETWORK.equals(key) || LOCATION_GPS.equals(key)) {
|
|
||||||
updateProviders();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isToggled(Preference pref) {
|
private boolean isToggled(Preference pref) {
|
||||||
return ((CheckBoxPreference) pref).isChecked();
|
return ((CheckBoxPreference) pref).isChecked();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user