6/n: Have FaceService extend BiometricService

In the Service layer, this change is pretty much the same as ag/4340638.
FingerprintService already extends BiometricService which contains all
of the common code. FaceService now does the same after this change.

Updated the Manager layer to use the infrastructure added in P, namely
  - Private APIs for BiometricPrompt
  - Removed FaceManager#CryptoObject, use biometrics/CryptoObject directly
  - Few other BiometricAuthenticator things

Bug: 110387294

Test: enrolling FP still works
Test: removing FP still works
Test: changing FP name persists across reboots
Test: enumerating still works (extra framework fp, extra hw fp)
Test: keyguard still receives lockout reset callbacks

Change-Id: I2195b08e28d024a120df56fe87b0dd4f9b96505a
diff --git a/services/core/java/com/android/server/biometrics/common/AuthenticationClient.java b/services/core/java/com/android/server/biometrics/common/AuthenticationClient.java
index 1ed2847..6e5858a 100644
--- a/services/core/java/com/android/server/biometrics/common/AuthenticationClient.java
+++ b/services/core/java/com/android/server/biometrics/common/AuthenticationClient.java
@@ -17,6 +17,7 @@
 package com.android.server.biometrics.common;
 
 import android.content.Context;
+import android.hardware.biometrics.BiometricAuthenticator;
 import android.hardware.biometrics.BiometricConstants;
 import android.hardware.biometrics.BiometricPrompt;
 import android.hardware.biometrics.IBiometricPromptReceiver;
@@ -60,7 +61,7 @@
                 try {
                     mDialogReceiverFromClient.onDialogDismissed(reason);
                     if (reason == BiometricPrompt.DISMISSED_REASON_USER_CANCEL) {
-                        onError(BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED,
+                        onError(getHalDeviceId(), BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED,
                                 0 /* vendorCode */);
                     }
                     mDialogDismissed = true;
@@ -132,7 +133,7 @@
     }
 
     @Override
-    public boolean onError(int error, int vendorCode) {
+    public boolean onError(long deviceId, int error, int vendorCode) {
         if (mDialogDismissed) {
             // If user cancels authentication, the application has already received the
             // FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED message from onDialogDismissed()
@@ -148,7 +149,7 @@
                 Slog.e(getLogTag(), "Remote exception when sending error", e);
             }
         }
-        return super.onError(error, vendorCode);
+        return super.onError(deviceId, error, vendorCode);
     }
 
     @Override
@@ -246,7 +247,8 @@
             if (result != 0) {
                 Slog.w(getLogTag(), "startAuthentication failed, result=" + result);
                 mMetricsLogger.histogram(mMetrics.tagAuthStartError(), result);
-                onError(BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE, 0 /* vendorCode */);
+                onError(getHalDeviceId(), BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE,
+                        0 /* vendorCode */);
                 return result;
             }
             if (DEBUG) Slog.w(getLogTag(), "client " + getOwnerString() + " is authenticating...");
@@ -304,19 +306,21 @@
     }
 
     @Override
-    public boolean onEnrollResult(int fingerId, int groupId, int remaining) {
+    public boolean onEnrollResult(BiometricAuthenticator.Identifier identifier,
+            int remaining) {
         if (DEBUG) Slog.w(getLogTag(), "onEnrollResult() called for authenticate!");
         return true; // Invalid for Authenticate
     }
 
     @Override
-    public boolean onRemoved(int fingerId, int groupId, int remaining) {
+    public boolean onRemoved(BiometricAuthenticator.Identifier identifier, int remaining) {
         if (DEBUG) Slog.w(getLogTag(), "onRemoved() called for authenticate!");
         return true; // Invalid for Authenticate
     }
 
     @Override
-    public boolean onEnumerationResult(int fingerId, int groupId, int remaining) {
+    public boolean onEnumerationResult(BiometricAuthenticator.Identifier identifier,
+            int remaining) {
         if (DEBUG) Slog.w(getLogTag(), "onEnumerationResult() called for authenticate!");
         return true; // Invalid for Authenticate
     }