Clean up interface between controller and view
Fixes: 110753321
Test: tested with test app, no regression
Change-Id: I482d9733bc5e1380d251a82ad2747807608e6d6c
diff --git a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
index a81043e..5d8c5b9 100644
--- a/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/fingerprint/FingerprintDialogImpl.java
@@ -35,21 +35,20 @@
private static final String TAG = "FingerprintDialogImpl";
private static final boolean DEBUG = true;
- protected static final int MSG_SHOW_DIALOG = 1;
- protected static final int MSG_FINGERPRINT_AUTHENTICATED = 2;
- protected static final int MSG_FINGERPRINT_HELP = 3;
- protected static final int MSG_FINGERPRINT_ERROR = 4;
- protected static final int MSG_HIDE_DIALOG = 5;
- protected static final int MSG_BUTTON_NEGATIVE = 6;
- protected static final int MSG_USER_CANCELED = 7;
- protected static final int MSG_BUTTON_POSITIVE = 8;
- protected static final int MSG_CLEAR_MESSAGE = 9;
-
+ private static final int MSG_SHOW_DIALOG = 1;
+ private static final int MSG_FINGERPRINT_AUTHENTICATED = 2;
+ private static final int MSG_FINGERPRINT_HELP = 3;
+ private static final int MSG_FINGERPRINT_ERROR = 4;
+ private static final int MSG_FINGERPRINT_DIALOG = 5;
+ private static final int MSG_BUTTON_NEGATIVE = 6;
+ private static final int MSG_USER_CANCELED = 7;
+ private static final int MSG_BUTTON_POSITIVE = 8;
private FingerprintDialogView mDialogView;
private WindowManager mWindowManager;
private IBiometricPromptReceiver mReceiver;
private boolean mDialogShowing;
+ private Callback mCallback = new Callback();
private Handler mHandler = new Handler() {
@Override
@@ -79,13 +78,33 @@
case MSG_BUTTON_POSITIVE:
handleButtonPositive();
break;
- case MSG_CLEAR_MESSAGE:
- handleClearMessage();
- break;
}
}
};
+ private class Callback implements DialogViewCallback {
+ @Override
+ public void onUserCanceled() {
+ mHandler.obtainMessage(FingerprintDialogImpl.MSG_USER_CANCELED).sendToTarget();
+ }
+
+ @Override
+ public void onErrorShown() {
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_HIDE_DIALOG,
+ false /* userCanceled */), BiometricPrompt.HIDE_DIALOG_DELAY);
+ }
+
+ @Override
+ public void onNegativePressed() {
+ mHandler.obtainMessage(FingerprintDialogImpl.MSG_BUTTON_NEGATIVE).sendToTarget();
+ }
+
+ @Override
+ public void onPositivePressed() {
+ mHandler.obtainMessage(FingerprintDialogImpl.MSG_BUTTON_POSITIVE).sendToTarget();
+ }
+ }
+
@Override
public void start() {
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
@@ -93,7 +112,7 @@
}
getComponent(CommandQueue.class).addCallbacks(this);
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
- mDialogView = new FingerprintDialogView(mContext, mHandler);
+ mDialogView = new FingerprintDialogView(mContext, mCallback);
}
@Override
@@ -216,10 +235,6 @@
handleHideDialog(false /* userCanceled */);
}
- private void handleClearMessage() {
- mDialogView.resetMessage();
- }
-
private void handleUserCanceled() {
handleHideDialog(true /* userCanceled */);
}