Do not set positive button visibility if dialog is from restored state

Also fix hidden dependency where positive button is enabled through
a dependency. Explicitly set visiblity where setEnabled occurs now.

Fixes: 132203917

Test: manual
Change-Id: Iba1e01a7c6b64a0f6a2721ddffac9d785981e9a0
This commit is contained in:
Kevin Chyn
2019-05-07 19:39:44 -07:00
parent 4b9f575018
commit 30c76081f5
2 changed files with 4 additions and 3 deletions

View File

@@ -92,6 +92,7 @@ public abstract class BiometricDialogView extends LinearLayout {
protected final int mTextColor;
private Bundle mBundle;
private Bundle mRestoredState;
private int mState;
private boolean mAnimatingAway;
@@ -286,7 +287,7 @@ public abstract class BiometricDialogView extends LinearLayout {
mNegativeButton.setText(mBundle.getCharSequence(BiometricPrompt.KEY_NEGATIVE_TEXT));
if (requiresConfirmation()) {
if (requiresConfirmation() && mRestoredState == null) {
mPositiveButton.setVisibility(View.VISIBLE);
mPositiveButton.setEnabled(false);
}
@@ -443,6 +444,7 @@ public abstract class BiometricDialogView extends LinearLayout {
if (newState == STATE_PENDING_CONFIRMATION) {
mHandler.removeMessages(MSG_CLEAR_MESSAGE);
mErrorText.setVisibility(View.INVISIBLE);
mPositiveButton.setVisibility(View.VISIBLE);
mPositiveButton.setEnabled(true);
} else if (newState == STATE_AUTHENTICATED) {
mPositiveButton.setVisibility(View.GONE);
@@ -465,6 +467,7 @@ public abstract class BiometricDialogView extends LinearLayout {
}
public void restoreState(Bundle bundle) {
mRestoredState = bundle;
mTryAgainButton.setVisibility(bundle.getInt(KEY_TRY_AGAIN_VISIBILITY));
mPositiveButton.setVisibility(bundle.getInt(KEY_CONFIRM_VISIBILITY));
}

View File

@@ -360,8 +360,6 @@ public class FaceDialogView extends BiometricDialogView {
if (show) {
mPositiveButton.setVisibility(View.GONE);
} else if (!show && requiresConfirmation()) {
mPositiveButton.setVisibility(View.VISIBLE);
}
}