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

Commit fbb78d95 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Make work profile maximum time off at least 3 days." into rvc-dev am:...

Merge "Make work profile maximum time off at least 3 days." into rvc-dev am: 6e4ef9b5 am: 5735fef3 am: fe7a1897

Change-Id: I640e13008ab45a4f48b86355e201d0a0ecb24490
parents 0b63c283 fe7a1897
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -11995,7 +11995,8 @@ public class DevicePolicyManager {
     *
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with
     * @param timeoutMillis Maximum time the profile is allowed to be off in milliseconds or 0 if
     * @param timeoutMillis Maximum time the profile is allowed to be off in milliseconds or 0 if
     *        not limited.
     *        not limited. The minimum non-zero value corresponds to 72 hours. If an admin sets a
     *        smaller non-zero vaulue, 72 hours will be set instead.
     * @throws IllegalStateException if the profile owner doesn't have an activity that handles
     * @throws IllegalStateException if the profile owner doesn't have an activity that handles
     *        {@link #ACTION_CHECK_POLICY_COMPLIANCE}
     *        {@link #ACTION_CHECK_POLICY_COMPLIANCE}
     * @see #setPersonalAppsSuspended
     * @see #setPersonalAppsSuspended
+7 −0
Original line number Original line Diff line number Diff line
@@ -393,6 +393,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    private static final long MS_PER_DAY = TimeUnit.DAYS.toMillis(1);
    private static final long MS_PER_DAY = TimeUnit.DAYS.toMillis(1);
    private static final long EXPIRATION_GRACE_PERIOD_MS = 5 * MS_PER_DAY; // 5 days, in ms
    private static final long EXPIRATION_GRACE_PERIOD_MS = 5 * MS_PER_DAY; // 5 days, in ms
    private static final long MANAGED_PROFILE_MAXIMUM_TIME_OFF_THRESHOLD = 3 * MS_PER_DAY;
    private static final String ACTION_EXPIRED_PASSWORD_NOTIFICATION =
    private static final String ACTION_EXPIRED_PASSWORD_NOTIFICATION =
            "com.android.server.ACTION_EXPIRED_PASSWORD_NOTIFICATION";
            "com.android.server.ACTION_EXPIRED_PASSWORD_NOTIFICATION";
@@ -15849,6 +15850,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            // DO shouldn't be able to use this method.
            // DO shouldn't be able to use this method.
            enforceProfileOwnerOfOrganizationOwnedDevice(admin);
            enforceProfileOwnerOfOrganizationOwnedDevice(admin);
            enforceHandlesCheckPolicyComplianceIntent(userId, admin.info.getPackageName());
            enforceHandlesCheckPolicyComplianceIntent(userId, admin.info.getPackageName());
            Preconditions.checkArgument(timeoutMillis >= 0, "Timeout must be non-negative.");
            // Ensure the timeout is long enough to avoid having bad user experience.
            if (timeoutMillis > 0 && timeoutMillis < MANAGED_PROFILE_MAXIMUM_TIME_OFF_THRESHOLD
                    && !isAdminTestOnlyLocked(who, userId)) {
                timeoutMillis = MANAGED_PROFILE_MAXIMUM_TIME_OFF_THRESHOLD;
            }
            if (admin.mProfileMaximumTimeOffMillis == timeoutMillis) {
            if (admin.mProfileMaximumTimeOffMillis == timeoutMillis) {
                return;
                return;
            }
            }