Fix work profile screen timeout policy

Settings screen should apply both primary and managed maximum
timeout policy, even separate profile challenge is enabled.

Bug: 27493348
Change-Id: I09e815d6c6ae6ecd554316cfac82daf0ad0b0cdf
This commit is contained in:
Ricky Wai
2016-03-18 16:26:35 +00:00
parent 751de37275
commit 36cce830b9
3 changed files with 6 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ import android.hardware.SensorManager;
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;
@@ -302,7 +303,8 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
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);