Block settings when DISALLOW_CONFIG_DATE_TIME.

Test: m -j RunSettingsRoboTests
runtest -x packages/apps/Settings/tests/unit/src/com/android/settings/core/UserRestrictionTest.java

Fix: 67497909

After turn on the user restriction in TestDPC:
https://hsv.googleplex.com/5414119658225664
The date time settings page become:
https://hsv.googleplex.com/5199302573948928


Change-Id: I42590c4a505ec1b6ffa86eb460b90fa6ec8ba783
This commit is contained in:
yuemingw
2017-10-23 18:36:00 +01:00
parent bd642f9db8
commit 7b1da61346
9 changed files with 222 additions and 21 deletions

View File

@@ -46,8 +46,10 @@ public class AutoTimePreferenceController extends AbstractPreferenceController
if (!(preference instanceof RestrictedSwitchPreference)) {
return;
}
((RestrictedSwitchPreference) preference).setDisabledByAdmin(
getEnforcedAdminProperty());
if (!((RestrictedSwitchPreference) preference).isDisabledByAdmin()) {
((RestrictedSwitchPreference) preference).setDisabledByAdmin(
getEnforcedAdminProperty());
}
((RestrictedSwitchPreference) preference).setChecked(isEnabled());
}