Biometrics v2 RFPS enrolling refine

1. Fix back key in enrolling page
2. Fix 0.5 sec black screen if user presses skip

Bug: 260957939
Test: atest FingerprintEnrollmentActivity
Change-Id: If5308246ed380c2e3dd12f19f13aa38fc8c178a8
This commit is contained in:
Milton Wu
2023-02-14 11:08:13 +08:00
parent 56f1eb0fbf
commit f7845d823b
5 changed files with 98 additions and 42 deletions

View File

@@ -71,11 +71,17 @@ public class FingerprintEnrollEnrollingViewModel extends AndroidViewModel {
*/
public static final int FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG = 3;
/**
* Has got latest cancelled event due to back key
*/
public static final int FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED = 4;
@IntDef(prefix = { "FINGERPRINT_ENROLL_ENROLLING_ACTION_" }, value = {
FINGERPRINT_ENROLL_ENROLLING_ACTION_SKIP,
FINGERPRINT_ENROLL_ENROLLING_ACTION_DONE,
FINGERPRINT_ENROLL_ENROLLING_ACTION_SHOW_ICON_TOUCH_DIALOG,
FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG
FINGERPRINT_ENROLL_ENROLLING_ACTION_DISMISS_ICON_TOUCH_DIALOG,
FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED
})
@Retention(RetentionPolicy.SOURCE)
public @interface FingerprintEnrollEnrollingAction {}
@@ -103,8 +109,9 @@ public class FingerprintEnrollEnrollingViewModel extends AndroidViewModel {
@Retention(RetentionPolicy.SOURCE)
public @interface FingerprintErrorDialogAction {}
private final int mUserId;
private boolean mOnBackPressed;
private boolean mOnSkipPressed;
private final FingerprintRepository mFingerprintRepository;
private final AccessibilityRepository mAccessibilityRepository;
private final VibratorRepository mVibratorRepository;
@@ -162,14 +169,26 @@ public class FingerprintEnrollEnrollingViewModel extends AndroidViewModel {
mErrorDialogActionLiveData.postValue(action);
}
public boolean getOnSkipPressed() {
return mOnSkipPressed;
}
/**
* User clicks skip button
*/
public void onSkipButtonClick() {
public void setOnSkipPressed() {
mOnSkipPressed = true;
}
/**
* Enrolling is cacelled because user clicks skip
*/
public void onCancelledDueToOnSkipPressed() {
final int action = FINGERPRINT_ENROLL_ENROLLING_ACTION_SKIP;
if (DEBUG) {
Log.d(TAG, "onSkipButtonClick, post action " + action);
}
mOnSkipPressed = false;
mActionLiveData.postValue(action);
}
@@ -184,6 +203,29 @@ public class FingerprintEnrollEnrollingViewModel extends AndroidViewModel {
mActionLiveData.postValue(action);
}
public boolean getOnBackPressed() {
return mOnBackPressed;
}
/**
* Back key is pressed.
*/
public void setOnBackPressed() {
mOnBackPressed = true;
}
/**
* Enrollment is cancelled because back key is pressed.
*/
public void onCancelledDueToOnBackPressed() {
final int action = FINGERPRINT_ENROLL_ENROLLING_CANCELED_BECAUSE_BACK_PRESSED;
if (DEBUG) {
Log.d(TAG, "onCancelledEventReceivedAfterOnBackPressed, post action " + action);
}
mOnBackPressed = false;
mActionLiveData.postValue(action);
}
/**
* Icon touch dialog show
*/