Fix the Fingerprint enrollment page's title text creates a truncate
problem when it needs three lines on the R4 device Add padding between title and lottie animation, and adjust UDFPS enroll view top margin. Bug: 269437675 Test: manually test, 1.Go to Go to Settings > Security > Fingerprint Unlock > Set up Fingerprint Unlock > How to set up your fingerprint > Touch & hold the fingerprint sensor , then to start enroll fingerprint. 2. Always keep the finger in the same position, then let the title become a three line description “Change the position of your fingerprint slightly each time”. 3. Check the UI if it has been fixed. Test: make RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings .biometrics.fingerprint.FingerprintEnrollEnrollingTest" Change-Id: Ib330e9fbe01b959892f2f9007ce35f5ab107e42e
This commit is contained in:
@@ -164,6 +164,7 @@
|
|||||||
<dimen name="sfps_lottie_translate_x">12dp</dimen>
|
<dimen name="sfps_lottie_translate_x">12dp</dimen>
|
||||||
<dimen name="sfps_lottie_translate_y">12dp</dimen>
|
<dimen name="sfps_lottie_translate_y">12dp</dimen>
|
||||||
<dimen name="udfps_lottie_translate_y">0dp</dimen>
|
<dimen name="udfps_lottie_translate_y">0dp</dimen>
|
||||||
|
<dimen name="udfps_lottie_padding_top">20dp</dimen>
|
||||||
|
|
||||||
<!-- Face -->
|
<!-- Face -->
|
||||||
<item name="face_preview_translate_y" format="float" type="dimen">0</item>
|
<item name="face_preview_translate_y" format="float" type="dimen">0</item>
|
||||||
|
@@ -63,6 +63,7 @@ import android.view.animation.AccelerateDecelerateInterpolator;
|
|||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
@@ -328,6 +329,23 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
final ViewGroup.LayoutParams containerLp =
|
final ViewGroup.LayoutParams containerLp =
|
||||||
portraitLayoutContainer.getLayoutParams();
|
portraitLayoutContainer.getLayoutParams();
|
||||||
containerLp.height = 0;
|
containerLp.height = 0;
|
||||||
|
|
||||||
|
// In the portrait mode, the title and lottie animation view may
|
||||||
|
// overlap when title needs three lines, so adding some paddings
|
||||||
|
// between them, and adjusting the fp progress view here accordingly.
|
||||||
|
final int layoutLottieAnimationPadding = (int) getResources()
|
||||||
|
.getDimension(R.dimen.udfps_lottie_padding_top);
|
||||||
|
portraitLayoutContainer.setPadding(0,
|
||||||
|
layoutLottieAnimationPadding, 0, 0);
|
||||||
|
final ImageView progressView = udfpsEnrollView.findViewById(
|
||||||
|
R.id.udfps_enroll_animation_fp_progress_view);
|
||||||
|
progressView.setPadding(0, -(layoutLottieAnimationPadding),
|
||||||
|
0, layoutLottieAnimationPadding);
|
||||||
|
final ImageView fingerprintView = udfpsEnrollView.findViewById(
|
||||||
|
R.id.udfps_enroll_animation_fp_view);
|
||||||
|
fingerprintView.setPadding(0, -layoutLottieAnimationPadding,
|
||||||
|
0, layoutLottieAnimationPadding);
|
||||||
|
|
||||||
portraitLayoutContainer.addView(udfpsEnrollView);
|
portraitLayoutContainer.addView(udfpsEnrollView);
|
||||||
setOnHoverListener(false, defaultLayout, udfpsEnrollView);
|
setOnHoverListener(false, defaultLayout, udfpsEnrollView);
|
||||||
} else if (rotation == Surface.ROTATION_270) {
|
} else if (rotation == Surface.ROTATION_270) {
|
||||||
|
@@ -43,6 +43,7 @@ import android.content.res.Configuration;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.hardware.biometrics.ComponentInfoInternal;
|
import android.hardware.biometrics.ComponentInfoInternal;
|
||||||
import android.hardware.biometrics.SensorProperties;
|
import android.hardware.biometrics.SensorProperties;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
@@ -58,6 +59,7 @@ import android.view.Surface;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.testutils.FakeFeatureFactory;
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
@@ -81,6 +83,7 @@ import org.robolectric.util.ReflectionHelpers;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class FingerprintEnrollEnrollingTest {
|
public class FingerprintEnrollEnrollingTest {
|
||||||
@@ -245,6 +248,78 @@ public class FingerprintEnrollEnrollingTest {
|
|||||||
.isEqualTo(progressColor);
|
.isEqualTo(progressColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fingerprintUdfpsOverlayEnrollment_checkViewOverlapPortrait() {
|
||||||
|
FeatureFlagUtils.setEnabled(mContext,
|
||||||
|
FeatureFlagUtils.SETTINGS_SHOW_UDFPS_ENROLL_IN_SETTINGS, true);
|
||||||
|
when(mMockDisplay.getRotation()).thenReturn(Surface.ROTATION_90);
|
||||||
|
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
||||||
|
|
||||||
|
final GlifLayout defaultLayout = mActivity.findViewById(R.id.setup_wizard_layout);
|
||||||
|
final TextView headerTextView = defaultLayout.getHeaderTextView();
|
||||||
|
final TextView descriptionTextView = defaultLayout.getDescriptionTextView();
|
||||||
|
final FrameLayout lottieAnimationContainer = mActivity.findViewById(R.id.layout_container);
|
||||||
|
final UdfpsEnrollView udfpsEnrollView =
|
||||||
|
defaultLayout.findViewById(R.id.udfps_animation_view);
|
||||||
|
|
||||||
|
final int[] headerTextViewPosition = new int[2];
|
||||||
|
final int[] descriptionTextViewPosition = new int[2];
|
||||||
|
final int[] lottieAnimationPosition = new int[2];
|
||||||
|
final int[] udfpsEnrollViewPosition = new int[2];
|
||||||
|
final AtomicReference<Rect> rectHeaderTextView = new AtomicReference<>(
|
||||||
|
new Rect(0, 0, 0, 0));
|
||||||
|
final AtomicReference<Rect> rectDescriptionTextView =
|
||||||
|
new AtomicReference<>(new Rect(0, 0, 0, 0));
|
||||||
|
final AtomicReference<Rect> rectLottieAnimationView = new AtomicReference<>(
|
||||||
|
new Rect(0, 0, 0, 0));
|
||||||
|
final AtomicReference<Rect> rectUdfpsEnrollView = new AtomicReference<>(
|
||||||
|
new Rect(0, 0, 0, 0));
|
||||||
|
|
||||||
|
headerTextView.getViewTreeObserver().addOnDrawListener(() -> {
|
||||||
|
headerTextView.getLocationOnScreen(headerTextViewPosition);
|
||||||
|
rectHeaderTextView.set(new Rect(headerTextViewPosition[0], headerTextViewPosition[1],
|
||||||
|
headerTextViewPosition[0] + headerTextView.getWidth(),
|
||||||
|
headerTextViewPosition[1] + headerTextView.getHeight()));
|
||||||
|
});
|
||||||
|
|
||||||
|
descriptionTextView.getViewTreeObserver().addOnDrawListener(() -> {
|
||||||
|
descriptionTextView.getLocationOnScreen(descriptionTextViewPosition);
|
||||||
|
rectDescriptionTextView.set(new Rect(descriptionTextViewPosition[0],
|
||||||
|
descriptionTextViewPosition[1], descriptionTextViewPosition[0]
|
||||||
|
+ descriptionTextView.getWidth(), descriptionTextViewPosition[1]
|
||||||
|
+ descriptionTextView.getHeight()));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
udfpsEnrollView.getViewTreeObserver().addOnDrawListener(() -> {
|
||||||
|
udfpsEnrollView.getLocationOnScreen(udfpsEnrollViewPosition);
|
||||||
|
rectUdfpsEnrollView.set(new Rect(udfpsEnrollViewPosition[0],
|
||||||
|
udfpsEnrollViewPosition[1], udfpsEnrollViewPosition[0]
|
||||||
|
+ udfpsEnrollView.getWidth(), udfpsEnrollViewPosition[1]
|
||||||
|
+ udfpsEnrollView.getHeight()));
|
||||||
|
});
|
||||||
|
|
||||||
|
lottieAnimationContainer.getViewTreeObserver().addOnDrawListener(() -> {
|
||||||
|
lottieAnimationContainer.getLocationOnScreen(lottieAnimationPosition);
|
||||||
|
rectLottieAnimationView.set(new Rect(lottieAnimationPosition[0],
|
||||||
|
lottieAnimationPosition[1], lottieAnimationPosition[0]
|
||||||
|
+ lottieAnimationContainer.getWidth(), lottieAnimationPosition[1]
|
||||||
|
+ lottieAnimationContainer.getHeight()));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if the HeaderTextView and DescriptionTextView overlapped
|
||||||
|
assertThat(rectHeaderTextView.get()
|
||||||
|
.intersect(rectDescriptionTextView.get())).isFalse();
|
||||||
|
|
||||||
|
// Check if the DescriptionTextView and Lottie animation overlapped
|
||||||
|
assertThat(rectDescriptionTextView.get()
|
||||||
|
.intersect(rectLottieAnimationView.get())).isFalse();
|
||||||
|
|
||||||
|
// Check if the Lottie animation and UDSPFEnrollView overlapped
|
||||||
|
assertThat(rectLottieAnimationView.get()
|
||||||
|
.intersect(rectUdfpsEnrollView.get())).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void forwardEnrollProgressEvents() {
|
public void forwardEnrollProgressEvents() {
|
||||||
FeatureFlagUtils.setEnabled(mContext,
|
FeatureFlagUtils.setEnabled(mContext,
|
||||||
|
Reference in New Issue
Block a user