Settings screen should apply both primary and managed maximum
timeout policy, even separate profile challenge is enabled.
Bug:
27493348
Change-Id: I09e815d6c6ae6ecd554316cfac82daf0ad0b0cdf
return;
}
- if (mDpm.getMaximumTimeToLock(null) > 0) {
+ if (mDpm.getMaximumTimeToLockForUserAndProfiles(UserHandle.myUserId()) > 0) {
// A DeviceAdmin has specified a maximum time until the device
// will lock... in this case we can't allow the user to turn
// on "stay awake when plugged in" because that would defeat the
import android.os.Build;
import android.os.Bundle;
import android.os.SystemProperties;
+import android.os.UserHandle;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.support.v14.preference.SwitchPreference;
if (dpm != null) {
final EnforcedAdmin admin = RestrictedLockUtils.checkIfMaximumTimeToLockIsSet(
getActivity());
- final long maxTimeout = dpm.getMaximumTimeToLock(null);
+ final long maxTimeout = dpm
+ .getMaximumTimeToLockForUserAndProfiles(UserHandle.myUserId());
mScreenTimeoutPreference.removeUnusableTimeouts(maxTimeout, admin);
}
updateTimeoutPreferenceDescription(currentTimeout);
if (mDPM != null) {
final EnforcedAdmin admin = RestrictedLockUtils.checkIfMaximumTimeToLockIsSet(
getActivity());
- final long adminTimeout = mDPM.getMaximumTimeToLock(null);
+ final long adminTimeout = mDPM
+ .getMaximumTimeToLockForUserAndProfiles(UserHandle.myUserId());
final long displayTimeout = Math.max(0,
Settings.System.getInt(getContentResolver(), SCREEN_OFF_TIMEOUT, 0));
// This setting is a slave to display timeout when a device policy is enforced.