aidl: fingerprint: Only call onEnrollmentsEnumerated when finished
authorTim Zimmermann <tim@linux4.de>
Mon, 29 Jan 2024 16:47:27 +0000 (17:47 +0100)
committerTim Zimmermann <tim@linux4.de>
Thu, 22 Feb 2024 05:43:55 +0000 (06:43 +0100)
* Otherwise only one fingerprint can be registered

Change-Id: I89f4be25d060f461ca6b6e46d3ce7c601828c914

aidl/fingerprint/Session.cpp

index 6f6504634824c81f7b16715e6b80ca15a2ceb881..e5429f6f9755a4ff7fffb6317c44545edc143eb7 100644 (file)
@@ -412,9 +412,12 @@ void Session::notify(const fingerprint_msg_t* msg) {
             LOG(DEBUG) << "onEnumerate(fid=" << msg->data.enumerated.finger.fid
                        << ", gid=" << msg->data.enumerated.finger.gid
                        << ", rem=" << msg->data.enumerated.remaining_templates << ")";
-            std::vector<int> enrollments;
+            static std::vector<int> enrollments;
             enrollments.push_back(msg->data.enumerated.finger.fid);
-            mCb->onEnrollmentsEnumerated(enrollments);
+            if (msg->data.enumerated.remaining_templates == 0) {
+                mCb->onEnrollmentsEnumerated(enrollments);
+                enrollments.clear();
+            }
         } break;
     }
 }