From a01f882e61cf506a32a8aef5df7daabb00c54fc9 Mon Sep 17 00:00:00 2001 From: Mill Chen Date: Wed, 10 Mar 2021 19:46:13 +0800 Subject: [PATCH] Use title area for enrollment error messages This CL is trying to put the enrollment error messages into the title area for UDFPS, and left the red text for the older devices with a rear fingerprint. Fixes: 178432748 Test: visual verified Change-Id: Ib3a81531219dc963723ad0de99f079a230c580f5 --- .../biometrics/BiometricEnrollBase.java | 8 +++ .../FingerprintEnrollEnrolling.java | 52 ++++++++++++------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/com/android/settings/biometrics/BiometricEnrollBase.java b/src/com/android/settings/biometrics/BiometricEnrollBase.java index 3fb89411190..0fc41e6461e 100644 --- a/src/com/android/settings/biometrics/BiometricEnrollBase.java +++ b/src/com/android/settings/biometrics/BiometricEnrollBase.java @@ -173,10 +173,18 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity { setHeaderText(resId, false /* force */); } + protected void setHeaderText(CharSequence title) { + getLayout().setHeaderText(title); + } + protected void setDescriptionText(int resId) { getLayout().setDescriptionText(resId); } + protected void setDescriptionText(CharSequence descriptionText) { + getLayout().setDescriptionText(descriptionText); + } + protected FooterButton getNextButton() { if (mFooterBarMixin != null) { return mFooterBarMixin.getPrimaryButton(); diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java index b403e420189..10b31e331b9 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java @@ -324,7 +324,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { @Override public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) { if (!TextUtils.isEmpty(helpString)) { - mErrorText.removeCallbacks(mTouchAgainRunnable); + if (!mCanAssumeUdfps) { + mErrorText.removeCallbacks(mTouchAgainRunnable); + } showError(helpString); } } @@ -345,7 +347,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { } showErrorDialog(getText(msgId), errMsgId); stopIconAnimation(); - mErrorText.removeCallbacks(mTouchAgainRunnable); + if (!mCanAssumeUdfps) { + mErrorText.removeCallbacks(mTouchAgainRunnable); + } } @Override @@ -354,8 +358,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { updateTitleAndDescription(); clearError(); animateFlash(); - mErrorText.removeCallbacks(mTouchAgainRunnable); - mErrorText.postDelayed(mTouchAgainRunnable, HINT_TIMEOUT_DURATION); + if (!mCanAssumeUdfps) { + mErrorText.removeCallbacks(mTouchAgainRunnable); + mErrorText.postDelayed(mTouchAgainRunnable, HINT_TIMEOUT_DURATION); + } } private void updateProgress(boolean animate) { @@ -397,22 +403,28 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { } private void showError(CharSequence error) { - mErrorText.setText(error); - if (mErrorText.getVisibility() == View.INVISIBLE) { - mErrorText.setVisibility(View.VISIBLE); - mErrorText.setTranslationY(getResources().getDimensionPixelSize( - R.dimen.fingerprint_error_text_appear_distance)); - mErrorText.setAlpha(0f); - mErrorText.animate() - .alpha(1f) - .translationY(0f) - .setDuration(200) - .setInterpolator(mLinearOutSlowInInterpolator) - .start(); + if (mCanAssumeUdfps) { + setHeaderText(error); + // Show nothing for subtitle when getting an error message. + setDescriptionText(""); } else { - mErrorText.animate().cancel(); - mErrorText.setAlpha(1f); - mErrorText.setTranslationY(0f); + mErrorText.setText(error); + if (mErrorText.getVisibility() == View.INVISIBLE) { + mErrorText.setVisibility(View.VISIBLE); + mErrorText.setTranslationY(getResources().getDimensionPixelSize( + R.dimen.fingerprint_error_text_appear_distance)); + mErrorText.setAlpha(0f); + mErrorText.animate() + .alpha(1f) + .translationY(0f) + .setDuration(200) + .setInterpolator(mLinearOutSlowInInterpolator) + .start(); + } else { + mErrorText.animate().cancel(); + mErrorText.setAlpha(1f); + mErrorText.setTranslationY(0f); + } } if (isResumed()) { mVibrator.vibrate(VIBRATE_EFFECT_ERROR, FINGERPRINT_ENROLLING_SONFICATION_ATTRIBUTES); @@ -420,7 +432,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { } private void clearError() { - if (mErrorText.getVisibility() == View.VISIBLE) { + if (!mCanAssumeUdfps && mErrorText.getVisibility() == View.VISIBLE) { mErrorText.animate() .alpha(0f) .translationY(getResources().getDimensionPixelSize(