Merge "Wait for systemui udfps overlay ready to show settings udfps enroll view." into udc-qpr-dev
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/udfps_animation_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
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.
|
||||
*/
|
||||
default void onPointerDown(int sensorId) { }
|
||||
default void onUdfpsPointerDown(int sensorId) { }
|
||||
/**
|
||||
* 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;
|
||||
@@ -126,29 +131,36 @@ public abstract class BiometricEnrollSidecar extends InstrumentedFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private class QueuedPointerDown extends QueuedEvent {
|
||||
private class QueuedUdfpsPointerDown extends QueuedEvent {
|
||||
private final int sensorId;
|
||||
|
||||
public QueuedPointerDown(int sensorId) {
|
||||
QueuedUdfpsPointerDown(int sensorId) {
|
||||
this.sensorId = sensorId;
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
|
||||
public QueuedPointerUp(int sensorId) {
|
||||
QueuedUdfpsPointerUp(int sensorId) {
|
||||
this.sensorId = sensorId;
|
||||
}
|
||||
|
||||
@Override
|
||||
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) {
|
||||
mListener.onPointerDown(sensorId);
|
||||
mListener.onUdfpsPointerDown(sensorId);
|
||||
} else {
|
||||
mQueuedEvents.add(new QueuedPointerDown(sensorId));
|
||||
mQueuedEvents.add(new QueuedUdfpsPointerDown(sensorId));
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPointerUp(int sensorId) {
|
||||
protected void onUdfpsPointerUp(int sensorId) {
|
||||
if (mListener != null) {
|
||||
mListener.onPointerUp(sensorId);
|
||||
mListener.onUdfpsPointerUp(sensorId);
|
||||
} else {
|
||||
mQueuedEvents.add(new QueuedPointerUp(sensorId));
|
||||
mQueuedEvents.add(new QueuedUdfpsPointerUp(sensorId));
|
||||
}
|
||||
}
|
||||
|
||||
protected void onUdfpsOverlayShown() {
|
||||
if (mListener != null) {
|
||||
mListener.onUdfpsOverlayShown();
|
||||
} else {
|
||||
mQueuedEvents.add(new QueuedUdfpsOverlayShown());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -828,19 +828,26 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerDown(int sensorId) {
|
||||
public void onUdfpsPointerDown(int sensorId) {
|
||||
if (mUdfpsEnrollHelper != null) {
|
||||
mUdfpsEnrollHelper.onPointerDown(sensorId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerUp(int sensorId) {
|
||||
public void onUdfpsPointerUp(int sensorId) {
|
||||
if (mUdfpsEnrollHelper != null) {
|
||||
mUdfpsEnrollHelper.onPointerUp(sensorId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUdfpsOverlayShown() {
|
||||
if (mCanAssumeUdfps) {
|
||||
findViewById(R.id.udfps_animation_view).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateProgress(boolean animate) {
|
||||
if (mSidecar == null || !mSidecar.isEnrolling()) {
|
||||
Log.d(TAG, "Enrollment not started yet");
|
||||
|
@@ -124,13 +124,18 @@ public class FingerprintEnrollSidecar extends BiometricEnrollSidecar {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerDown(int sensorId) {
|
||||
FingerprintEnrollSidecar.super.onPointerDown(sensorId);
|
||||
public void onUdfpsPointerDown(int sensorId) {
|
||||
FingerprintEnrollSidecar.super.onUdfpsPointerDown(sensorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerUp(int sensorId) {
|
||||
FingerprintEnrollSidecar.super.onPointerUp(sensorId);
|
||||
public void onUdfpsPointerUp(int sensorId) {
|
||||
FingerprintEnrollSidecar.super.onUdfpsPointerUp(sensorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUdfpsOverlayShown() {
|
||||
FingerprintEnrollSidecar.super.onUdfpsOverlayShown();
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -98,13 +98,18 @@ public class FingerprintUpdater {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerDown(int sensorId) {
|
||||
mCallback.onPointerDown(sensorId);
|
||||
public void onUdfpsPointerDown(int sensorId) {
|
||||
mCallback.onUdfpsPointerDown(sensorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerUp(int sensorId) {
|
||||
mCallback.onPointerUp(sensorId);
|
||||
public void onUdfpsPointerUp(int sensorId) {
|
||||
mCallback.onUdfpsPointerUp(sensorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUdfpsOverlayShown() {
|
||||
mCallback.onUdfpsOverlayShown();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -86,7 +86,7 @@ public class UdfpsEnrollEnrollingView extends GlifLayout {
|
||||
UdfpsEnrollHelper udfpsEnrollHelper,
|
||||
AccessibilityManager accessibilityManager) {
|
||||
mAccessibilityManager = accessibilityManager;
|
||||
initUdfpsEnrollView(mUdfpsEnrollView, udfpsProps, udfpsEnrollHelper);
|
||||
initUdfpsEnrollView(udfpsProps, udfpsEnrollHelper);
|
||||
|
||||
if (!mIsLandscape) {
|
||||
adjustPortraitPaddings();
|
||||
@@ -117,8 +117,7 @@ public class UdfpsEnrollEnrollingView extends GlifLayout {
|
||||
});
|
||||
}
|
||||
|
||||
private void initUdfpsEnrollView(UdfpsEnrollView udfpsEnrollView,
|
||||
FingerprintSensorPropertiesInternal udfpsProps,
|
||||
private void initUdfpsEnrollView(FingerprintSensorPropertiesInternal udfpsProps,
|
||||
UdfpsEnrollHelper udfpsEnrollHelper) {
|
||||
DisplayInfo displayInfo = new DisplayInfo();
|
||||
mContext.getDisplay().getDisplayInfo(displayInfo);
|
||||
@@ -141,8 +140,8 @@ public class UdfpsEnrollEnrollingView extends GlifLayout {
|
||||
scaleFactor,
|
||||
displayInfo.rotation);
|
||||
|
||||
udfpsEnrollView.setOverlayParams(params);
|
||||
udfpsEnrollView.setEnrollHelper(udfpsEnrollHelper);
|
||||
mUdfpsEnrollView.setOverlayParams(params);
|
||||
mUdfpsEnrollView.setEnrollHelper(udfpsEnrollHelper);
|
||||
}
|
||||
|
||||
private void adjustPortraitPaddings() {
|
||||
|
@@ -103,12 +103,12 @@ public class FingerprintEnrollProgressViewModel extends AndroidViewModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerDown(int sensorId) {
|
||||
public void onUdfpsPointerDown(int sensorId) {
|
||||
mPointerDownLiveData.postValue(sensorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerUp(int sensorId) {
|
||||
public void onUdfpsPointerUp(int sensorId) {
|
||||
mPointerUpLiveData.postValue(sensorId);
|
||||
}
|
||||
};
|
||||
|
@@ -352,6 +352,19 @@ public class FingerprintEnrollEnrollingTest {
|
||||
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
|
||||
public void forwardEnrollProgressEvents() {
|
||||
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
||||
@@ -393,11 +406,11 @@ public class FingerprintEnrollEnrollingTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forwardEnrollPointerDownEvents() {
|
||||
public void forwardUdfpsEnrollPointerDownEvents() {
|
||||
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
||||
|
||||
EnrollListener listener = new EnrollListener(mActivity);
|
||||
mActivity.onPointerDown(0);
|
||||
mActivity.onUdfpsPointerDown(0);
|
||||
assertThat(listener.mProgress).isFalse();
|
||||
assertThat(listener.mHelp).isFalse();
|
||||
assertThat(listener.mAcquired).isFalse();
|
||||
@@ -406,11 +419,11 @@ public class FingerprintEnrollEnrollingTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forwardEnrollPointerUpEvents() {
|
||||
public void forwardUdfpsEnrollPointerUpEvents() {
|
||||
initializeActivityFor(TYPE_UDFPS_OPTICAL);
|
||||
|
||||
EnrollListener listener = new EnrollListener(mActivity);
|
||||
mActivity.onPointerUp(0);
|
||||
mActivity.onUdfpsPointerUp(0);
|
||||
assertThat(listener.mProgress).isFalse();
|
||||
assertThat(listener.mHelp).isFalse();
|
||||
assertThat(listener.mAcquired).isFalse();
|
||||
|
@@ -379,7 +379,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
||||
|
||||
// Notify acquire message
|
||||
final int value = 33;
|
||||
mCallbackWrapper.mValue.onPointerDown(value);
|
||||
mCallbackWrapper.mValue.onUdfpsPointerDown(value);
|
||||
assertThat(liveData.getValue()).isEqualTo(value);
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ public class FingerprintEnrollProgressViewModelTest {
|
||||
|
||||
// Notify acquire message
|
||||
final int value = 44;
|
||||
mCallbackWrapper.mValue.onPointerUp(value);
|
||||
mCallbackWrapper.mValue.onUdfpsPointerUp(value);
|
||||
assertThat(liveData.getValue()).isEqualTo(value);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user