Refactor biometric virtual HAL config/control
for additional ways besides system property
Bug: 326227403
Test: atest android.hardware.biometrics.common.ConfigTest
Change-Id: Id0aa4961cc732c23f5da140eca81470316834b70
diff --git a/biometrics/fingerprint/aidl/default/include/Fingerprint.h b/biometrics/fingerprint/aidl/default/include/Fingerprint.h
index 2bd66d4..1576f07 100644
--- a/biometrics/fingerprint/aidl/default/include/Fingerprint.h
+++ b/biometrics/fingerprint/aidl/default/include/Fingerprint.h
@@ -23,6 +23,7 @@
#include "FakeFingerprintEngineSide.h"
#include "FakeFingerprintEngineUdfps.h"
+#include "FingerprintConfig.h"
#include "Session.h"
#include "thread/WorkerThread.h"
@@ -40,10 +41,20 @@
binder_status_t dump(int fd, const char** args, uint32_t numArgs);
binder_status_t handleShellCommand(int in, int out, int err, const char** argv, uint32_t argc);
+ static FingerprintConfig& cfg() {
+ static FingerprintConfig* cfg = nullptr;
+ if (cfg == nullptr) {
+ cfg = new FingerprintConfig();
+ cfg->init();
+ }
+ return *cfg;
+ }
+
private:
void resetConfigToDefault();
void onHelp(int);
void onSimFingerDown();
+ void clearConfigSysprop();
std::unique_ptr<FakeFingerprintEngine> mEngine;
WorkerThread mWorker;
diff --git a/biometrics/fingerprint/aidl/default/include/FingerprintConfig.h b/biometrics/fingerprint/aidl/default/include/FingerprintConfig.h
new file mode 100644
index 0000000..bd1ad4c
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/include/FingerprintConfig.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "config/Config.h"
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+class FingerprintConfig : public Config {
+ Config::Data* getConfigData(int* size) override;
+};
+
+} // namespace aidl::android::hardware::biometrics::fingerprint