(Re)Introduce "enabled by admin" / "disabled by admin" SettingsUI state.
ag/18665634 changed behavior: When enterprise policy restricts the
user's ability to change the "auto time" and "auto time zone" toggle,
the toggle was hidden rather than "visible but disabled".
Bug 266693620 demonstrates testers are checking for the behavior.
This commit returns the old behavior for the "auto time" and "auto time
zone" SettingUI behavior, i.e. the user can see the toggle and its
setting value, but is told that it is under admin control and the
current setting value.
See the bug for more info / historic behavior analysis.
Bug: 266693620
Test: Manual testing with TestDPC
Test: atest to confirm existing tests do not fail
Change-Id: I0a605054312547fbd44fc34025ee36b075e05e01
Switch auto time setting to use TimeManager APIs instead of low-level
direct settings access.
This makes the AutoTimePreferenceController approach the same as
AutoTimeZonePreferenceController. Most of the logic about what to
display and whether toggles are enabled is moved to the service.
This change has the side effect of adding support in SettingsUI for
devices with no auto time detection mechanism configured at all, i.e.
the auto time toggle will stop being shown in SettingsUI. There are no
known devices that require this currently, but it is a theoretical
possibility if config.xml is configured in particular ways.
Bug: 172891783
Test: Manual testing with different settings for "time origin
priorities" (i.e. empty, non-empty)
Test: m ROBOTEST_FILTER=com.android.settings.datetime RunSettingsRoboTests -j40
Change-Id: I4112fb51adb0d06a1dbc39a44ea109d6df899153
* Deprecate setAutoTimeRequired and getAutoTimeRequired.
* Added new API methods setAutoTime and getAutoTime.
* These new APIS use the DISALLOW_CONFIG_DATE_TIME user restriction to prevent the user from setting auto time.
* Updated Settings AutoTimePreferenceController to look at the DISALLOW_CONFIG_DATE_TIME restriction
Bug: 138709470
Test: Manual testing with testdpc and the set auto time toggle
DevicePolicyManagerTest
DeviceAndProfileOwnerTest
DevicePolicyLoggingTest
AutoTimePreferenceControllerTest
Change-Id: I55b44840089a0b701ca4d5572a0e91deb40152ed
This means that in some cases RestrictedLockUtils has to be used and in
some RestrictedLockUtilsInternal.
This causes a lot of trivial code changes.
I also updated the ordering of the imports in all affected files.
Bug: 110953302
Test: Built
make -j RunSettingsRoboTests
Change-Id: I9bdf8b89134f853bae4f38c81af436715c73e924
Having consistent import order will reduce chance of merge
conflict between internal and external master
Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
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