Merge "Tweak FingerprintDialog" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b57843059a
@@ -71,7 +71,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
|
||||
* after this amount of time.
|
||||
* @hide
|
||||
*/
|
||||
public static final int HIDE_DIALOG_DELAY = 3000; // ms
|
||||
public static final int HIDE_DIALOG_DELAY = 2000; // ms
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@@ -166,7 +166,9 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
|
||||
}
|
||||
|
||||
/**
|
||||
* Required: Set the text for the negative button.
|
||||
* Required: Set the text for the negative button. This would typically be used as a
|
||||
* "Cancel" button, but may be also used to show an alternative method for authentication,
|
||||
* such as screen that asks for a backup password.
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -1155,9 +1155,14 @@ public class FingerprintManager implements BiometricFingerprintConstants {
|
||||
@Override // binder call
|
||||
public void onError(long deviceId, int error, int vendorCode) {
|
||||
if (mExecutor != null) {
|
||||
mExecutor.execute(() -> {
|
||||
sendErrorResult(deviceId, error, vendorCode);
|
||||
});
|
||||
// FingerprintDialog case, post a delayed runnable on the FingerprintManager handler
|
||||
// that sends the error message after FingerprintDialog.HIDE_DIALOG_DELAY to send
|
||||
// the error to the application.
|
||||
mHandler.postDelayed(() -> {
|
||||
mExecutor.execute(() -> {
|
||||
sendErrorResult(deviceId, error, vendorCode);
|
||||
});
|
||||
}, FingerprintDialog.HIDE_DIALOG_DELAY);
|
||||
} else {
|
||||
mHandler.obtainMessage(MSG_ERROR, error, vendorCode, deviceId).sendToTarget();
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ public class FingerprintDialogView extends LinearLayout {
|
||||
|
||||
private static final String TAG = "FingerprintDialogView";
|
||||
|
||||
private static final int ANIMATION_DURATION = 250; // ms
|
||||
private static final int ANIMATION_DURATION_SHOW = 250; // ms
|
||||
private static final int ANIMATION_DURATION_AWAY = 350; // ms
|
||||
|
||||
private static final int STATE_NONE = 0;
|
||||
private static final int STATE_FINGERPRINT = 1;
|
||||
@@ -164,8 +165,23 @@ public class FingerprintDialogView extends LinearLayout {
|
||||
|
||||
title.setText(mBundle.getCharSequence(FingerprintDialog.KEY_TITLE));
|
||||
title.setSelected(true);
|
||||
subtitle.setText(mBundle.getCharSequence(FingerprintDialog.KEY_SUBTITLE));
|
||||
description.setText(mBundle.getCharSequence(FingerprintDialog.KEY_DESCRIPTION));
|
||||
|
||||
final CharSequence subtitleText = mBundle.getCharSequence(FingerprintDialog.KEY_SUBTITLE);
|
||||
if (subtitleText == null) {
|
||||
subtitle.setVisibility(View.GONE);
|
||||
} else {
|
||||
subtitle.setVisibility(View.VISIBLE);
|
||||
subtitle.setText(subtitleText);
|
||||
}
|
||||
|
||||
final CharSequence descriptionText = mBundle.getCharSequence(FingerprintDialog.KEY_DESCRIPTION);
|
||||
if (descriptionText == null) {
|
||||
subtitle.setVisibility(View.VISIBLE);
|
||||
description.setVisibility(View.GONE);
|
||||
} else {
|
||||
description.setText(mBundle.getCharSequence(FingerprintDialog.KEY_DESCRIPTION));
|
||||
}
|
||||
|
||||
negative.setText(mBundle.getCharSequence(FingerprintDialog.KEY_NEGATIVE_TEXT));
|
||||
|
||||
final CharSequence positiveText =
|
||||
@@ -185,13 +201,13 @@ public class FingerprintDialogView extends LinearLayout {
|
||||
public void run() {
|
||||
mLayout.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(ANIMATION_DURATION)
|
||||
.setDuration(ANIMATION_DURATION_SHOW)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.withLayer()
|
||||
.start();
|
||||
mDialog.animate()
|
||||
.translationY(0)
|
||||
.setDuration(ANIMATION_DURATION)
|
||||
.setDuration(ANIMATION_DURATION_SHOW)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.withLayer()
|
||||
.start();
|
||||
@@ -221,13 +237,13 @@ public class FingerprintDialogView extends LinearLayout {
|
||||
public void run() {
|
||||
mLayout.animate()
|
||||
.alpha(0f)
|
||||
.setDuration(ANIMATION_DURATION)
|
||||
.setDuration(ANIMATION_DURATION_AWAY)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.withLayer()
|
||||
.start();
|
||||
mDialog.animate()
|
||||
.translationY(mAnimationTranslationOffset)
|
||||
.setDuration(ANIMATION_DURATION)
|
||||
.setDuration(ANIMATION_DURATION_AWAY)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.withLayer()
|
||||
.withEndAction(endActionRunnable)
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
|
||||
private final FingerprintManager mFingerprintManager;
|
||||
protected boolean mDialogDismissed;
|
||||
|
||||
// Receives events from SystemUI
|
||||
// Receives events from SystemUI and handles them before forwarding them to FingerprintDialog
|
||||
protected IFingerprintDialogReceiver mDialogReceiver = new IFingerprintDialogReceiver.Stub() {
|
||||
@Override // binder call
|
||||
public void onDialogDismissed(int reason) {
|
||||
|
||||
Reference in New Issue
Block a user