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

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

Merge "Expose system update related API to corp-owned managed profile"

parents 0f681fb3 ca00dd49
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -9109,7 +9109,8 @@ public class DevicePolicyManager {
    }
    /**
     * Called by device owners to set a local system update policy. When a new policy is set,
     * Called by device owners or profile owners of an organization-owned managed profile to to set
     * a local system update policy. When a new policy is set,
     * {@link #ACTION_SYSTEM_UPDATE_POLICY_CHANGED} is broadcasted.
     * <p>
     * If the supplied system update policy has freeze periods set but the freeze periods do not
@@ -9127,7 +9128,8 @@ public class DevicePolicyManager {
     *            components in the device owner package can set system update policies and the most
     *            recent policy takes effect.
     * @param policy the new policy, or {@code null} to clear the current policy.
     * @throws SecurityException if {@code admin} is not a device owner.
     * @throws SecurityException if {@code admin} is not a device owner or a profile owner of an
     *      organization-owned managed profile.
     * @throws IllegalArgumentException if the policy type or maintenance window is not valid.
     * @throws SystemUpdatePolicy.ValidationFailedException if the policy's freeze period does not
     *             meet the requirement.
@@ -11212,7 +11214,8 @@ public class DevicePolicyManager {
    }
    /**
     * Called by device owner to install a system update from the given file. The device will be
     * Called by device owner or profile owner of an organization-owned managed profile to install
     * a system update from the given file. The device will be
     * rebooted in order to finish installing the update. Note that if the device is rebooted, this
     * doesn't necessarily mean that the update has been applied successfully. The caller should
     * additionally check the system version with {@link android.os.Build#FINGERPRINT} or {@link
+5 −4
Original line number Diff line number Diff line
@@ -12211,7 +12211,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                    LocalDate.now());
        }
        synchronized (getLockObject()) {
            getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
            getActiveAdminForCallerLocked(who,
                    DeviceAdminInfo.USES_POLICY_ORGANIZATION_OWNED_PROFILE_OWNER);
            if (policy == null) {
                mOwners.clearSystemUpdatePolicy();
            } else {
@@ -12220,9 +12221,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            }
            mOwners.writeDeviceOwner();
        }
        mContext.sendBroadcastAsUser(
        mInjector.binderWithCleanCallingIdentity(() -> mContext.sendBroadcastAsUser(
                new Intent(DevicePolicyManager.ACTION_SYSTEM_UPDATE_POLICY_CHANGED),
                UserHandle.SYSTEM);
                UserHandle.SYSTEM));
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_SYSTEM_UPDATE_POLICY)
                .setAdmin(who)
@@ -14884,7 +14885,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                .setAdmin(admin)
                .setBoolean(isDeviceAB())
                .write();
        enforceDeviceOwner(admin);
        enforceDeviceOwnerOrProfileOwnerOnOrganizationOwnedDevice(admin);
        mInjector.binderWithCleanCallingIdentity(() -> {
            UpdateInstaller updateInstaller;
            if (isDeviceAB()) {