am 4e619a2d: am 2b2b3448: Handle inactivity timeout > maximum allowed properly

Merge commit '4e619a2d5051811262496e48ec99a0e916822d44' into gingerbread-plus-aosp

* commit '4e619a2d5051811262496e48ec99a0e916822d44':
  Handle inactivity timeout > maximum allowed properly
This commit is contained in:
Marc Blank 2010-08-02 20:43:50 -07:00 committed by Android Git Automerger
commit fbf501fefd
2 changed files with 10 additions and 10 deletions

View File

@ -461,9 +461,6 @@ public class SecurityPolicy {
if (passwordMode < PASSWORD_MODE_NONE || passwordMode > PASSWORD_MODE_STRONG) {
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
if (maxPasswordFails > PASSWORD_MAX_FAILS_MAX) {
maxPasswordFails = PASSWORD_MAX_FAILS_MAX;

View File

@ -33,7 +33,10 @@ import android.test.suitebuilder.annotation.SmallTest;
/**
* 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
public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> {
@ -101,12 +104,12 @@ public class SecurityPolicyTests extends ProviderTestCase2<EmailProvider> {
fail("Illegal password mode allowed");
} catch (IllegalArgumentException e) {
}
try {
new PolicySet(0, PolicySet.PASSWORD_MODE_NONE, 0,
PolicySet.SCREEN_LOCK_TIME_MAX + 1, false);
fail("Too-long screen lock time allowed");
} catch (IllegalArgumentException e) {
}
PolicySet ps = new PolicySet(0, PolicySet.PASSWORD_MODE_NONE, 0,
PolicySet.SCREEN_LOCK_TIME_MAX + 1, false);
assertEquals(PolicySet.SCREEN_LOCK_TIME_MAX, ps.getMaxScreenLockTime());
ps = new PolicySet(0, PolicySet.PASSWORD_MODE_NONE,
PolicySet.PASSWORD_MAX_FAILS_MAX + 1, 0, false);
assertEquals(PolicySet.PASSWORD_MAX_FAILS_MAX, ps.getMaxPasswordFails());
}
/**