Loading core/java/android/app/admin/DevicePolicyManager.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -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 services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -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"; Loading Loading @@ -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; } } Loading
core/java/android/app/admin/DevicePolicyManager.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -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
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -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"; Loading Loading @@ -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; } }