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

Commit 8d469cbc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add hack in provisionFullyManagedDevice to allow silent provisioning" into sc-dev

parents f2abb387 6183cfe1
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -16220,6 +16220,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        final long identity = Binder.clearCallingIdentity();
        try {
            // TODO(b/178187130): This check fails silent provisioning, uncomment once silent
            //  provisioning is no longer used.
            if (false) {
                int result = checkProvisioningPreConditionSkipPermission(
                        ACTION_PROVISION_MANAGED_DEVICE, deviceAdmin.getPackageName());
                if (result != CODE_OK) {
@@ -16227,6 +16230,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                            PROVISIONING_RESULT_PRE_CONDITION_FAILED,
                            "Provisioning preconditions failed with result: " + result);
                }
            }
            setTimeAndTimezone(provisioningParams.getTimeZone(), provisioningParams.getLocalTime());
            setLocale(provisioningParams.getLocale());
@@ -16333,6 +16337,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    private boolean setActiveAdminAndDeviceOwner(
            @UserIdInt int userId, ComponentName adminComponent, String name) {
        enableAndSetActiveAdmin(userId, userId, adminComponent);
        // TODO(b/178187130): Directly set DO and remove the check once silent provisioning is no
        //  longer used.
        if (getDeviceOwnerComponent(/* callingUserOnly= */ true) == null) {
            return setDeviceOwner(adminComponent, name, userId);
        }
        return true;
    }
}