Merge "Removed subtext from side fps enrollment flow" into udc-dev
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index f4c0b6a..fcf4a60 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -17,6 +17,7 @@
package com.android.settings.biometrics.fingerprint;
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_USER_CANCELED;
+import static android.text.Layout.HYPHENATION_FREQUENCY_NONE;
import android.animation.Animator;
import android.animation.ObjectAnimator;
@@ -341,7 +342,6 @@
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
} else if (mCanAssumeSfps) {
setContentView(R.layout.sfps_enroll_enrolling);
- setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
setHelpAnimation();
} else {
setContentView(R.layout.fingerprint_enroll_enrolling);
@@ -614,7 +614,7 @@
mIllustrationLottie.setContentDescription(
getString(R.string.security_settings_sfps_enroll_finger_center_title)
);
- configureEnrollmentStage("", R.raw.udfps_center_hint_lottie);
+ configureEnrollmentStage(R.raw.udfps_center_hint_lottie);
}
break;
@@ -628,7 +628,7 @@
getString(R.string.security_settings_fingerprint_enroll_repeat_message)
);
// TODO(b/228100413) Could customize guided lottie animation
- configureEnrollmentStage("", R.raw.udfps_center_hint_lottie);
+ configureEnrollmentStage(R.raw.udfps_center_hint_lottie);
}
break;
case STAGE_FINGERTIP:
@@ -638,7 +638,7 @@
mIllustrationLottie.setContentDescription(
getString(R.string.security_settings_udfps_tip_fingerprint_help)
);
- configureEnrollmentStage("", R.raw.udfps_tip_hint_lottie);
+ configureEnrollmentStage(R.raw.udfps_tip_hint_lottie);
}
break;
case STAGE_LEFT_EDGE:
@@ -648,7 +648,7 @@
mIllustrationLottie.setContentDescription(
getString(R.string.security_settings_udfps_side_fingerprint_help)
);
- configureEnrollmentStage("", R.raw.udfps_left_edge_hint_lottie);
+ configureEnrollmentStage(R.raw.udfps_left_edge_hint_lottie);
} else if (mIllustrationLottie == null) {
if (isStageHalfCompleted()) {
setDescriptionText(
@@ -665,7 +665,7 @@
mIllustrationLottie.setContentDescription(
getString(R.string.security_settings_udfps_side_fingerprint_help)
);
- configureEnrollmentStage("", R.raw.udfps_right_edge_hint_lottie);
+ configureEnrollmentStage(R.raw.udfps_right_edge_hint_lottie);
} else if (mIllustrationLottie == null) {
if (isStageHalfCompleted()) {
@@ -717,10 +717,7 @@
0
)
);
- configureEnrollmentStage(
- getString(R.string.security_settings_sfps_enroll_start_message),
- R.raw.sfps_lottie_no_animation
- );
+ configureEnrollmentStage(R.raw.sfps_lottie_no_animation);
}
break;
@@ -728,10 +725,7 @@
setHeaderText(R.string.security_settings_sfps_enroll_finger_center_title);
if (!mHaveShownSfpsCenterLottie && mIllustrationLottie != null) {
mHaveShownSfpsCenterLottie = true;
- configureEnrollmentStage(
- getString(R.string.security_settings_sfps_enroll_start_message),
- R.raw.sfps_lottie_pad_center
- );
+ configureEnrollmentStage(R.raw.sfps_lottie_pad_center);
}
break;
@@ -739,7 +733,7 @@
setHeaderText(R.string.security_settings_sfps_enroll_fingertip_title);
if (!mHaveShownSfpsTipLottie && mIllustrationLottie != null) {
mHaveShownSfpsTipLottie = true;
- configureEnrollmentStage("", R.raw.sfps_lottie_tip);
+ configureEnrollmentStage(R.raw.sfps_lottie_tip);
}
break;
@@ -747,7 +741,7 @@
setHeaderText(R.string.security_settings_sfps_enroll_left_edge_title);
if (!mHaveShownSfpsLeftEdgeLottie && mIllustrationLottie != null) {
mHaveShownSfpsLeftEdgeLottie = true;
- configureEnrollmentStage("", R.raw.sfps_lottie_left_edge);
+ configureEnrollmentStage(R.raw.sfps_lottie_left_edge);
}
break;
@@ -755,7 +749,7 @@
setHeaderText(R.string.security_settings_sfps_enroll_right_edge_title);
if (!mHaveShownSfpsRightEdgeLottie && mIllustrationLottie != null) {
mHaveShownSfpsRightEdgeLottie = true;
- configureEnrollmentStage("", R.raw.sfps_lottie_right_edge);
+ configureEnrollmentStage(R.raw.sfps_lottie_right_edge);
}
break;
@@ -766,7 +760,6 @@
// announce a different string for a11y upon entering the page.
getLayout().setHeaderText(
R.string.security_settings_sfps_enroll_find_sensor_title);
- setDescriptionText(R.string.security_settings_sfps_enroll_start_message);
final CharSequence description = getString(
R.string.security_settings_sfps_enroll_find_sensor_message);
getLayout().getHeaderTextView().setContentDescription(description);
@@ -776,8 +769,7 @@
}
}
- private void configureEnrollmentStage(CharSequence description, @RawRes int lottie) {
- setDescriptionText(description);
+ private void configureEnrollmentStage(@RawRes int lottie) {
LottieCompositionFactory.fromRawRes(this, lottie)
.addListener((c) -> {
mIllustrationLottie.setComposition(c);
@@ -995,16 +987,16 @@
}
private void showError(CharSequence error) {
- if (mCanAssumeUdfps || mCanAssumeSfps) {
+ if (mCanAssumeSfps) {
+ setHeaderText(error);
+ if (!mHelpAnimation.isRunning()) {
+ mHelpAnimation.start();
+ }
+ applySfpsErrorDynamicColors(getApplicationContext(), true);
+ } else if (mCanAssumeUdfps) {
setHeaderText(error);
// Show nothing for subtitle when getting an error message.
setDescriptionText("");
- if (mCanAssumeSfps) {
- if (!mHelpAnimation.isRunning()) {
- mHelpAnimation.start();
- }
- applySfpsErrorDynamicColors(getApplicationContext(), true);
- }
} else {
mErrorText.setText(error);
if (mErrorText.getVisibility() == View.INVISIBLE) {
@@ -1228,17 +1220,16 @@
final boolean isLandscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
if (mCanAssumeSfps) {
+ // hide the description
+ descriptionMixin.getTextView().setVisibility(View.GONE);
+ headerMixin.getTextView().setHyphenationFrequency(HYPHENATION_FREQUENCY_NONE);
if (isLandscape) {
headerMixin.setAutoTextSizeEnabled(true);
headerMixin.getTextView().setMinLines(0);
headerMixin.getTextView().setMaxLines(10);
- descriptionMixin.getTextView().setMinLines(0);
- descriptionMixin.getTextView().setMaxLines(10);
} else {
headerMixin.setAutoTextSizeEnabled(false);
headerMixin.getTextView().setLines(4);
- // hide the description
- descriptionMixin.getTextView().setLines(0);
}
}
}
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java
index 7be59dd..62230e2 100644
--- a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrollingTest.java
@@ -55,6 +55,7 @@
import android.util.FeatureFlagUtils;
import android.view.Display;
import android.view.Surface;
+import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -433,6 +434,28 @@
assertThat(appliedThemes.contains("SetupWizardPartnerResource")).isTrue();
}
+ @Test
+ public void fingerprintSfpsEnroll_descriptionTextVisibility() {
+ initializeActivityFor(TYPE_POWER_BUTTON);
+
+ mActivity.onEnrollmentProgressChange(1 /* steps */, 1 /* remaining */);
+
+ assertThat(getLayout().getDescriptionTextView().getVisibility()).isEqualTo(View.GONE);
+ }
+
+ @Test
+ public void fingerprintUdfpsEnroll_descriptionTextVisibility() {
+ initializeActivityFor(TYPE_UDFPS_OPTICAL);
+
+ mActivity.onEnrollmentProgressChange(1 /* steps */, 1 /* remaining */);
+
+ assertThat(getLayout().getDescriptionTextView().getVisibility()).isEqualTo(View.VISIBLE);
+ }
+
+ private GlifLayout getLayout() {
+ return (GlifLayout) mActivity.findViewById(R.id.setup_wizard_layout);
+ }
+
private void initializeActivityWithoutCreate(int sensorType) {
final List<ComponentInfoInternal> componentInfo = new ArrayList<>();
final FingerprintSensorPropertiesInternal prop =
@@ -465,6 +488,9 @@
doReturn(mSfpsStageThresholds[stage]).when(mActivity).getStageThresholdSteps(stage);
}
doReturn(true).when(mSidecar).isEnrolling();
+ ReflectionHelpers.setField(mActivity, "mCanAssumeSfps", true);
+ } else if (sensorType == TYPE_UDFPS_OPTICAL) {
+ ReflectionHelpers.setField(mActivity, "mCanAssumeUdfps", true);
}
if (sensorType == TYPE_UDFPS_OPTICAL) {