diff options
Diffstat (limited to 'src/com/android/settings/location/LocationSettings.java')
-rw-r--r-- | src/com/android/settings/location/LocationSettings.java | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java index 815be41..6dceea9 100644 --- a/src/com/android/settings/location/LocationSettings.java +++ b/src/com/android/settings/location/LocationSettings.java @@ -55,7 +55,7 @@ public class LocationSettings extends LocationSettingsBase /** Key for preference category "Recent location requests" */ private static final String KEY_RECENT_LOCATION_REQUESTS = "recent_location_requests"; /** Key for preference category "Location services" */ - private static final String KEY_LOCATION_SERVICES = "location_services"; + private static final String KEY_APP_SETTINGS = "app_settings"; private Switch mSwitch; private boolean mValidListener; @@ -165,10 +165,10 @@ public class LocationSettings extends LocationSettingsBase categoryRecentLocationRequests.addPreference(banner); } - PreferenceCategory categoryLocationServices = - (PreferenceCategory) root.findPreference(KEY_LOCATION_SERVICES); + PreferenceCategory categoryAppSettings = + (PreferenceCategory) root.findPreference(KEY_APP_SETTINGS); final SettingsInjector injector = new SettingsInjector(activity); - List<Preference> locationServices = injector.getInjectedSettings(); + List<Preference> appSettings = injector.getInjectedSettings(); mReceiver = new BroadcastReceiver() { @Override @@ -182,11 +182,11 @@ public class LocationSettings extends LocationSettingsBase activity.registerReceiver(mReceiver, new IntentFilter(SettingInjectorService.ACTION_INJECTED_SETTING_CHANGED)); - if (locationServices.size() > 0) { - addPreferencesSorted(locationServices, categoryLocationServices); + if (appSettings.size() > 0) { + addPreferencesSorted(appSettings, categoryAppSettings); } else { // If there's no item to display, remove the whole category. - root.removePreference(categoryLocationServices); + root.removePreference(categoryAppSettings); } // Only show the master switch when we're not in multi-pane mode, and not being used as @@ -233,9 +233,12 @@ public class LocationSettings extends LocationSettingsBase break; } - boolean enabled = (mode != Settings.Secure.LOCATION_MODE_OFF) && !restricted; + // Restricted user can't change the location mode, so disable the master switch. But in some + // corner cases, the location might still be enabled. In such case the master switch should + // be disabled but checked. + boolean enabled = (mode != Settings.Secure.LOCATION_MODE_OFF); mSwitch.setEnabled(!restricted); - mLocationMode.setEnabled(enabled); + mLocationMode.setEnabled(enabled && !restricted); if (enabled != mSwitch.isChecked()) { // set listener to null so that that code below doesn't trigger onCheckedChanged() |