Add padlocks to more preferences that can be disabled by policy.
Change-Id: I7cc999dd1d46c20c888e0ba67053564e4d50946b
This commit is contained in:
@@ -46,6 +46,7 @@ import com.android.settings.Utils;
|
||||
import com.android.settings.applications.InstalledAppDetails;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.widget.SwitchBar;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
import com.android.settingslib.location.RecentLocationApps;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -53,6 +54,8 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
|
||||
/**
|
||||
* System location settings (Settings > Location). The screen has three parts:
|
||||
* <ul>
|
||||
@@ -373,9 +376,15 @@ public class LocationSettings extends LocationSettingsBase
|
||||
// corner cases, the location might still be enabled. In such case the master switch should
|
||||
// be disabled but checked.
|
||||
final boolean enabled = (mode != android.provider.Settings.Secure.LOCATION_MODE_OFF);
|
||||
EnforcedAdmin admin = RestrictedLockUtils.checkIfRestrictionEnforced(getActivity(),
|
||||
UserManager.DISALLOW_SHARE_LOCATION, UserHandle.myUserId());
|
||||
// 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);
|
||||
if (admin != null) {
|
||||
mSwitchBar.setDisabledByAdmin(admin);
|
||||
} else {
|
||||
mSwitchBar.setEnabled(!restricted);
|
||||
}
|
||||
mLocationMode.setEnabled(enabled && !restricted);
|
||||
mCategoryRecentLocationRequests.setEnabled(enabled);
|
||||
|
||||
|
Reference in New Issue
Block a user