Settings: Retain udfps overlay shown state on restoring activity
Prevent udfps view from disappearing if the activity is recreated due to theme or configuration change while enrolling fingerprint. Change-Id: I0bb0a3cf90c8119bab566fdb0f35db0ee858b75e Signed-off-by: Pranav Vashi <neobuddy89@gmail.com> Signed-off-by: Dmitrii <bankersenator@gmail.com>
This commit is contained in:
@@ -104,6 +104,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
static final String ICON_TOUCH_DIALOG = "fps_icon_touch_dialog";
|
||||
static final String KEY_STATE_CANCELED = "is_canceled";
|
||||
static final String KEY_STATE_PREVIOUS_ROTATION = "previous_rotation";
|
||||
static final String KEY_STATE_OVERLAY_SHOWN = "overlay_shown";
|
||||
|
||||
private static final int PROGRESS_BAR_MAX = 10000;
|
||||
|
||||
@@ -193,6 +194,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
private boolean mHaveShownSfpsLeftEdgeLottie;
|
||||
private boolean mHaveShownSfpsRightEdgeLottie;
|
||||
private boolean mShouldShowLottie;
|
||||
private boolean mOverlayShown;
|
||||
|
||||
private Animator mHelpAnimation;
|
||||
|
||||
@@ -379,12 +381,14 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(KEY_STATE_CANCELED, mIsCanceled);
|
||||
outState.putBoolean(KEY_STATE_OVERLAY_SHOWN, mOverlayShown);
|
||||
outState.putInt(KEY_STATE_PREVIOUS_ROTATION, mPreviousRotation);
|
||||
}
|
||||
|
||||
private void restoreSavedState(Bundle savedInstanceState) {
|
||||
mRestoring = true;
|
||||
mIsCanceled = savedInstanceState.getBoolean(KEY_STATE_CANCELED, false);
|
||||
mOverlayShown = savedInstanceState.getBoolean(KEY_STATE_OVERLAY_SHOWN, false);
|
||||
mPreviousRotation = savedInstanceState.getInt(KEY_STATE_PREVIOUS_ROTATION,
|
||||
getDisplay().getRotation());
|
||||
}
|
||||
@@ -398,6 +402,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
if (mRestoring) {
|
||||
startIconAnimation();
|
||||
}
|
||||
if (mOverlayShown) {
|
||||
onUdfpsOverlayShown();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupScreenFoldCallbackWhenNecessary() {
|
||||
@@ -443,6 +450,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
// showErrorDialog() will cause onWindowFocusChanged(false), set mIsCanceled to false
|
||||
// before showErrorDialog() to prevent that another error dialog is triggered again.
|
||||
mIsCanceled = true;
|
||||
mOverlayShown = false;
|
||||
FingerprintErrorDialog.showErrorDialog(this, errorMsgId,
|
||||
this instanceof SetupFingerprintEnrollEnrolling);
|
||||
cancelEnrollment();
|
||||
@@ -456,6 +464,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (!isChangingConfigurations()) {
|
||||
mOverlayShown = false;
|
||||
if (!WizardManagerHelper.isAnySetupWizard(getIntent())
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)
|
||||
&& !mFromSettingsSummary) {
|
||||
@@ -921,6 +930,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
public void onUdfpsOverlayShown() {
|
||||
if (mCanAssumeUdfps) {
|
||||
findViewById(R.id.udfps_animation_view).setVisibility(View.VISIBLE);
|
||||
mOverlayShown = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1095,6 +1105,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mOverlayShown = false;
|
||||
stopIconAnimation();
|
||||
|
||||
if (mProgressBar.getProgress() >= PROGRESS_BAR_MAX) {
|
||||
|
||||
Reference in New Issue
Block a user