Wait for systemui udfps overlay ready to show settings udfps enroll view.
Previously, we show settings's udfps enroll animation view (the fingerprint icon and progress view) once the FingerprintEnrollEnrolling is shown. However, touch events have to wait for systemui's udfps overlay to be valid. This CL lets settings's udfps enroll view wait for systemui's overlay. 1. Sets udfps enroll animation view's default visibility Gone. 2. Propagates FingerprintManager#onUdfpsOverlayShown to FingerprintEnrollEnrolling and when it's called, set the enroll view visible. Besides, this CL renames onPointerDown() and onPointerUp() with Udfps. Bug: 280718879 Test: atest FingerprintEnrollEnrollingTest Change-Id: Ieed3e74c182828918785edcacb021f19a3665f2a
This commit is contained in:
@@ -18,7 +18,8 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/udfps_animation_view"
|
android:id="@+id/udfps_animation_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/udfps_enroll_animation_fp_progress_view"
|
android:id="@+id/udfps_enroll_animation_fp_progress_view"
|
||||||
|
@@ -48,11 +48,16 @@ public abstract class BiometricEnrollSidecar extends InstrumentedFragment {
|
|||||||
/**
|
/**
|
||||||
* Called when a pointer down event has occurred.
|
* Called when a pointer down event has occurred.
|
||||||
*/
|
*/
|
||||||
default void onPointerDown(int sensorId) { }
|
default void onUdfpsPointerDown(int sensorId) { }
|
||||||
/**
|
/**
|
||||||
* Called when a pointer up event has occurred.
|
* Called when a pointer up event has occurred.
|
||||||
*/
|
*/
|
||||||
default void onPointerUp(int sensorId) { }
|
default void onUdfpsPointerUp(int sensorId) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when udfps overlay is shown.
|
||||||
|
*/
|
||||||
|
default void onUdfpsOverlayShown() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private int mEnrollmentSteps = -1;
|
private int mEnrollmentSteps = -1;
|
||||||
@@ -126,29 +131,36 @@ public abstract class BiometricEnrollSidecar extends InstrumentedFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class QueuedPointerDown extends QueuedEvent {
|
private class QueuedUdfpsPointerDown extends QueuedEvent {
|
||||||
private final int sensorId;
|
private final int sensorId;
|
||||||
|
|
||||||
public QueuedPointerDown(int sensorId) {
|
QueuedUdfpsPointerDown(int sensorId) {
|
||||||
this.sensorId = sensorId;
|
this.sensorId = sensorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(Listener listener) {
|
public void send(Listener listener) {
|
||||||
listener.onPointerDown(sensorId);
|
listener.onUdfpsPointerDown(sensorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class QueuedPointerUp extends QueuedEvent {
|
private class QueuedUdfpsPointerUp extends QueuedEvent {
|
||||||
private final int sensorId;
|
private final int sensorId;
|
||||||
|
|
||||||
public QueuedPointerUp(int sensorId) {
|
QueuedUdfpsPointerUp(int sensorId) {
|
||||||
this.sensorId = sensorId;
|
this.sensorId = sensorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(Listener listener) {
|
public void send(Listener listener) {
|
||||||
listener.onPointerUp(sensorId);
|
listener.onUdfpsPointerUp(sensorId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class QueuedUdfpsOverlayShown extends QueuedEvent {
|
||||||
|
@Override
|
||||||
|
public void send(Listener listener) {
|
||||||
|
listener.onUdfpsOverlayShown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,19 +261,27 @@ public abstract class BiometricEnrollSidecar extends InstrumentedFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPointerDown(int sensorId) {
|
protected void onUdfpsPointerDown(int sensorId) {
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.onPointerDown(sensorId);
|
mListener.onUdfpsPointerDown(sensorId);
|
||||||
} else {
|
} else {
|
||||||
mQueuedEvents.add(new QueuedPointerDown(sensorId));
|
mQueuedEvents.add(new QueuedUdfpsPointerDown(sensorId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPointerUp(int sensorId) {
|
protected void onUdfpsPointerUp(int sensorId) {
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.onPointerUp(sensorId);
|
mListener.onUdfpsPointerUp(sensorId);
|
||||||
} else {
|
} else {
|
||||||
mQueuedEvents.add(new QueuedPointerUp(sensorId));
|
mQueuedEvents.add(new QueuedUdfpsPointerUp(sensorId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onUdfpsOverlayShown() {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onUdfpsOverlayShown();
|
||||||
|
} else {
|
||||||
|
mQueuedEvents.add(new QueuedUdfpsOverlayShown());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -925,19 +925,26 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerDown(int sensorId) {
|
public void onUdfpsPointerDown(int sensorId) {
|
||||||
if (mUdfpsEnrollHelper != null) {
|
if (mUdfpsEnrollHelper != null) {
|
||||||
mUdfpsEnrollHelper.onPointerDown(sensorId);
|
mUdfpsEnrollHelper.onPointerDown(sensorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerUp(int sensorId) {
|
public void onUdfpsPointerUp(int sensorId) {
|
||||||
if (mUdfpsEnrollHelper != null) {
|
if (mUdfpsEnrollHelper != null) {
|
||||||
mUdfpsEnrollHelper.onPointerUp(sensorId);
|
mUdfpsEnrollHelper.onPointerUp(sensorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUdfpsOverlayShown() {
|
||||||
|
if (mCanAssumeUdfps) {
|
||||||
|
findViewById(R.id.udfps_animation_view).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateProgress(boolean animate) {
|
private void updateProgress(boolean animate) {
|
||||||
if (mSidecar == null || !mSidecar.isEnrolling()) {
|
if (mSidecar == null || !mSidecar.isEnrolling()) {
|
||||||
Log.d(TAG, "Enrollment not started yet");
|
Log.d(TAG, "Enrollment not started yet");
|
||||||
|
@@ -124,13 +124,18 @@ public class FingerprintEnrollSidecar extends BiometricEnrollSidecar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerDown(int sensorId) {
|
public void onUdfpsPointerDown(int sensorId) {
|
||||||
FingerprintEnrollSidecar.super.onPointerDown(sensorId);
|
FingerprintEnrollSidecar.super.onUdfpsPointerDown(sensorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerUp(int sensorId) {
|
public void onUdfpsPointerUp(int sensorId) {
|
||||||
FingerprintEnrollSidecar.super.onPointerUp(sensorId);
|
FingerprintEnrollSidecar.super.onUdfpsPointerUp(sensorId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUdfpsOverlayShown() {
|
||||||
|
FingerprintEnrollSidecar.super.onUdfpsOverlayShown();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -98,13 +98,18 @@ public class FingerprintUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerDown(int sensorId) {
|
public void onUdfpsPointerDown(int sensorId) {
|
||||||
mCallback.onPointerDown(sensorId);
|
mCallback.onUdfpsPointerDown(sensorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerUp(int sensorId) {
|
public void onUdfpsPointerUp(int sensorId) {
|
||||||
mCallback.onPointerUp(sensorId);
|
mCallback.onUdfpsPointerUp(sensorId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUdfpsOverlayShown() {
|
||||||
|
mCallback.onUdfpsOverlayShown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,236 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.biometrics.fingerprint;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.DisplayInfo;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.Surface;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.ColorInt;
|
||||||
|
|
||||||
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settingslib.udfps.UdfpsOverlayParams;
|
||||||
|
import com.android.settingslib.udfps.UdfpsUtils;
|
||||||
|
|
||||||
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
import com.google.android.setupdesign.view.BottomScrollView;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View for udfps enrolling.
|
||||||
|
*/
|
||||||
|
public class UdfpsEnrollEnrollingView extends GlifLayout {
|
||||||
|
private final UdfpsUtils mUdfpsUtils;
|
||||||
|
private final Context mContext;
|
||||||
|
// We don't need to listen to onConfigurationChanged() for mRotation here because
|
||||||
|
// FingerprintEnrollEnrolling is always recreated once the configuration is changed.
|
||||||
|
private final int mRotation;
|
||||||
|
private final boolean mIsLandscape;
|
||||||
|
private final boolean mShouldUseReverseLandscape;
|
||||||
|
private UdfpsEnrollView mUdfpsEnrollView;
|
||||||
|
private View mHeaderView;
|
||||||
|
private AccessibilityManager mAccessibilityManager;
|
||||||
|
|
||||||
|
|
||||||
|
public UdfpsEnrollEnrollingView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
mContext = context;
|
||||||
|
mRotation = mContext.getDisplay().getRotation();
|
||||||
|
mIsLandscape = mRotation == Surface.ROTATION_90 || mRotation == Surface.ROTATION_270;
|
||||||
|
final boolean isLayoutRtl = (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())
|
||||||
|
== View.LAYOUT_DIRECTION_RTL);
|
||||||
|
mShouldUseReverseLandscape = (mRotation == Surface.ROTATION_90 && isLayoutRtl)
|
||||||
|
|| (mRotation == Surface.ROTATION_270 && !isLayoutRtl);
|
||||||
|
|
||||||
|
mUdfpsUtils = new UdfpsUtils();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onFinishInflate() {
|
||||||
|
super.onFinishInflate();
|
||||||
|
mHeaderView = findViewById(R.id.sud_landscape_header_area);
|
||||||
|
mUdfpsEnrollView = findViewById(R.id.udfps_animation_view);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initView(FingerprintSensorPropertiesInternal udfpsProps,
|
||||||
|
UdfpsEnrollHelper udfpsEnrollHelper,
|
||||||
|
AccessibilityManager accessibilityManager) {
|
||||||
|
mAccessibilityManager = accessibilityManager;
|
||||||
|
initUdfpsEnrollView(udfpsProps, udfpsEnrollHelper);
|
||||||
|
|
||||||
|
if (!mIsLandscape) {
|
||||||
|
adjustPortraitPaddings();
|
||||||
|
} else if (mShouldUseReverseLandscape) {
|
||||||
|
swapHeaderAndContent();
|
||||||
|
}
|
||||||
|
setOnHoverListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSecondaryButtonBackground(@ColorInt int color) {
|
||||||
|
// Set the button background only when the button is not under udfps overlay to avoid UI
|
||||||
|
// overlap.
|
||||||
|
if (!mIsLandscape || mShouldUseReverseLandscape) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Button secondaryButtonView =
|
||||||
|
getMixin(FooterBarMixin.class).getSecondaryButtonView();
|
||||||
|
secondaryButtonView.setBackgroundColor(color);
|
||||||
|
if (mRotation == Surface.ROTATION_90) {
|
||||||
|
secondaryButtonView.setGravity(Gravity.START);
|
||||||
|
} else {
|
||||||
|
secondaryButtonView.setGravity(Gravity.END);
|
||||||
|
}
|
||||||
|
mHeaderView.post(() -> {
|
||||||
|
secondaryButtonView.setLayoutParams(
|
||||||
|
new LinearLayout.LayoutParams(mHeaderView.getMeasuredWidth(),
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUdfpsEnrollView(FingerprintSensorPropertiesInternal udfpsProps,
|
||||||
|
UdfpsEnrollHelper udfpsEnrollHelper) {
|
||||||
|
DisplayInfo displayInfo = new DisplayInfo();
|
||||||
|
mContext.getDisplay().getDisplayInfo(displayInfo);
|
||||||
|
|
||||||
|
final float scaleFactor = mUdfpsUtils.getScaleFactor(displayInfo);
|
||||||
|
Rect udfpsBounds = udfpsProps.getLocation().getRect();
|
||||||
|
udfpsBounds.scale(scaleFactor);
|
||||||
|
|
||||||
|
final Rect overlayBounds = new Rect(
|
||||||
|
0, /* left */
|
||||||
|
displayInfo.getNaturalHeight() / 2, /* top */
|
||||||
|
displayInfo.getNaturalWidth(), /* right */
|
||||||
|
displayInfo.getNaturalHeight() /* botom */);
|
||||||
|
|
||||||
|
UdfpsOverlayParams params = new UdfpsOverlayParams(
|
||||||
|
udfpsBounds,
|
||||||
|
overlayBounds,
|
||||||
|
displayInfo.getNaturalWidth(),
|
||||||
|
displayInfo.getNaturalHeight(),
|
||||||
|
scaleFactor,
|
||||||
|
displayInfo.rotation);
|
||||||
|
|
||||||
|
mUdfpsEnrollView.setOverlayParams(params);
|
||||||
|
mUdfpsEnrollView.setEnrollHelper(udfpsEnrollHelper);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void adjustPortraitPaddings() {
|
||||||
|
// In the portrait mode, layout_container's height is 0, so it's
|
||||||
|
// always shown at the bottom of the screen.
|
||||||
|
final FrameLayout portraitLayoutContainer = findViewById(R.id.layout_container);
|
||||||
|
|
||||||
|
// 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 = mUdfpsEnrollView.findViewById(
|
||||||
|
R.id.udfps_enroll_animation_fp_progress_view);
|
||||||
|
progressView.setPadding(0, -(layoutLottieAnimationPadding),
|
||||||
|
0, layoutLottieAnimationPadding);
|
||||||
|
final ImageView fingerprintView = mUdfpsEnrollView.findViewById(
|
||||||
|
R.id.udfps_enroll_animation_fp_view);
|
||||||
|
fingerprintView.setPadding(0, -layoutLottieAnimationPadding,
|
||||||
|
0, layoutLottieAnimationPadding);
|
||||||
|
|
||||||
|
// TODO(b/260970216) Instead of hiding the description text view, we should
|
||||||
|
// make the header view scrollable if the text is too long.
|
||||||
|
// If description text view has overlap with udfps progress view, hide it.
|
||||||
|
final View descView = getDescriptionTextView();
|
||||||
|
getViewTreeObserver().addOnDrawListener(() -> {
|
||||||
|
if (descView.getVisibility() == View.VISIBLE
|
||||||
|
&& hasOverlap(descView, mUdfpsEnrollView)) {
|
||||||
|
descView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setOnHoverListener() {
|
||||||
|
if (!mAccessibilityManager.isEnabled()) return;
|
||||||
|
|
||||||
|
final View.OnHoverListener onHoverListener = (v, event) -> {
|
||||||
|
// Map the touch to portrait mode if the device is in
|
||||||
|
// landscape mode.
|
||||||
|
final Point scaledTouch =
|
||||||
|
mUdfpsUtils.getTouchInNativeCoordinates(event.getPointerId(0),
|
||||||
|
event, mUdfpsEnrollView.getOverlayParams());
|
||||||
|
|
||||||
|
if (mUdfpsUtils.isWithinSensorArea(event.getPointerId(0), event,
|
||||||
|
mUdfpsEnrollView.getOverlayParams())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String theStr = mUdfpsUtils.onTouchOutsideOfSensorArea(
|
||||||
|
mAccessibilityManager.isTouchExplorationEnabled(), mContext,
|
||||||
|
scaledTouch.x, scaledTouch.y, mUdfpsEnrollView.getOverlayParams());
|
||||||
|
if (theStr != null) {
|
||||||
|
v.announceForAccessibility(theStr);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
findManagedViewById(mIsLandscape ? R.id.sud_landscape_content_area
|
||||||
|
: R.id.sud_layout_content).setOnHoverListener(onHoverListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void swapHeaderAndContent() {
|
||||||
|
// Reverse header and body
|
||||||
|
ViewGroup parentView = (ViewGroup) mHeaderView.getParent();
|
||||||
|
parentView.removeView(mHeaderView);
|
||||||
|
parentView.addView(mHeaderView);
|
||||||
|
|
||||||
|
// Hide scroll indicators
|
||||||
|
BottomScrollView headerScrollView = mHeaderView.findViewById(R.id.sud_header_scroll_view);
|
||||||
|
headerScrollView.setScrollIndicators(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
boolean hasOverlap(View view1, View view2) {
|
||||||
|
int[] firstPosition = new int[2];
|
||||||
|
int[] secondPosition = new int[2];
|
||||||
|
|
||||||
|
view1.getLocationOnScreen(firstPosition);
|
||||||
|
view2.getLocationOnScreen(secondPosition);
|
||||||
|
|
||||||
|
// Rect constructor parameters: left, top, right, bottom
|
||||||
|
Rect rectView1 = new Rect(firstPosition[0], firstPosition[1],
|
||||||
|
firstPosition[0] + view1.getMeasuredWidth(),
|
||||||
|
firstPosition[1] + view1.getMeasuredHeight());
|
||||||
|
Rect rectView2 = new Rect(secondPosition[0], secondPosition[1],
|
||||||
|
secondPosition[0] + view2.getMeasuredWidth(),
|
||||||
|
secondPosition[1] + view2.getMeasuredHeight());
|
||||||
|
return rectView1.intersect(rectView2);
|
||||||
|
}
|
||||||
|
}
|
@@ -103,12 +103,12 @@ public class FingerprintEnrollProgressViewModel extends AndroidViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerDown(int sensorId) {
|
public void onUdfpsPointerDown(int sensorId) {
|
||||||
mPointerDownLiveData.postValue(sensorId);
|
mPointerDownLiveData.postValue(sensorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPointerUp(int sensorId) {
|
public void onUdfpsPointerUp(int sensorId) {
|
||||||
mPointerUpLiveData.postValue(sensorId);
|
mPointerUpLiveData.postValue(sensorId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -339,6 +339,19 @@ public class FingerprintEnrollEnrollingTest {
|
|||||||
assertThat(descriptionTextView.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(descriptionTextView.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fingerprintUdfpsOverlayEnrollment_udfpsAnimationViewVisibility() {
|
||||||
|
initializeActivityWithoutCreate(TYPE_UDFPS_OPTICAL);
|
||||||
|
when(mMockDisplay.getRotation()).thenReturn(Surface.ROTATION_0);
|
||||||
|
createActivity();
|
||||||
|
|
||||||
|
final UdfpsEnrollView enrollView = mActivity.findViewById(R.id.udfps_animation_view);
|
||||||
|
assertThat(enrollView.getVisibility()).isEqualTo(View.GONE);
|
||||||
|
|
||||||
|
mActivity.onUdfpsOverlayShown();
|
||||||
|
assertThat(enrollView.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void forwardEnrollProgressEvents() {
|
public void forwardEnrollProgressEvents() {
|
||||||
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
||||||
@@ -380,11 +393,11 @@ public class FingerprintEnrollEnrollingTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void forwardEnrollPointerDownEvents() {
|
public void forwardUdfpsEnrollPointerDownEvents() {
|
||||||
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
||||||
|
|
||||||
EnrollListener listener = new EnrollListener(mActivity);
|
EnrollListener listener = new EnrollListener(mActivity);
|
||||||
mActivity.onPointerDown(0);
|
mActivity.onUdfpsPointerDown(0);
|
||||||
assertThat(listener.mProgress).isFalse();
|
assertThat(listener.mProgress).isFalse();
|
||||||
assertThat(listener.mHelp).isFalse();
|
assertThat(listener.mHelp).isFalse();
|
||||||
assertThat(listener.mAcquired).isFalse();
|
assertThat(listener.mAcquired).isFalse();
|
||||||
@@ -393,11 +406,11 @@ public class FingerprintEnrollEnrollingTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void forwardEnrollPointerUpEvents() {
|
public void forwardUdfpsEnrollPointerUpEvents() {
|
||||||
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
||||||
|
|
||||||
EnrollListener listener = new EnrollListener(mActivity);
|
EnrollListener listener = new EnrollListener(mActivity);
|
||||||
mActivity.onPointerUp(0);
|
mActivity.onUdfpsPointerUp(0);
|
||||||
assertThat(listener.mProgress).isFalse();
|
assertThat(listener.mProgress).isFalse();
|
||||||
assertThat(listener.mHelp).isFalse();
|
assertThat(listener.mHelp).isFalse();
|
||||||
assertThat(listener.mAcquired).isFalse();
|
assertThat(listener.mAcquired).isFalse();
|
||||||
|
@@ -379,7 +379,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
|||||||
|
|
||||||
// Notify acquire message
|
// Notify acquire message
|
||||||
final int value = 33;
|
final int value = 33;
|
||||||
mCallbackWrapper.mValue.onPointerDown(value);
|
mCallbackWrapper.mValue.onUdfpsPointerDown(value);
|
||||||
assertThat(liveData.getValue()).isEqualTo(value);
|
assertThat(liveData.getValue()).isEqualTo(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
|||||||
|
|
||||||
// Notify acquire message
|
// Notify acquire message
|
||||||
final int value = 44;
|
final int value = 44;
|
||||||
mCallbackWrapper.mValue.onPointerUp(value);
|
mCallbackWrapper.mValue.onUdfpsPointerUp(value);
|
||||||
assertThat(liveData.getValue()).isEqualTo(value);
|
assertThat(liveData.getValue()).isEqualTo(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user