Ensure that cancelling authentication ends up in the correct state

When authentication is canceled from the caller (not by the system),
BiometricService should do the following
1) Inform SystemUI to hide the dialog
2) Send the onError callback to the calling application

SystemUI does not need to send any callbacks (avoid round trip)

Bug: 146234687

Test: com.android.server.biometrics
Test: com.android.systemui.biometrics

Change-Id: Icd3e07d4921870e1e63e125c48caaaa759af2d36
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
index 0eb2023..e0ca1ac 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
@@ -341,6 +341,10 @@
         if (DEBUG) Log.d(TAG, "hideAuthenticationDialog");
 
         mCurrentDialog.dismissFromSystemServer();
+
+        // BiometricService will have already sent the callback to the client in this case.
+        // This avoids a round trip to SystemUI. So, just dismiss the dialog and we're done.
+        mCurrentDialog = null;
     }
 
     private void showDialog(SomeArgs args, boolean skipAnimation, Bundle savedState) {