Merge commit '4e619a2d5051811262496e48ec99a0e916822d44' into gingerbread-plus-aosp * commit '4e619a2d5051811262496e48ec99a0e916822d44': Handle inactivity timeout > maximum allowed properly
This commit is contained in:
commit
fbf501fefd
@ -461,9 +461,6 @@ public class SecurityPolicy {
|
|||||||
if (passwordMode < PASSWORD_MODE_NONE || passwordMode > PASSWORD_MODE_STRONG) {
|
if (passwordMode < PASSWORD_MODE_NONE || passwordMode > PASSWORD_MODE_STRONG) {
|
||||||
throw new IllegalArgumentException("password mode");
|
throw new IllegalArgumentException("password mode");
|
||||||
}
|
}
|
||||||
if (maxScreenLockTime > SCREEN_LOCK_TIME_MAX) {
|
|
||||||
throw new IllegalArgumentException("screen lock time");
|
|
||||||
}
|
|
||||||
// This value can be reduced (which actually increases security) if necessary
|
// This value can be reduced (which actually increases security) if necessary
|
||||||
if (maxPasswordFails > PASSWORD_MAX_FAILS_MAX) {
|
if (maxPasswordFails > PASSWORD_MAX_FAILS_MAX) {
|
||||||
maxPasswordFails = PASSWORD_MAX_FAILS_MAX;
|
maxPasswordFails = PASSWORD_MAX_FAILS_MAX;
|
||||||
|
@ -33,7 +33,10 @@ import android.test.suitebuilder.annotation.SmallTest;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a series of unit tests for backup/restore of the SecurityPolicy class.
|
* This is a series of unit tests for backup/restore of the SecurityPolicy class.
|
||||||
*/
|
*
|
||||||
|
* You can run this entire test case with:
|
||||||
|
* runtest -c com.android.email.SecurityPolicyTests email
|
||||||
|
*/
|
||||||
@MediumTest
|
@MediumTest
|
||||||
public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> {
|
public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> {
|
||||||
|
|
||||||
@ -101,12 +104,12 @@ public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> {
|
|||||||
fail("Illegal password mode allowed");
|
fail("Illegal password mode allowed");
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
}
|
}
|
||||||
try {
|
PolicySet ps = new PolicySet(0, PolicySet.PASSWORD_MODE_NONE, 0,
|
||||||
new PolicySet(0, PolicySet.PASSWORD_MODE_NONE, 0,
|
PolicySet.SCREEN_LOCK_TIME_MAX + 1, false);
|
||||||
PolicySet.SCREEN_LOCK_TIME_MAX + 1, false);
|
assertEquals(PolicySet.SCREEN_LOCK_TIME_MAX, ps.getMaxScreenLockTime());
|
||||||
fail("Too-long screen lock time allowed");
|
ps = new PolicySet(0, PolicySet.PASSWORD_MODE_NONE,
|
||||||
} catch (IllegalArgumentException e) {
|
PolicySet.PASSWORD_MAX_FAILS_MAX + 1, 0, false);
|
||||||
}
|
assertEquals(PolicySet.PASSWORD_MAX_FAILS_MAX, ps.getMaxPasswordFails());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user