guacamole: introduce in-screen fingerprint hal
This commit is contained in:
parent
ec0bb3559e
commit
544ce5684a
|
@ -1,3 +1,3 @@
|
||||||
subdirs = [
|
subdirs = [
|
||||||
"lights", "interfaces",
|
"lights", "interfaces", "fod",
|
||||||
]
|
]
|
||||||
|
|
|
@ -52,7 +52,8 @@ PRODUCT_PACKAGES += \
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
frameworks/native/data/etc/android.hardware.fingerprint.xml:system/etc/permissions/android.hardware.fingerprint.xml
|
frameworks/native/data/etc/android.hardware.fingerprint.xml:system/etc/permissions/android.hardware.fingerprint.xml
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.biometrics.fingerprint@2.1-service
|
android.hardware.biometrics.fingerprint@2.1-service \
|
||||||
|
vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_msmnile
|
||||||
|
|
||||||
# HIDL
|
# HIDL
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
cc_binary {
|
||||||
|
relative_install_path: "hw",
|
||||||
|
defaults: ["hidl_defaults"],
|
||||||
|
name: "vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_msmnile",
|
||||||
|
init_rc: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_msmnile.rc"],
|
||||||
|
srcs: ["FingerprintInscreen.cpp"],
|
||||||
|
shared_libs: [
|
||||||
|
"libbase",
|
||||||
|
"libhardware",
|
||||||
|
"libhidlbase",
|
||||||
|
"libhidltransport",
|
||||||
|
"liblog",
|
||||||
|
"libhwbinder",
|
||||||
|
"libutils",
|
||||||
|
"vendor.lineage.biometrics.fingerprint.inscreen@1.0",
|
||||||
|
"vendor.oneplus.fingerprint.extension@1.0",
|
||||||
|
"vendor.oneplus.hardware.display@1.0",
|
||||||
|
],
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
#define LOG_TAG "vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_msmnile"
|
||||||
|
|
||||||
|
#include "FingerprintInscreen.h"
|
||||||
|
#include <hidl/HidlTransportSupport.h>
|
||||||
|
#include <android-base/logging.h>
|
||||||
|
#include <hidl/HidlTransportSupport.h>
|
||||||
|
|
||||||
|
#define OP_ENABLE_FP_LONGPRESS 3
|
||||||
|
#define OP_DISABLE_FP_LONGPRESS 4
|
||||||
|
#define OP_RESUME_FP_ENROLL 8
|
||||||
|
#define OP_FINISH_FP_ENROLL 10
|
||||||
|
|
||||||
|
#define OP_DISPLAY_AOD_MODE 8
|
||||||
|
#define OP_DISPLAY_NOTIFY_PRESS 9
|
||||||
|
#define OP_DISPLAY_SET_DIM 10
|
||||||
|
|
||||||
|
using vendor::oneplus::fingerprint::extension::V1_0::IVendorFingerprintExtensions;
|
||||||
|
using vendor::oneplus::hardware::display::V1_0::IOneplusDisplay;
|
||||||
|
using vendor::lineage::biometrics::fingerprint::inscreen::V1_0::IFingerprintInscreen;
|
||||||
|
using vendor::lineage::biometrics::fingerprint::inscreen::V1_0::implementation::FingerprintInscreen;
|
||||||
|
using android::hardware::Return;
|
||||||
|
using android::hardware::Void;
|
||||||
|
using android::hardware::configureRpcThreadpool;
|
||||||
|
using android::hardware::joinRpcThreadpool;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
android::sp<IFingerprintInscreen> service = new FingerprintInscreen();
|
||||||
|
configureRpcThreadpool(1, true);
|
||||||
|
android::status_t status = service->registerAsService();
|
||||||
|
if (status != android::OK) {
|
||||||
|
LOG(ERROR) << "Cannot register FOD HAL";
|
||||||
|
}
|
||||||
|
LOG(INFO) << "FOD HAL ready";
|
||||||
|
joinRpcThreadpool();
|
||||||
|
LOG(ERROR) << "FOD HAL exitted unexpectedly";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FingerprintInscreen::FingerprintInscreen() {
|
||||||
|
this->mVendorFpService = IVendorFingerprintExtensions::getService();
|
||||||
|
this->mVendorDisplayService = IOneplusDisplay::getService();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> FingerprintInscreen::onStartEnroll() {
|
||||||
|
LOG(INFO) << "onStartEnroll";
|
||||||
|
this->mVendorFpService->updateStatus(OP_DISABLE_FP_LONGPRESS);
|
||||||
|
this->mVendorFpService->updateStatus(OP_RESUME_FP_ENROLL);
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> FingerprintInscreen::onFinishEnroll() {
|
||||||
|
LOG(INFO) << "onFinishEnroll";
|
||||||
|
this->mVendorFpService->updateStatus(OP_FINISH_FP_ENROLL);
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> FingerprintInscreen::onPress() {
|
||||||
|
LOG(INFO) << "onPress";
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_AOD_MODE, 2);
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 1);
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 1);
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> FingerprintInscreen::onRelease() {
|
||||||
|
LOG(INFO) << "onRelease";
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 0);
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> FingerprintInscreen::onShowFODView() {
|
||||||
|
LOG(INFO) << "onShowFODView";
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_AOD_MODE, 2);
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 1);
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> FingerprintInscreen::onHideFODView() {
|
||||||
|
LOG(INFO) << "onHideFODView";
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_AOD_MODE, 0);
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 0);
|
||||||
|
this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 0);
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<bool> FingerprintInscreen::shouldHandleError(int32_t error) {
|
||||||
|
if (error == 8) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> FingerprintInscreen::setLongPressEnabled(bool enabled) {
|
||||||
|
this->mVendorFpService->updateStatus(enabled ? OP_ENABLE_FP_LONGPRESS : OP_DISABLE_FP_LONGPRESS);
|
||||||
|
return Void();
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
#include <vendor/lineage/biometrics/fingerprint/inscreen/1.0/IFingerprintInscreen.h>
|
||||||
|
#include <vendor/oneplus/fingerprint/extension/1.0/IVendorFingerprintExtensions.h>
|
||||||
|
#include <vendor/oneplus/hardware/display/1.0/IOneplusDisplay.h>
|
||||||
|
|
||||||
|
namespace vendor {
|
||||||
|
namespace lineage {
|
||||||
|
namespace biometrics {
|
||||||
|
namespace fingerprint {
|
||||||
|
namespace inscreen {
|
||||||
|
namespace V1_0 {
|
||||||
|
namespace implementation {
|
||||||
|
|
||||||
|
using ::android::sp;
|
||||||
|
using ::android::hardware::Return;
|
||||||
|
using ::vendor::oneplus::fingerprint::extension::V1_0::IVendorFingerprintExtensions;
|
||||||
|
using ::vendor::oneplus::hardware::display::V1_0::IOneplusDisplay;
|
||||||
|
|
||||||
|
class FingerprintInscreen : public IFingerprintInscreen {
|
||||||
|
private:
|
||||||
|
sp<IVendorFingerprintExtensions> mVendorFpService;
|
||||||
|
sp<IOneplusDisplay> mVendorDisplayService;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FingerprintInscreen();
|
||||||
|
Return<void> onStartEnroll();
|
||||||
|
Return<void> onFinishEnroll();
|
||||||
|
Return<void> onPress();
|
||||||
|
Return<void> onRelease();
|
||||||
|
Return<void> onShowFODView();
|
||||||
|
Return<void> onHideFODView();
|
||||||
|
Return<bool> shouldHandleError(int32_t error);
|
||||||
|
Return<void> setLongPressEnabled(bool enabled);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
service vendor.fingerprint-inscreen-1-0 /system/bin/hw/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_msmnile
|
||||||
|
interface vendor.lineage.biometrics.fingerprint.inscreen@1.0::IFingerprintInscreen default
|
||||||
|
class hal
|
||||||
|
user system
|
||||||
|
group system
|
||||||
|
shutdown critical
|
|
@ -28,4 +28,14 @@
|
||||||
</interface>
|
</interface>
|
||||||
<fqname>@1.0::ICameraMotor/default</fqname>
|
<fqname>@1.0::ICameraMotor/default</fqname>
|
||||||
</hal>
|
</hal>
|
||||||
|
<hal format="hidl">
|
||||||
|
<name>vendor.lineage.biometrics.fingerprint.inscreen</name>
|
||||||
|
<transport>hwbinder</transport>
|
||||||
|
<version>1.0</version>
|
||||||
|
<interface>
|
||||||
|
<name>IFingerprintInscreen</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
<fqname>@1.0::IFingerprintInscreen/default</fqname>
|
||||||
|
</hal>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -20,5 +20,4 @@
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
<!-- FOD fingerprint scanner -->
|
<!-- FOD fingerprint scanner -->
|
||||||
<bool name="config_needCustomFODView">true</bool>
|
<bool name="config_needCustomFODView">true</bool>
|
||||||
<bool name="config_usesOnePlusFOD">true</bool>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue