otter: fingerprint: Call onFingerUp on cancel, onEnrollResult and onAuthenticated

Change-Id: I91dbfdf4ed3794c1424e0ade0ca9585f324cdf87
diff --git a/fingerprint/BiometricsFingerprint.cpp b/fingerprint/BiometricsFingerprint.cpp
index de65f4e..8697f3e 100644
--- a/fingerprint/BiometricsFingerprint.cpp
+++ b/fingerprint/BiometricsFingerprint.cpp
@@ -187,6 +187,7 @@
 }
 
 Return<RequestStatus> BiometricsFingerprint::cancel() {
+    onFingerUp();
     return ErrorFilter(mDevice->cancel(mDevice));
 }
 
@@ -310,6 +311,9 @@
                     msg->data.enroll.samples_remaining).isOk()) {
                 ALOGE("failed to invoke fingerprint onEnrollResult callback");
             }
+            if (msg->data.enroll.samples_remaining == 0) {
+                thisPtr->onFingerUp();
+            }
             break;
         case FINGERPRINT_TEMPLATE_REMOVED:
             ALOGD("onRemove(fid=%d, gid=%d, rem=%d)",
@@ -347,6 +351,7 @@
                     ALOGE("failed to invoke fingerprint onAuthenticated callback");
                 }
             }
+            thisPtr->onFingerUp();
             break;
         case FINGERPRINT_TEMPLATE_ENUMERATING:
             ALOGD("onEnumerate(fid=%d, gid=%d, rem=%d)",
@@ -370,14 +375,16 @@
 }
 
 Return<void> BiometricsFingerprint::onFingerDown(uint32_t, uint32_t, float, float) {
+    ALOGD("onFingerDown()");
     setUdfpsHbm(true);
     mDevice->send_customized_command(mDevice, CMD_FINGERPRINT_EVENT, CMD_FINGERPRINT_EVENT_DOWN);
     return Void();
 }
 
 Return<void> BiometricsFingerprint::onFingerUp() {
-    setUdfpsHbm(false);
+    ALOGD("onFingerUp()");
     mDevice->send_customized_command(mDevice, CMD_FINGERPRINT_EVENT, CMD_FINGERPRINT_EVENT_UP);
+    setUdfpsHbm(false);
     return Void();
 }