Fix UI bugs for udfps enroll in settings.

This CL fixes four bugs for SETTINGS_SHOW_UDFPS_ENROLL_IN_SETTINGS feature:
1. When the udfps view is big enough (i.e. landscape mode on panther), the progress bar's bottom is clipped by the footer button.
- Sets the footer button width WRAP_CONTENT and removes the space view to make the footer button short enough, not hiding the udfps view progress bar.

2. When both text size and display icon size are big enough on the portrait mode, the udfps view's position is wrong because its parent views are longer than the screen and scrollable.
- Add addOnDrawListener() on udfps view's parent view, whenever it's changed, recalculate the margins of udfps view to make sure it's aligned  with the sensor's position.

3. When the finger is down on the screen and the lighting circle on the sensor is shown, the fingerprint icon is not hidden.
- Propagates FingerprintManager#onPointerDown and #onPointerUp to UdfpsEnrollView and hide/show fingerprint drawable accordingly.

4. When rotating the screen, fingerprint location is not right because UdfpsEnrollHelper is recreated.
- Makes UdfpsEnrollHelper a fragment and call setRetainInstance(true) to keep it even though the configuration is changed.

Test: manually tested on device:
      Turn this flag on via adb command
      adb shell setprop
        sys.fflag.override.settings_show_udfps_enroll_in_settings true
Bug: 260617060
Change-Id: I15ffde6455cab7e9d4a394349ec39e72df5b2911
This commit is contained in:
Hao Dong
2022-12-15 16:04:43 +00:00
parent 599ffd0f3f
commit 967203de77
6 changed files with 185 additions and 21 deletions

View File

@@ -45,6 +45,14 @@ public abstract class BiometricEnrollSidecar extends InstrumentedFragment {
* @param isAcquiredGood whether the fingerprint image was good.
*/
default void onAcquired(boolean isAcquiredGood) { }
/**
* Called when a pointer down event has occurred.
*/
default void onPointerDown(int sensorId) { }
/**
* Called when a pointer up event has occurred.
*/
default void onPointerUp(int sensorId) { }
}
private int mEnrollmentSteps = -1;
@@ -118,6 +126,32 @@ public abstract class BiometricEnrollSidecar extends InstrumentedFragment {
}
}
private class QueuedPointerDown extends QueuedEvent {
private final int sensorId;
public QueuedPointerDown(int sensorId) {
this.sensorId = sensorId;
}
@Override
public void send(Listener listener) {
listener.onPointerDown(sensorId);
}
}
private class QueuedPointerUp extends QueuedEvent {
private final int sensorId;
public QueuedPointerUp(int sensorId) {
this.sensorId = sensorId;
}
@Override
public void send(Listener listener) {
listener.onPointerUp(sensorId);
}
}
private final Runnable mTimeoutRunnable = new Runnable() {
@Override
public void run() {
@@ -215,6 +249,22 @@ public abstract class BiometricEnrollSidecar extends InstrumentedFragment {
}
}
protected void onPointerDown(int sensorId) {
if (mListener != null) {
mListener.onPointerDown(sensorId);
} else {
mQueuedEvents.add(new QueuedPointerDown(sensorId));
}
}
protected void onPointerUp(int sensorId) {
if (mListener != null) {
mListener.onPointerUp(sensorId);
} else {
mQueuedEvents.add(new QueuedPointerUp(sensorId));
}
}
public void setListener(Listener listener) {
mListener = listener;
if (mListener != null) {