Split Location and Security settings.
Needs final icon for location. Change-Id: I8d826203c4d0ca4ae768f59ecdeae2700bad7c86
This commit is contained in:
@@ -620,15 +620,33 @@
|
||||
android:value="com.android.settings.Settings$ApplicationSettingsActivity" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="Settings$LocationSettingsActivity"
|
||||
android:theme="@android:style/Theme.Holo"
|
||||
android:label="@string/location_settings_title"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:clearTaskOnLaunch="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.settings.LOCATION_SOURCE_SETTINGS" />
|
||||
<action android:name="android.credentials.UNLOCK" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
||||
<category android:name="com.android.settings.SHORTCUT" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.LocationSettings" />
|
||||
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
|
||||
android:resource="@id/location_settings" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="Settings$SecuritySettingsActivity"
|
||||
android:theme="@android:style/Theme.Holo"
|
||||
android:label="@string/location_security_settings_title"
|
||||
android:label="@string/security_settings_title"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:clearTaskOnLaunch="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.settings.SECURITY_SETTINGS" />
|
||||
<action android:name="android.settings.LOCATION_SOURCE_SETTINGS" />
|
||||
<action android:name="android.credentials.UNLOCK" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
||||
@@ -684,7 +702,7 @@
|
||||
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
|
||||
android:resource="@id/security_settings" />
|
||||
<meta-data android:name="com.android.settings.PARENT_FRAGMENT_TITLE"
|
||||
android:resource="@string/location_security_settings_title" />
|
||||
android:resource="@string/security_settings_title" />
|
||||
<meta-data android:name="com.android.settings.PARENT_FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.Settings$SecuritySettingsActivity" />
|
||||
</activity>
|
||||
|
BIN
res/drawable-hdpi/ic_settings_location.png
Executable file
BIN
res/drawable-hdpi/ic_settings_location.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
res/drawable-mdpi/ic_settings_location.png
Normal file
BIN
res/drawable-mdpi/ic_settings_location.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 955 B |
@@ -599,10 +599,10 @@
|
||||
<string name="owner_info_settings_summary"></string>
|
||||
<!-- Hint text shown in owner info edit text [CHAR LIMIT=50] -->
|
||||
<string name="owner_info_settings_edit_text_hint">Enter text to display on the lock screen</string>
|
||||
<!-- Main Settings screen setting option title for the item to take you the security and location screen -->
|
||||
<string name="security_settings_title">Location & security</string>
|
||||
<!-- Location & security settings screen title -->
|
||||
<string name="location_security_settings_title">Location & security settings</string>
|
||||
<!-- Main Settings screen setting option title for the item to take you to the location screen -->
|
||||
<string name="location_settings_title">Location services</string>
|
||||
<!-- Main Settings screen setting option title for the item to take you to the security screen -->
|
||||
<string name="security_settings_title">Security</string>
|
||||
<!-- Main Settings screen setting option summary text for the item tot ake you to the security and location screen -->
|
||||
<string name="security_settings_summary">Set My Location, screen unlock, SIM card lock, credential storage lock</string>
|
||||
<!-- Main Settings screen setting option summary text for the item to take you to the CDMA security and location screen -->
|
||||
|
41
res/xml/location_settings.xml
Normal file
41
res/xml/location_settings.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/location_settings_title">
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="location_network"
|
||||
android:title="@string/location_network_based"
|
||||
android:summaryOn="@string/location_neighborhood_level"
|
||||
android:summaryOff="@string/location_networks_disabled"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="location_gps"
|
||||
android:title="@string/location_gps"
|
||||
android:summaryOn="@string/location_street_level"
|
||||
android:summaryOff="@string/location_gps_disabled"/>
|
||||
|
||||
<!-- Disabled to avoid confusion on devices with no AGPS
|
||||
For Google experience devices we want AGPS on by default (if supported) so we don't really need this.
|
||||
<CheckBoxPreference
|
||||
android:key="assisted_gps"
|
||||
android:title="@string/assisted_gps"
|
||||
android:summaryOn="@string/assisted_gps_enabled"
|
||||
android:summaryOff="@string/assisted_gps_disabled"/>
|
||||
-->
|
||||
|
||||
</PreferenceScreen>
|
@@ -15,33 +15,6 @@
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/location_security_settings_title">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="location_category"
|
||||
android:title="@string/location_title">
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="location_network"
|
||||
android:title="@string/location_network_based"
|
||||
android:summaryOn="@string/location_neighborhood_level"
|
||||
android:summaryOff="@string/location_networks_disabled"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="location_gps"
|
||||
android:title="@string/location_gps"
|
||||
android:summaryOn="@string/location_street_level"
|
||||
android:summaryOff="@string/location_gps_disabled"/>
|
||||
|
||||
<!-- Disabled to avoid confusion on devices with no AGPS
|
||||
For Google experience devices we want AGPS on by default (if supported) so we don't really need this.
|
||||
<CheckBoxPreference
|
||||
android:key="assisted_gps"
|
||||
android:title="@string/assisted_gps"
|
||||
android:summaryOn="@string/assisted_gps_enabled"
|
||||
android:summaryOff="@string/assisted_gps_disabled"/>
|
||||
-->
|
||||
|
||||
</PreferenceCategory>
|
||||
android:title="@string/security_settings_title">
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@@ -119,7 +119,14 @@
|
||||
android:title="@string/sync_settings"
|
||||
android:id="@+id/sync_settings" />
|
||||
|
||||
<!-- Security & Location -->
|
||||
<!-- Location -->
|
||||
<header
|
||||
android:fragment="com.android.settings.LocationSettings"
|
||||
android:icon="@drawable/ic_settings_location"
|
||||
android:title="@string/location_settings_title"
|
||||
android:id="@+id/location_settings" />
|
||||
|
||||
<!-- Security -->
|
||||
<header
|
||||
android:fragment="com.android.settings.SecuritySettings"
|
||||
android:icon="@drawable/ic_settings_security"
|
||||
|
@@ -122,6 +122,7 @@ public class GoogleLocationSettingHelper {
|
||||
try {
|
||||
context.startActivity(i);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e("GoogleLocationSettingHelper", "Problem while starting GSF location activity");
|
||||
}
|
||||
}
|
||||
|
||||
|
193
src/com/android/settings/LocationSettings.java
Normal file
193
src/com/android/settings/LocationSettings.java
Normal file
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
|
||||
import android.content.ContentQueryMap;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.location.LocationManager;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.provider.Settings;
|
||||
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
/**
|
||||
* Gesture lock pattern settings.
|
||||
*/
|
||||
public class LocationSettings extends SettingsPreferenceFragment
|
||||
implements OnPreferenceChangeListener {
|
||||
|
||||
// Location Settings
|
||||
private static final String KEY_LOCATION_NETWORK = "location_network";
|
||||
private static final String KEY_LOCATION_GPS = "location_gps";
|
||||
private static final String KEY_ASSISTED_GPS = "assisted_gps";
|
||||
private static final String KEY_USE_LOCATION = "location_use_for_services";
|
||||
|
||||
private CheckBoxPreference mNetwork;
|
||||
private CheckBoxPreference mGps;
|
||||
private CheckBoxPreference mAssistedGps;
|
||||
private CheckBoxPreference mUseLocation;
|
||||
|
||||
// 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 Observer mSettingsObserver;
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (mSettingsObserver != null) {
|
||||
mContentQueryMap.deleteObserver(mSettingsObserver);
|
||||
}
|
||||
}
|
||||
|
||||
private PreferenceScreen createPreferenceHierarchy() {
|
||||
PreferenceScreen root = getPreferenceScreen();
|
||||
if (root != null) {
|
||||
root.removeAll();
|
||||
}
|
||||
addPreferencesFromResource(R.xml.location_settings);
|
||||
root = getPreferenceScreen();
|
||||
|
||||
mNetwork = (CheckBoxPreference) root.findPreference(KEY_LOCATION_NETWORK);
|
||||
mGps = (CheckBoxPreference) root.findPreference(KEY_LOCATION_GPS);
|
||||
mAssistedGps = (CheckBoxPreference) root.findPreference(KEY_ASSISTED_GPS);
|
||||
if (GoogleLocationSettingHelper.isAvailable(getActivity())) {
|
||||
// GSF present, Add setting for 'Use My Location'
|
||||
CheckBoxPreference useLocation = new CheckBoxPreference(getActivity());
|
||||
useLocation.setKey(KEY_USE_LOCATION);
|
||||
useLocation.setTitle(R.string.use_location_title);
|
||||
useLocation.setSummaryOn(R.string.use_location_summary_enabled);
|
||||
useLocation.setSummaryOff(R.string.use_location_summary_disabled);
|
||||
useLocation.setChecked(
|
||||
GoogleLocationSettingHelper.getUseLocationForServices(getActivity())
|
||||
== GoogleLocationSettingHelper.USE_LOCATION_FOR_SERVICES_ON);
|
||||
useLocation.setPersistent(false);
|
||||
useLocation.setOnPreferenceChangeListener(this);
|
||||
getPreferenceScreen().addPreference(useLocation);
|
||||
mUseLocation = useLocation;
|
||||
}
|
||||
|
||||
// Change the summary for wifi-only devices
|
||||
if (Utils.isWifiOnly()) {
|
||||
mNetwork.setSummaryOn(R.string.location_neighborhood_level_wifi);
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// Make sure we reload the preference hierarchy since some of these settings
|
||||
// depend on others...
|
||||
createPreferenceHierarchy();
|
||||
updateLocationToggles();
|
||||
|
||||
if (mSettingsObserver == null) {
|
||||
mSettingsObserver = new Observer() {
|
||||
public void update(Observable o, Object arg) {
|
||||
updateLocationToggles();
|
||||
}
|
||||
};
|
||||
mContentQueryMap.addObserver(mSettingsObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||
|
||||
if (preference == mNetwork) {
|
||||
Settings.Secure.setLocationProviderEnabled(getContentResolver(),
|
||||
LocationManager.NETWORK_PROVIDER, mNetwork.isChecked());
|
||||
} else if (preference == mGps) {
|
||||
boolean enabled = mGps.isChecked();
|
||||
Settings.Secure.setLocationProviderEnabled(getContentResolver(),
|
||||
LocationManager.GPS_PROVIDER, enabled);
|
||||
if (mAssistedGps != null) {
|
||||
mAssistedGps.setEnabled(enabled);
|
||||
}
|
||||
} else if (preference == mAssistedGps) {
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSISTED_GPS_ENABLED,
|
||||
mAssistedGps.isChecked() ? 1 : 0);
|
||||
} else {
|
||||
// If we didn't handle it, let preferences handle it.
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates toggles for each available location provider
|
||||
*/
|
||||
private void updateLocationToggles() {
|
||||
ContentResolver res = getContentResolver();
|
||||
boolean gpsEnabled = Settings.Secure.isLocationProviderEnabled(
|
||||
res, LocationManager.GPS_PROVIDER);
|
||||
mNetwork.setChecked(Settings.Secure.isLocationProviderEnabled(
|
||||
res, LocationManager.NETWORK_PROVIDER));
|
||||
mGps.setChecked(gpsEnabled);
|
||||
if (mAssistedGps != null) {
|
||||
mAssistedGps.setChecked(Settings.Secure.getInt(res,
|
||||
Settings.Secure.ASSISTED_GPS_ENABLED, 2) == 1);
|
||||
mAssistedGps.setEnabled(gpsEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* see confirmPatternThenDisableAndClear
|
||||
*/
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
createPreferenceHierarchy();
|
||||
}
|
||||
|
||||
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||
if (preference == mUseLocation) {
|
||||
boolean newValue = (value == null ? false : (Boolean) value);
|
||||
GoogleLocationSettingHelper.setUseLocationForServices(getActivity(), newValue);
|
||||
// We don't want to change the value immediately here, since the user may click
|
||||
// disagree in the dialog that pops up. When the activity we just launched exits, this
|
||||
// activity will be restated and the new value re-read, so the checkbox will get its
|
||||
// new value then.
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -19,15 +19,9 @@ package com.android.settings;
|
||||
|
||||
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ContentQueryMap;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.CheckBoxPreference;
|
||||
@@ -41,9 +35,9 @@ import android.security.KeyStore;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
/**
|
||||
* Gesture lock pattern settings.
|
||||
@@ -60,38 +54,17 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout";
|
||||
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
|
||||
|
||||
// Location Settings
|
||||
private static final String KEY_LOCATION_CATEGORY = "location_category";
|
||||
private static final String KEY_LOCATION_NETWORK = "location_network";
|
||||
private static final String KEY_LOCATION_GPS = "location_gps";
|
||||
private static final String KEY_ASSISTED_GPS = "assisted_gps";
|
||||
private static final String KEY_USE_LOCATION = "location_use_for_services";
|
||||
|
||||
// Misc Settings
|
||||
private static final String KEY_SIM_LOCK = "sim_lock";
|
||||
private static final String KEY_SHOW_PASSWORD = "show_password";
|
||||
private static final String KEY_RESET_CREDENTIALS = "reset_credentials";
|
||||
|
||||
private static final String TAG = "SecuritySettings";
|
||||
|
||||
private CheckBoxPreference mNetwork;
|
||||
private CheckBoxPreference mGps;
|
||||
private CheckBoxPreference mAssistedGps;
|
||||
private CheckBoxPreference mUseLocation;
|
||||
|
||||
DevicePolicyManager mDPM;
|
||||
|
||||
// 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 ChooseLockSettingsHelper mChooseLockSettingsHelper;
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
private ListPreference mLockAfter;
|
||||
|
||||
private Observer mSettingsObserver;
|
||||
|
||||
private CheckBoxPreference mVisiblePattern;
|
||||
private CheckBoxPreference mTactileFeedback;
|
||||
|
||||
@@ -110,25 +83,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (mSettingsObserver != null) {
|
||||
mContentQueryMap.deleteObserver(mSettingsObserver);
|
||||
}
|
||||
}
|
||||
|
||||
private PreferenceScreen createPreferenceHierarchy() {
|
||||
PreferenceScreen root = getPreferenceScreen();
|
||||
if (root != null) {
|
||||
@@ -137,32 +91,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
addPreferencesFromResource(R.xml.security_settings);
|
||||
root = getPreferenceScreen();
|
||||
|
||||
mNetwork = (CheckBoxPreference) root.findPreference(KEY_LOCATION_NETWORK);
|
||||
mGps = (CheckBoxPreference) root.findPreference(KEY_LOCATION_GPS);
|
||||
mAssistedGps = (CheckBoxPreference) root.findPreference(KEY_ASSISTED_GPS);
|
||||
if (GoogleLocationSettingHelper.isAvailable(getActivity())) {
|
||||
// GSF present, Add setting for 'Use My Location'
|
||||
PreferenceGroup locationCat =
|
||||
(PreferenceGroup) root.findPreference(KEY_LOCATION_CATEGORY);
|
||||
CheckBoxPreference useLocation = new CheckBoxPreference(getActivity());
|
||||
useLocation.setKey(KEY_USE_LOCATION);
|
||||
useLocation.setTitle(R.string.use_location_title);
|
||||
useLocation.setSummaryOn(R.string.use_location_summary_enabled);
|
||||
useLocation.setSummaryOff(R.string.use_location_summary_disabled);
|
||||
useLocation.setChecked(
|
||||
GoogleLocationSettingHelper.getUseLocationForServices(getActivity())
|
||||
== GoogleLocationSettingHelper.USE_LOCATION_FOR_SERVICES_ON);
|
||||
useLocation.setPersistent(false);
|
||||
useLocation.setOnPreferenceChangeListener(this);
|
||||
locationCat.addPreference(useLocation);
|
||||
mUseLocation = useLocation;
|
||||
}
|
||||
|
||||
// Change the summary for wifi-only devices
|
||||
if (Utils.isWifiOnly()) {
|
||||
mNetwork.setSummaryOn(R.string.location_neighborhood_level_wifi);
|
||||
}
|
||||
|
||||
// Add options for lock/unlock screen
|
||||
int resid = 0;
|
||||
if (!mLockPatternUtils.isSecure()) {
|
||||
@@ -311,16 +239,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
// Make sure we reload the preference hierarchy since some of these settings
|
||||
// depend on others...
|
||||
createPreferenceHierarchy();
|
||||
updateLocationToggles();
|
||||
|
||||
if (mSettingsObserver == null) {
|
||||
mSettingsObserver = new Observer() {
|
||||
public void update(Observable o, Object arg) {
|
||||
updateLocationToggles();
|
||||
}
|
||||
};
|
||||
mContentQueryMap.addObserver(mSettingsObserver);
|
||||
}
|
||||
|
||||
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
|
||||
if (mVisiblePattern != null) {
|
||||
@@ -338,8 +256,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
||||
Preference preference) {
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||
final String key = preference.getKey();
|
||||
|
||||
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
|
||||
@@ -355,19 +272,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
} else if (preference == mShowPassword) {
|
||||
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
|
||||
mShowPassword.isChecked() ? 1 : 0);
|
||||
} else if (preference == mNetwork) {
|
||||
Settings.Secure.setLocationProviderEnabled(getContentResolver(),
|
||||
LocationManager.NETWORK_PROVIDER, mNetwork.isChecked());
|
||||
} else if (preference == mGps) {
|
||||
boolean enabled = mGps.isChecked();
|
||||
Settings.Secure.setLocationProviderEnabled(getContentResolver(),
|
||||
LocationManager.GPS_PROVIDER, enabled);
|
||||
if (mAssistedGps != null) {
|
||||
mAssistedGps.setEnabled(enabled);
|
||||
}
|
||||
} else if (preference == mAssistedGps) {
|
||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSISTED_GPS_ENABLED,
|
||||
mAssistedGps.isChecked() ? 1 : 0);
|
||||
} else {
|
||||
// If we didn't handle it, let preferences handle it.
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
@@ -376,29 +280,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates toggles for each available location provider
|
||||
*/
|
||||
private void updateLocationToggles() {
|
||||
ContentResolver res = getContentResolver();
|
||||
boolean gpsEnabled = Settings.Secure.isLocationProviderEnabled(
|
||||
res, LocationManager.GPS_PROVIDER);
|
||||
mNetwork.setChecked(Settings.Secure.isLocationProviderEnabled(
|
||||
res, LocationManager.NETWORK_PROVIDER));
|
||||
mGps.setChecked(gpsEnabled);
|
||||
if (mAssistedGps != null) {
|
||||
mAssistedGps.setChecked(Settings.Secure.getInt(res,
|
||||
Settings.Secure.ASSISTED_GPS_ENABLED, 2) == 1);
|
||||
mAssistedGps.setEnabled(gpsEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isToggled(Preference pref) {
|
||||
return ((CheckBoxPreference) pref).isChecked();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #confirmPatternThenDisableAndClear
|
||||
* see confirmPatternThenDisableAndClear
|
||||
*/
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
@@ -416,14 +303,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
Log.e("SecuritySettings", "could not persist lockAfter timeout setting", e);
|
||||
}
|
||||
updateLockAfterPreferenceSummary();
|
||||
} else if (preference == mUseLocation) {
|
||||
boolean newValue = (value == null ? false : (Boolean) value);
|
||||
GoogleLocationSettingHelper.setUseLocationForServices(getActivity(), newValue);
|
||||
// We don't want to change the value immediately here, since the user may click
|
||||
// disagree in the dialog that pops up. When the activity we just launched exits, this
|
||||
// activity will be restated and the new value re-read, so the checkbox will get its
|
||||
// new value then.
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -528,7 +528,6 @@ public class Settings extends PreferenceActivity implements ButtonBarHandler {
|
||||
/*
|
||||
* Settings subclasses for launching independently.
|
||||
*/
|
||||
|
||||
public static class BluetoothSettingsActivity extends Settings { /* empty */ }
|
||||
public static class WirelessSettingsActivity extends Settings { /* empty */ }
|
||||
public static class TetherSettingsActivity extends Settings { /* empty */ }
|
||||
@@ -550,6 +549,7 @@ public class Settings extends PreferenceActivity implements ButtonBarHandler {
|
||||
public static class DevelopmentSettingsActivity extends Settings { /* empty */ }
|
||||
public static class AccessibilitySettingsActivity extends Settings { /* empty */ }
|
||||
public static class SecuritySettingsActivity extends Settings { /* empty */ }
|
||||
public static class LocationSettingsActivity extends Settings { /* empty */ }
|
||||
public static class PrivacySettingsActivity extends Settings { /* empty */ }
|
||||
public static class DockSettingsActivity extends Settings { /* empty */ }
|
||||
public static class RunningServicesActivity extends Settings { /* empty */ }
|
||||
|
Reference in New Issue
Block a user