Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I modify/disable the 30 second delay after trying the incorrect PIN 5 times? Device is a nexus 7 rooted running SmoothRom 4.4

share|improve this question
up vote 3 down vote accepted

This is possible to be done (infact, anything is possible in android. Thats the beauty and power Android has being open source :) ). You will need to edit android source code.

First, a little info. This text is a string that resides inside frameworks_base/packages/Keyguard/res/values/strings.xml in android source code.

The actual string declaration is:

<string name="kg_too_many_failed_attempts_countdown">Try again in <xliff:g id="number">%d</xliff:g> seconds.</string>

Now for how to edit this timeout.

The lockscreen controls are controlled by a library KeyguardSecurityContainer which resides in frameworks_base/packages/Keyguard/src/com/android/keyguard/

You need to edit this library.

The method that controls this timeout is showTimeoutDialog().

Although the code may slightly vary according to rom and android version.

For instance, in CM 12, its declared like this->

private void showTimeoutDialog() {
//This is likely the variable you need to assign your new value to
        int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
        int messageId = 0;

        switch (mSecurityModel.getSecurityMode()) {
            case Pattern:
                messageId = R.string.kg_too_many_failed_pattern_attempts_dialog_message;
            case PIN:
                messageId = R.string.kg_too_many_failed_pin_attempts_dialog_message;
            case Password:
                messageId = R.string.kg_too_many_failed_password_attempts_dialog_message;
            // These don't have timeout dialogs.
            case Account:
            case Biometric:
            case Invalid:
            case None:
            case SimPin:
            case SimPuk:

As you can see, you will need to assign your new value to variable timeoutInSeconds.

NOTE: Currently my laptop battery is quite low to compile and test the rom with edited or changed values. So this method is untested. Please perform any modifications at your own risk and after you have proper backups. At best, it could be a change in variable that controls the timeout (since I merely gave the this a quick reading). But this is the library that controls keyguard actions.

Also, on side note there might be some third party app that allows you to do this (although currently I do not know of any such app. But in case it exists...). I told you a direct way to mod your lockscreen guard.

Hope this helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.