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

Commit 305093f9 authored by Jim Miller's avatar Jim Miller
Browse files

Fix 3005526: Properly update StatusView from Password/PIN unlock

This uses the newly added setHelpMessage() to properly show PIN and
password help in StatusView.

Change-Id: I8662e179e989c6e72f657c81f23b1b2fa7982727
parent cf18c478
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -135,9 +135,12 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
        // numeric keys.
        if (mIsAlpha) {
            mPasswordEntry.setKeyListener(TextKeyListener.getInstance());
            mStatusView.setHelpMessage(R.string.keyguard_password_enter_password_code,
                    StatusView.LOCK_ICON);
        } else {
            mPasswordEntry.setKeyListener(DigitsKeyListener.getInstance());
            mStatusView.setInstructionText(R.string.keyguard_password_enter_pin_password_code);
            mStatusView.setHelpMessage(R.string.keyguard_password_enter_pin_code,
                    StatusView.LOCK_ICON);
        }

        mKeyboardHelper.setVibratePattern(mLockPatternUtils.isTactileFeedbackEnabled() ?
@@ -151,6 +154,11 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
        mStatusView.setCarrierText(LockScreen.getCarrierString(
                        mUpdateMonitor.getTelephonyPlmn(),
                        mUpdateMonitor.getTelephonySpn()));

        mUpdateMonitor.registerInfoCallback(this);
        //mUpdateMonitor.registerSimStateCallback(this);

        resetStatusInfo();
    }

    @Override
@@ -204,6 +212,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
        if (mLockPatternUtils.checkPassword(entry)) {
            mCallback.keyguardDone(true);
            mCallback.reportSuccessfulUnlockAttempt();
            mStatusView.setInstructionText(null);
        } 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.
@@ -316,11 +325,8 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
    }

    private void resetStatusInfo() {
        if(mIsAlpha) {
            mStatusView.setInstructionText(R.string.keyguard_password_enter_password_code);
        } else {
            mStatusView.setInstructionText(R.string.keyguard_password_enter_pin_password_code);
        }
        mStatusView.setInstructionText(null);
        mStatusView.updateStatusLines(true);
    }

}
+4 −5
Original line number Diff line number Diff line
@@ -125,13 +125,13 @@ class StatusView {
    void setInstructionText(int stringId) {
        mStatus1.setText(stringId);
        mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0);
        mStatus1.setVisibility(View.VISIBLE);
        mStatus1.setVisibility(stringId != 0 ? View.VISIBLE : View.INVISIBLE);
    }

    void setInstructionText(String string) {
        mStatus1.setText(string);
        mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0);
        mStatus1.setVisibility(View.VISIBLE);
        mStatus1.setVisibility(TextUtils.isEmpty(string) ? View.INVISIBLE : View.VISIBLE);
    }

    void setCarrierText(int stringId) {
@@ -177,11 +177,10 @@ class StatusView {
        }

        // Update Status1
        if (mInstructions != null) {
        if (!TextUtils.isEmpty(mInstructions)) {
            // Instructions only
            final int resId = TextUtils.isEmpty(mInstructions) ? 0 : LOCK_ICON;
            mStatus1.setText(mInstructions);
            mStatus1.setCompoundDrawablesWithIntrinsicBounds(resId, 0, 0, 0);
            mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0);
            mStatus1.setVisibility(View.VISIBLE);
        } else if (mShowingBatteryInfo) {
            // Battery status