From 9294fdb6f8803eab64dc26d05dcdede419644115 Mon Sep 17 00:00:00 2001 From: Lifu Tang Date: Thu, 29 Aug 2013 18:06:30 -0700 Subject: Shows correct state when location sharing disabled - Fix b/10553306 Change-Id: I01f69aaeb79e18ddf29da5aef7ea00938e674429 --- src/com/android/settings/location/LocationSettings.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/com/android/settings') diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java index 815be4158..22bf42be2 100644 --- a/src/com/android/settings/location/LocationSettings.java +++ b/src/com/android/settings/location/LocationSettings.java @@ -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() -- cgit v1.2.3