Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 850d9642 authored by Elis Elliott's avatar Elis Elliott
Browse files

Move loading policy engine from DPMS constructor to #systemReady

Bug: 297930602

Test: Manual
Change-Id: Ife982007b3cc32a51c4cd691a8a45f80388a65e0
Merged-In: I86d8a5d5b719cfeab32383828cfc2f43f5ae9f65
parent 93dddb4a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1451,11 +1451,10 @@ final class DevicePolicyEngine {
        synchronized (mLock) {
            clear();
            new DevicePoliciesReaderWriter().readFromFileLocked();
            reapplyAllPoliciesLocked();
        }
    }

    private <V> void reapplyAllPoliciesLocked() {
    <V> void reapplyAllPoliciesLocked() {
        for (PolicyKey policy : mGlobalPolicies.keySet()) {
            PolicyState<?> policyState = mGlobalPolicies.get(policy);
            // Policy definition and value will always be of the same type
+6 −3
Original line number Diff line number Diff line
@@ -2143,9 +2143,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        mUserManagerInternal.addUserLifecycleListener(new UserLifecycleListener());
        mDeviceManagementResourcesProvider.load();
        if (isPermissionCheckFlagEnabled() || isPolicyEngineForFinanceFlagEnabled()) {
	mDevicePolicyEngine.load();
        }
        mContactSystemRoleHolders = fetchOemSystemHolders(/* roleResIds...= */
                com.android.internal.R.string.config_defaultSms,
@@ -3379,6 +3377,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                mOwners.systemReady();
                applyManagedSubscriptionsPolicyIfRequired();
                break;
            case SystemService.PHASE_SYSTEM_SERVICES_READY:
            	synchronized (getLockObject()) {
                    mDevicePolicyEngine.reapplyAllPoliciesLocked();
                }
                break;
            case SystemService.PHASE_ACTIVITY_MANAGER_READY:
                synchronized (getLockObject()) {
                    migrateToProfileOnOrganizationOwnedDeviceIfCompLocked();