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

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

Merge "Managed profile lock timeout"

parents 33055177 8e02f0e7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ public class TimeoutPreferenceController extends AbstractPreferenceController im
            final RestrictedLockUtils.EnforcedAdmin admin =
                    RestrictedLockUtils.checkIfMaximumTimeToLockIsSet(mContext);
            final long maxTimeout =
                    dpm.getMaximumTimeToLockForUserAndProfiles(UserHandle.myUserId());
                    dpm.getMaximumTimeToLock(null /* admin */, UserHandle.myUserId());
            timeoutListPreference.removeUnusableTimeouts(maxTimeout, admin);
        }
        updateTimeoutPreferenceDescription(timeoutListPreference, currentTimeout);
+2 −2
Original line number Diff line number Diff line
@@ -107,8 +107,8 @@ public class LockAfterTimeoutPreferenceController extends AbstractPreferenceCont
        if (mDPM != null) {
            final RestrictedLockUtils.EnforcedAdmin admin =
                    RestrictedLockUtils.checkIfMaximumTimeToLockIsSet(mContext);
            final long adminTimeout = mDPM
                    .getMaximumTimeToLockForUserAndProfiles(UserHandle.myUserId());
            final long adminTimeout =
                    mDPM.getMaximumTimeToLock(null /* admin */, UserHandle.myUserId());
            final long displayTimeout = Math.max(0,
                    Settings.System.getInt(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, 0));
            // This setting is a slave to display timeout when a device policy is enforced.
+2 −2
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ public class DevicePolicyManagerWrapper {
     *
     * @see DevicePolicyManager#getMaximumTimeToLock(ComponentName, int)
     */
    public long getMaximumTimeToLockForUserAndProfiles(@UserIdInt int userHandle) {
        return mDpm.getMaximumTimeToLockForUserAndProfiles(userHandle);
    public long getMaximumTimeToLock(@Nullable ComponentName admin, @UserIdInt int userHandle) {
        return mDpm.getMaximumTimeToLock(admin, userHandle);
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -88,8 +88,7 @@ public class TimeoutPreferenceControllerTest {
        final int profileUserId = UserHandle.myUserId();
        final long timeout = 10000;
        when(mUserManager.getProfiles(profileUserId)).thenReturn(Collections.emptyList());
        ShadowDevicePolicyManagerWrapper
                .setMaximumTimeToLockForUserAndProfiles(profileUserId, timeout);
        ShadowDevicePolicyManagerWrapper.setMaximumTimeToLock(profileUserId, timeout);

        mController.updateState(mPreference);
        verify(mPreference).removeUnusableTimeouts(timeout, null);
+1 −2
Original line number Diff line number Diff line
@@ -129,8 +129,7 @@ public class LockAfterTimeoutPreferenceControllerTest {
        when(mPreference.getEntryValues()).thenReturn(new CharSequence[] {"10000"} );

        Settings.System.putInt(mContext.getContentResolver(), SCREEN_OFF_TIMEOUT, displayTimeout);
        ShadowDevicePolicyManagerWrapper
                .setMaximumTimeToLockForUserAndProfiles(userId, adminTimeout);
        ShadowDevicePolicyManagerWrapper.setMaximumTimeToLock(userId, adminTimeout);

        mController.updateState((Preference) mPreference);

Loading