diff --git a/res/layout/udfps_enroll_enrolling.xml b/res/layout/udfps_enroll_enrolling.xml
index 67c127b34bc..e9337538629 100644
--- a/res/layout/udfps_enroll_enrolling.xml
+++ b/res/layout/udfps_enroll_enrolling.xml
@@ -17,6 +17,7 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/res/raw/udfps_edge_hint_lottie.json b/res/raw/udfps_edge_hint_lottie.json
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/res/raw/udfps_tip_hint_lottie.json b/res/raw/udfps_tip_hint_lottie.json
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 00372cbee74..0a31c61808c 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -212,6 +212,7 @@
fingerprint_finish_max_size = fingerprint_progress_bar_max_size
+ (fingerprint_enrolling_content_margin_vertical x 2) -->
288dp
+ 0dp
- 0
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 73a0de88bd2..5ca4555ff22 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1113,6 +1113,10 @@
Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps
Do it later
+
+ Lift, then touch again
+
+ Place the side of your fingerprint on the sensor and hold, then switch to the other side
Skip fingerprint setup?
diff --git a/src/com/android/settings/biometrics/BiometricUtils.java b/src/com/android/settings/biometrics/BiometricUtils.java
index 5ee788095b4..febe3c6a93e 100644
--- a/src/com/android/settings/biometrics/BiometricUtils.java
+++ b/src/com/android/settings/biometrics/BiometricUtils.java
@@ -289,4 +289,14 @@ public class BiometricUtils {
}
return false;
}
+
+ /**
+ * Returns {@code true} if the screen is going into a landscape mode and the angle is equal to
+ * 90.
+ * @param context Context that we use to get the display this context is associated with
+ * @return True if the angle of the rotation is equal to 90.
+ */
+ public static boolean isLandscape(@NonNull Context context) {
+ return context.getDisplay().getRotation() == Surface.ROTATION_90;
+ }
}
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index c2bcee33428..d42e8f1c3aa 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -19,11 +19,13 @@ package com.android.settings.biometrics.fingerprint;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.annotation.IntDef;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.res.Configuration;
import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
@@ -54,7 +56,9 @@ import com.android.settings.biometrics.BiometricEnrollSidecar;
import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.biometrics.BiometricsEnrollEnrolling;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.display.DisplayDensityUtils;
+import com.airbnb.lottie.LottieAnimationView;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -126,6 +130,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
private boolean mIsSetupWizard;
private AccessibilityManager mAccessibilityManager;
private boolean mIsAccessibilityEnabled;
+ private LottieAnimationView mIllustrationLottie;
+ private boolean mHaveShownUdfpsTipLottie;
+ private boolean mHaveShownUdfpsSideLottie;
+ private boolean mShouldShowLottie;
private OrientationEventListener mOrientationEventListener;
private int mPreviousRotation = 0;
@@ -163,6 +171,20 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
}
+ DisplayDensityUtils displayDensity =
+ new DisplayDensityUtils(getApplicationContext());
+ int currentDensityIndex = displayDensity.getCurrentIndex();
+ final int currentDensity = displayDensity.getValues()[currentDensityIndex];
+ final int defaultDensity = displayDensity.getDefaultDensity();
+ mShouldShowLottie = defaultDensity == currentDensity;
+ // Only show the lottie if the current display density is the default density.
+ // Otherwise, the lottie will overlap with the settings header text.
+ boolean isLandscape = BiometricUtils.isReverseLandscape(getApplicationContext())
+ || BiometricUtils.isLandscape(getApplicationContext());
+
+ updateOrientation((isLandscape
+ ? Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT));
+
mErrorText = findViewById(R.id.error_text);
mProgressBar = findViewById(R.id.fingerprint_progress_bar);
mVibrator = getSystemService(Vibrator.class);
@@ -339,20 +361,34 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
case STAGE_FINGERTIP:
setHeaderText(R.string.security_settings_udfps_enroll_fingertip_title);
- if (isStageHalfCompleted()) {
- setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_title);
- } else {
+ if (!mHaveShownUdfpsTipLottie && mIllustrationLottie != null) {
+ mHaveShownUdfpsTipLottie = true;
setDescriptionText("");
+ mIllustrationLottie.setAnimation(R.raw.udfps_tip_hint_lottie);
+ mIllustrationLottie.setVisibility(View.VISIBLE);
+ mIllustrationLottie.playAnimation();
+ mIllustrationLottie.setContentDescription(
+ getString(R.string.security_settings_udfps_tip_fingerprint_help));
}
break;
case STAGE_EDGES:
setHeaderText(R.string.security_settings_udfps_enroll_edge_title);
- if (isStageHalfCompleted()) {
- setDescriptionText(
- R.string.security_settings_fingerprint_enroll_repeat_message);
- } else {
- setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
+ if (!mHaveShownUdfpsSideLottie && mIllustrationLottie != null) {
+ mHaveShownUdfpsSideLottie = true;
+ setDescriptionText("");
+ mIllustrationLottie.setAnimation(R.raw.udfps_edge_hint_lottie);
+ mIllustrationLottie.setVisibility(View.VISIBLE);
+ mIllustrationLottie.playAnimation();
+ mIllustrationLottie.setContentDescription(
+ getString(R.string.security_settings_udfps_side_fingerprint_help));
+ } else if (mIllustrationLottie == null) {
+ if (isStageHalfCompleted()) {
+ setDescriptionText(
+ R.string.security_settings_fingerprint_enroll_repeat_message);
+ } else {
+ setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
+ }
}
break;
@@ -634,6 +670,41 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
return SettingsEnums.FINGERPRINT_ENROLLING;
}
+ private void updateOrientation(int orientation) {
+ switch(orientation) {
+ case Configuration.ORIENTATION_LANDSCAPE: {
+ mIllustrationLottie = null;
+ break;
+ }
+ case Configuration.ORIENTATION_PORTRAIT: {
+ if (mShouldShowLottie) {
+ mIllustrationLottie = findViewById(R.id.illustration_lottie);
+ }
+ break;
+ }
+ default:
+ Log.e(TAG, "Error unhandled configuration change");
+ break;
+ }
+ }
+
+ @Override
+ public void onConfigurationChanged(@NonNull Configuration newConfig) {
+ switch(newConfig.orientation) {
+ case Configuration.ORIENTATION_LANDSCAPE: {
+ updateOrientation(Configuration.ORIENTATION_LANDSCAPE);
+ break;
+ }
+ case Configuration.ORIENTATION_PORTRAIT: {
+ updateOrientation(Configuration.ORIENTATION_PORTRAIT);
+ break;
+ }
+ default:
+ Log.e(TAG, "Error unhandled configuration change");
+ break;
+ }
+ }
+
public static class IconTouchDialog extends InstrumentedDialogFragment {
@Override