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

Commit 1d8cfc99 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add hack in provisionFullyManagedDevice to allow silent provisioning"...

Merge "Add hack in provisionFullyManagedDevice to allow silent provisioning" into sc-dev am: 8d469cbc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13468346

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If45b7e4de6b490f24e46d774912432cfc241d009
parents 456f24df 8d469cbc
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -16223,6 +16223,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) {
@@ -16230,6 +16233,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());
@@ -16336,6 +16340,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;
    }
}