Move adapter to vendor
* make sleep() time increase and avoid CPU hog on GSI/missing system
part
* disable service and start it from system partition to avoid even
trying on GSI
diff --git a/adapter/Android.bp b/adapter/Android.bp
index fb88e32..e359de2 100644
--- a/adapter/Android.bp
+++ b/adapter/Android.bp
@@ -30,6 +30,7 @@
local_include_dirs: [
"binder-interfaces/include"
],
+ vendor: true,
shared_libs: [
"libbinder",
"libhidlbase",
diff --git a/adapter/android.hardware.biometrics.face@1.0-service.lmodroid.rc b/adapter/android.hardware.biometrics.face@1.0-service.lmodroid.rc
index db6646e..4495f48 100644
--- a/adapter/android.hardware.biometrics.face@1.0-service.lmodroid.rc
+++ b/adapter/android.hardware.biometrics.face@1.0-service.lmodroid.rc
@@ -1,4 +1,4 @@
-service face-hal-1-0-lmodroid /system/bin/hw/android.hardware.biometrics.face@1.0-service.lmodroid
+service vendor.face-hal-1-0-lmodroid /vendor/bin/hw/android.hardware.biometrics.face@1.0-service.lmodroid
# "class hal" causes a race condition on some devices due to files created
# in /data. As a workaround, postpone startup until later in boot once
# /data is mounted.
@@ -8,3 +8,4 @@
writepid /dev/cpuset/foreground/tasks
capabilities SYS_NICE
rlimit rtprio 10 10
+ disabled
diff --git a/adapter/service.cpp b/adapter/service.cpp
index 1e6705d..27a6280 100644
--- a/adapter/service.cpp
+++ b/adapter/service.cpp
@@ -44,13 +44,18 @@
android::ProcessState::self()->startThreadPool();
configureRpcThreadpool(4, true /*callerWillJoin*/);
+ unsigned int lastSleep = 1;
while (faceHalService == nullptr) {
// wait for faceunlockhal service to start
ALOGI("Waiting for faceunlockhal service to start...");
- sleep(1);
+ sleep(lastSleep++);
binderFaceHal = android::defaultServiceManager()->getService(android::String16("faceunlockhal"));
if (binderFaceHal != nullptr)
faceHalService = android::interface_cast<IFaceHalService>(binderFaceHal);
+ else if (lastSleep < 1 || lastSleep > 100) {
+ ALOGI("Gave up waiting for faceunlockhal service to start. Sleeping for a long time...");
+ lastSleep = 999999;
+ }
}
android::sp<IBiometricsFace> face = new BiometricsFace(faceHalService);
diff --git a/app/src/main/Android.bp b/app/src/main/Android.bp
index 1010db2..b45527c 100644
--- a/app/src/main/Android.bp
+++ b/app/src/main/Android.bp
@@ -18,4 +18,5 @@
],
required: ["LMOFaceUnlockSettingsOverlay"],
jni_libs: ["libtensorflowlite_jni"],
+ init_rc: ["LMOFaceUnlock.rc"],
}
diff --git a/app/src/main/LMOFaceUnlock.rc b/app/src/main/LMOFaceUnlock.rc
new file mode 100644
index 0000000..ce9a9de
--- /dev/null
+++ b/app/src/main/LMOFaceUnlock.rc
@@ -0,0 +1,2 @@
+on post-fs-data
+ start vendor.face-hal-1-0-lmodroid