FileDocCategorySizeDatePackage
KeyguardAbsKeyInputView.javaAPI DocAndroid 5.1 API6869Thu Mar 12 22:22:42 GMT 2015com.android.keyguard

KeyguardAbsKeyInputView

public abstract class KeyguardAbsKeyInputView extends android.widget.LinearLayout implements KeyguardSecurityView
Base class for PIN and password unlock screens.

Fields Summary
protected KeyguardSecurityCallback
mCallback
protected com.android.internal.widget.LockPatternUtils
mLockPatternUtils
protected SecurityMessageDisplay
mSecurityMessageDisplay
protected android.view.View
mEcaView
private android.graphics.drawable.Drawable
mBouncerFrame
protected boolean
mEnableHaptics
protected static final int
MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT
Constructors Summary
public KeyguardAbsKeyInputView(android.content.Context context)


       
        this(context, null);
    
public KeyguardAbsKeyInputView(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
Methods Summary
public voiddoHapticKeyClick()

        if (mEnableHaptics) {
            performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
                    HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING
                    | HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
        }
    
public KeyguardSecurityCallbackgetCallback()

        return mCallback;
    
protected abstract java.lang.StringgetPasswordText()

protected abstract intgetPasswordTextViewId()

protected intgetWrongPasswordStringId()

        return R.string.kg_wrong_password;
    
protected voidhandleAttemptLockout(long elapsedRealtimeDeadline)

        setPasswordEntryEnabled(false);
        long elapsedRealtime = SystemClock.elapsedRealtime();
        new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, 1000) {

            @Override
            public void onTick(long millisUntilFinished) {
                int secondsRemaining = (int) (millisUntilFinished / 1000);
                mSecurityMessageDisplay.setMessage(
                        R.string.kg_too_many_failed_attempts_countdown, true, secondsRemaining);
            }

            @Override
            public void onFinish() {
                mSecurityMessageDisplay.setMessage("", false);
                resetState();
            }
        }.start();
    
public voidhideBouncer(int duration)

        KeyguardSecurityViewHelper.
                hideBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
    
public booleanneedsInput()

        return false;
    
protected voidonFinishInflate()

        mLockPatternUtils = new LockPatternUtils(mContext);
        mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
        mEcaView = findViewById(R.id.keyguard_selector_fade_container);
        View bouncerFrameView = findViewById(R.id.keyguard_bouncer_frame);
        if (bouncerFrameView != null) {
            mBouncerFrame = bouncerFrameView.getBackground();
        }
    
public booleanonKeyDown(int keyCode, android.view.KeyEvent event)

        mCallback.userActivity();
        return false;
    
public voidonPause()


    
public voidonResume(int reason)

        reset();
    
public voidreset()

        // start fresh
        resetPasswordText(false /* animate */);
        // if the user is currently locked out, enforce it.
        long deadline = mLockPatternUtils.getLockoutAttemptDeadline();
        if (shouldLockout(deadline)) {
            handleAttemptLockout(deadline);
        } else {
            resetState();
        }
    
protected abstract voidresetPasswordText(boolean animate)

protected abstract voidresetState()

public voidsetKeyguardCallback(KeyguardSecurityCallback callback)

        mCallback = callback;
    
public voidsetLockPatternUtils(com.android.internal.widget.LockPatternUtils utils)

        mLockPatternUtils = utils;
        mEnableHaptics = mLockPatternUtils.isTactileFeedbackEnabled();
    
protected abstract voidsetPasswordEntryEnabled(boolean enabled)

protected booleanshouldLockout(long deadline)

        return deadline != 0;
    
public voidshowBouncer(int duration)

        KeyguardSecurityViewHelper.
                showBouncer(mSecurityMessageDisplay, mEcaView, mBouncerFrame, duration);
    
public booleanstartDisappearAnimation(java.lang.Runnable finishRunnable)

        return false;
    
protected voidverifyPasswordAndUnlock()

        String entry = getPasswordText();
        if (mLockPatternUtils.checkPassword(entry)) {
            mCallback.reportUnlockAttempt(true);
            mCallback.dismiss(true);
        } else {
            if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT ) {
                // to avoid accidental lockout, only count attempts that are long enough to be a
                // real password. This may require some tweaking.
                mCallback.reportUnlockAttempt(false);
                int attempts = KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts();
                if (0 == (attempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
                    long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
                    handleAttemptLockout(deadline);
                }
            }
            mSecurityMessageDisplay.setMessage(getWrongPasswordStringId(), true);
        }
        resetPasswordText(true /* animate */);