Disable the switch bar instead of switch itself

- Fix b/15754817

Change-Id: I20c5bc85d35057a340ddcac691912863a4477804
This commit is contained in:
Lifu Tang
2014-06-27 18:10:16 -07:00
parent b4564c39b7
commit 387ecc6931

View File

@@ -227,7 +227,9 @@ public class LocationSettings extends LocationSettingsBase
// corner cases, the location might still be enabled. In such case the master switch should // corner cases, the location might still be enabled. In such case the master switch should
// be disabled but checked. // be disabled but checked.
boolean enabled = (mode != android.provider.Settings.Secure.LOCATION_MODE_OFF); boolean enabled = (mode != android.provider.Settings.Secure.LOCATION_MODE_OFF);
mSwitch.setEnabled(!restricted); // Disable the whole switch bar instead of the switch itself. If we disabled the switch
// only, it would be re-enabled again if the switch bar is not disabled.
mSwitchBar.setEnabled(!restricted);
mLocationMode.setEnabled(enabled && !restricted); mLocationMode.setEnabled(enabled && !restricted);
mCategoryRecentLocationRequests.setEnabled(enabled); mCategoryRecentLocationRequests.setEnabled(enabled);