Clean up FingerprintManager API and make it public.

Change-Id: I416dcc42fd70926875cc77e0c2cc958fdfcd9f9d
diff --git a/include/hardware/fingerprint.h b/include/hardware/fingerprint.h
index 1fe8cc9..1d190a6 100644
--- a/include/hardware/fingerprint.h
+++ b/include/hardware/fingerprint.h
@@ -154,16 +154,26 @@
     int (*enroll)(struct fingerprint_device *dev, uint32_t gid, uint32_t timeout_sec);
 
     /*
-     * Cancel fingerprint enroll request:
-     * Switches the HAL state machine back to accept a fingerprint scan mode.
-     * (fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENROLLING &&
-     *  fingerprint_msg.data.enroll.samples_remaining == 0)
+     * Fingerprint pre-enroll enroll request:
+     * Generates a unique token to upper layers to indicate the start of an enrollment transaction.
+     * This token will be wrapped by security for verification and passed to enroll() for
+     * verification before enrollment will be allowed. This is to ensure adding a new fingerprint
+     * template was preceded by some kind of credential confirmation (e.g. device password).
+     *
+     * Function return: 0 if function failed
+     *                  otherwise, a uint64_t of token
+     */
+    uint64_t (*pre_enroll)(struct fingerprint_device *dev);
+
+    /*
+     * Cancel pending enroll or authenticate, sending FINGERPRINT_ERROR_CANCELED
+     * to all running clients. Switches the HAL state machine back to the idle state.
      * will indicate switch back to the scan mode.
      *
      * Function return: 0 if cancel request is accepted
      *                 -1 otherwise.
      */
-    int (*enroll_cancel)(struct fingerprint_device *dev);
+    int (*cancel)(struct fingerprint_device *dev);
 
     /*
      * Fingerprint remove request:
@@ -193,7 +203,7 @@
      * Authenticates an operation identifed by operation_id
      *
      * Function return: 0 on success
-     *                 -1 if the size is out of bounds.
+     *                 -1 if the operation cannot be completed
      */
     int (*authenticate)(struct fingerprint_device *dev, uint64_t operation_id, uint32_t gid);
 
@@ -206,8 +216,7 @@
      * Function return: 0 if callback function is successfuly registered
      *                 -1 otherwise.
      */
-    int (*set_notify)(struct fingerprint_device *dev,
-                        fingerprint_notify_t notify);
+    int (*set_notify)(struct fingerprint_device *dev, fingerprint_notify_t notify);
 
     /*
      * Client provided callback function to receive notifications.
diff --git a/modules/fingerprint/fingerprint.c b/modules/fingerprint/fingerprint.c
index 0f11954..f9fd44b 100644
--- a/modules/fingerprint/fingerprint.c
+++ b/modules/fingerprint/fingerprint.c
@@ -38,7 +38,7 @@
     return FINGERPRINT_ERROR;
 }
 
-static int fingerprint_enroll_cancel(struct fingerprint_device __unused *dev) {
+static int fingerprint_cancel(struct fingerprint_device __unused *dev) {
     return FINGERPRINT_ERROR;
 }
 
@@ -81,7 +81,7 @@
     dev->common.close = fingerprint_close;
 
     dev->enroll = fingerprint_enroll;
-    dev->enroll_cancel = fingerprint_enroll_cancel;
+    dev->cancel = fingerprint_cancel;
     dev->remove = fingerprint_remove;
     dev->set_active_group = fingerprint_set_active_group;
     dev->authenticate = fingerprint_authenticate;
diff --git a/tests/fingerprint/fingerprint_tests.cpp b/tests/fingerprint/fingerprint_tests.cpp
index 4ae0d73..db7429c 100644
--- a/tests/fingerprint/fingerprint_tests.cpp
+++ b/tests/fingerprint/fingerprint_tests.cpp
@@ -24,6 +24,16 @@
         << "enroll() function is not implemented";
 }
 
+TEST_F(FingerprintDevice, isTherePreEnroll) {
+    ASSERT_TRUE(NULL != fp_device()->pre_enroll)
+        << "pre_enroll() function is not implemented";
+}
+
+TEST_F(FingerprintDevice, isThereCancel) {
+    ASSERT_TRUE(NULL != fp_device()->cancel)
+        << "cancel() function is not implemented";
+}
+
 TEST_F(FingerprintDevice, isThereRemove) {
     ASSERT_TRUE(NULL != fp_device()->remove)
         << "remove() function is not implemented";
@@ -34,6 +44,11 @@
         << "authenticate() function is not implemented";
 }
 
+TEST_F(FingerprintDevice, isThereSetActiveGroup) {
+    ASSERT_TRUE(NULL != fp_device()->set_active_group)
+        << "set_active_group() function is not implemented";
+}
+
 TEST_F(FingerprintDevice, isThereSetNotify) {
     ASSERT_TRUE(NULL != fp_device()->set_notify)
         << "set_notify() function is not implemented";