Load owner info during DevicePolicyManagerSerivce construction
While most of the admin policy (DevicePolicyData) is loaded lazily
wheneve they are read, the list of Device and Profile owners are
currently loaded during PHASE_LOCK_SETTINGS_READY, which means
policy getters relying on the list of owners, for example
isCommonCriteriaModeEnabled, does not work until this boot phase.
It turns out that some other system services (WifiService) will
attempt to read the policy before this boot phase and hence fails.
Fix this by loading the owner info as part of DevicePolicyManagerSerivce
construction, so the info is always available.
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: Set TestDPC as DO, enable Common Criteria mode, add WiFi,
Check /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
for the lack of plaintext WiFi PSK.
Test: atest
com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testSecurityLogging
Bug: 157476512
Change-Id: If403cf98574612cb44f7c8a697095276c65087fe
1 file changed