sm7125-common: Update BiometricsFingerprint wrapper to 2.3
Signed-off-by: SagarMakhar <sagarmakhar@gmail.com> Signed-off-by: debdeep199x <debdeep199x@gmail.com>
This commit is contained in:
@@ -80,9 +80,6 @@ AUDIO_FEATURE_ENABLED_FM_POWER_OPT := true
|
||||
BOARD_HAS_QCA_FM_SOC := cherokee
|
||||
BOARD_HAVE_QCOM_FM := true
|
||||
|
||||
# FOD
|
||||
TARGET_SURFACEFLINGER_FOD_LIB := //$(COMMON_PATH):libfod_extension.realme_sm7125
|
||||
|
||||
# HIDL
|
||||
DEVICE_MANIFEST_FILE := $(COMMON_PATH)/manifest.xml
|
||||
DEVICE_MATRIX_FILE := $(COMMON_PATH)/compatibility_matrix.xml
|
||||
@@ -216,6 +213,9 @@ BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor
|
||||
# Treble
|
||||
BOARD_VNDK_VERSION := current
|
||||
|
||||
# UDFPS
|
||||
TARGET_SURFACEFLINGER_UDFPS_LIB := //$(COMMON_PATH):libudfps_extension.realme_sm7125
|
||||
|
||||
# WiFi
|
||||
BOARD_WLAN_DEVICE := qcwcn
|
||||
BOARD_HOSTAPD_DRIVER := NL80211
|
||||
|
||||
@@ -133,7 +133,7 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
# Fingerprint
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.biometrics.fingerprint@2.1-service.realme_sm7125
|
||||
android.hardware.biometrics.fingerprint@2.3-service.realme_sm7125
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
|
||||
@@ -443,6 +443,7 @@ PRODUCT_PACKAGES += \
|
||||
android.hardware.biometrics.face@1.0.vendor \
|
||||
android.hardware.biometrics.fingerprint@2.1.vendor \
|
||||
android.hardware.biometrics.fingerprint@2.2.vendor \
|
||||
android.hardware.biometrics.fingerprint@2.3.vendor \
|
||||
android.hardware.bluetooth.a2dp@1.0.vendor \
|
||||
android.hardware.bluetooth.audio@2.0.vendor \
|
||||
android.hardware.bluetooth@1.0.vendor \
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
cc_binary {
|
||||
name: "android.hardware.biometrics.fingerprint@2.1-service.realme_sm7125",
|
||||
name: "android.hardware.biometrics.fingerprint@2.3-service.realme_sm7125",
|
||||
defaults: ["hidl_defaults"],
|
||||
init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.realme_sm7125.rc"],
|
||||
init_rc: ["android.hardware.biometrics.fingerprint@2.3-service.realme_sm7125.rc"],
|
||||
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.3-service.realme_sm7125.xml"],
|
||||
relative_install_path: "hw",
|
||||
srcs: [
|
||||
"BiometricsFingerprint.cpp",
|
||||
@@ -18,7 +19,17 @@ cc_binary {
|
||||
"libutils",
|
||||
"libbase",
|
||||
"android.hardware.biometrics.fingerprint@2.1",
|
||||
"android.hardware.biometrics.fingerprint@2.2",
|
||||
"android.hardware.biometrics.fingerprint@2.3",
|
||||
"vendor.oplus.hardware.biometrics.fingerprint@2.1",
|
||||
],
|
||||
proprietary: true,
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "libudfps_extension.realme_sm7125",
|
||||
srcs: ["UdfpsExtension.cpp"],
|
||||
include_dirs: [
|
||||
"frameworks/native/services/surfaceflinger/CompositionEngine/include"
|
||||
],
|
||||
}
|
||||
|
||||
@@ -13,23 +13,58 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.realme_sm7125"
|
||||
#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service.realme_sm7125"
|
||||
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.realme_sm7125"
|
||||
#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.3-service.realme_sm7125"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/properties.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/fingerprint.h>
|
||||
#include "BiometricsFingerprint.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <cmath>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <thread>
|
||||
|
||||
#define FP_PRESS_PATH "/sys/kernel/oppo_display/notify_fppress"
|
||||
#define DIMLAYER_PATH "/sys/kernel/oppo_display/dimlayer_hbm"
|
||||
#define POWER_STATUS_PATH "/sys/kernel/oppo_display/power_status"
|
||||
#define NOTIFY_BLANK_PATH "/sys/kernel/oppo_display/notify_panel_blank"
|
||||
#define PRJNAME_PATH "/proc/oplusVersion/prjName"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace biometrics {
|
||||
namespace fingerprint {
|
||||
namespace V2_1 {
|
||||
namespace V2_3 {
|
||||
namespace implementation {
|
||||
|
||||
template <typename T>
|
||||
static void set(const std::string& path, const T& value) {
|
||||
std::ofstream file(path);
|
||||
file << value;
|
||||
LOG(INFO) << "wrote path: " << path << ", value: " << value << "\n";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T get(const std::string& path, const T& def) {
|
||||
std::ifstream file(path);
|
||||
T result;
|
||||
|
||||
file >> result;
|
||||
LOG(INFO) << "read path: " << path << ", value: " << result << "\n";
|
||||
return file.fail() ? def : result;
|
||||
}
|
||||
|
||||
static std::string get(const std::string& path, const std::string& def) {
|
||||
std::ifstream file(path);
|
||||
std::string result;
|
||||
file >> result;
|
||||
LOG(INFO) << "read path: " << path << ", value: " << result << "\n";
|
||||
return file.fail() ? def : result;
|
||||
}
|
||||
|
||||
BiometricsFingerprint::BiometricsFingerprint() {
|
||||
mOplusBiometricsFingerprint = vendor::oplus::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint::getService();
|
||||
}
|
||||
@@ -180,8 +215,59 @@ Return<RequestStatus> BiometricsFingerprint::authenticate(uint64_t operationId,
|
||||
return OplusToAOSPRequestStatus(mOplusBiometricsFingerprint->authenticate(operationId, gid));
|
||||
}
|
||||
|
||||
Return<bool> BiometricsFingerprint::isUdfps(uint32_t) {
|
||||
if (get(PRJNAME_PATH, "") == "206B1") {
|
||||
return true;
|
||||
}
|
||||
LOG(INFO) << "sagar : device : " << get(PRJNAME_PATH, "");
|
||||
return false;
|
||||
}
|
||||
|
||||
Return<void> BiometricsFingerprint::onShowUdfpsOverlay() {
|
||||
if (isUdfps(0)) {
|
||||
if (isDozeMode()) {
|
||||
set(NOTIFY_BLANK_PATH, 1);
|
||||
set(DIMLAYER_PATH, 1);
|
||||
set(FP_PRESS_PATH, 1);
|
||||
} else {
|
||||
std::thread([]() {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
set(DIMLAYER_PATH, 1);
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> BiometricsFingerprint::onFingerUp() {
|
||||
if (isUdfps(0)) {
|
||||
set(FP_PRESS_PATH, 0);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<bool> BiometricsFingerprint::isDozeMode() {
|
||||
return (get(POWER_STATUS_PATH, 0) == 1) || (get(POWER_STATUS_PATH, 0) == 3);
|
||||
}
|
||||
|
||||
Return<void> BiometricsFingerprint::onFingerDown(uint32_t, uint32_t, float, float) {
|
||||
if (isUdfps(0)) {
|
||||
set(DIMLAYER_PATH, 1);
|
||||
set(FP_PRESS_PATH, 1);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> BiometricsFingerprint::onHideUdfpsOverlay() {
|
||||
if (isUdfps(0)) {
|
||||
set(DIMLAYER_PATH, 0);
|
||||
set(FP_PRESS_PATH, 0);
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_1
|
||||
} // namespace V2_3
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
|
||||
#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
|
||||
#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H
|
||||
#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
@@ -23,18 +23,17 @@
|
||||
#include <hardware/fingerprint.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
|
||||
#include <android/hardware/biometrics/fingerprint/2.1/types.h>
|
||||
#include <android/hardware/biometrics/fingerprint/2.3/IBiometricsFingerprint.h>
|
||||
#include <vendor/oplus/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace biometrics {
|
||||
namespace fingerprint {
|
||||
namespace V2_1 {
|
||||
namespace V2_3 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
|
||||
//using ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
|
||||
using ::android::hardware::Return;
|
||||
@@ -61,17 +60,26 @@ public:
|
||||
Return<RequestStatus> setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
|
||||
Return<RequestStatus> authenticate(uint64_t operationId, uint32_t gid) override;
|
||||
|
||||
// ::V2_3::IBiometricsFingerprint follow.
|
||||
Return<bool> isUdfps(uint32_t sensorId) override;
|
||||
Return<void> onFingerDown(uint32_t x, uint32_t y, float minor, float major) override;
|
||||
Return<void> onFingerUp() override;
|
||||
|
||||
Return<void> onShowUdfpsOverlay() ;
|
||||
Return<void> onHideUdfpsOverlay() ;
|
||||
|
||||
private:
|
||||
sp<vendor::oplus::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint> mOplusBiometricsFingerprint;
|
||||
sp<vendor::oplus::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback> mOplusClientCallback;
|
||||
static Return<RequestStatus> OplusToAOSPRequestStatus(vendor::oplus::hardware::biometrics::fingerprint::V2_1::RequestStatus req);
|
||||
Return<bool> isDozeMode();
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_1
|
||||
} // namespace V2_3
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
|
||||
#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H
|
||||
|
||||
27
fingerprint/UdfpsExtension.cpp
Normal file
27
fingerprint/UdfpsExtension.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The LineageOS 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.
|
||||
*/
|
||||
|
||||
#include <compositionengine/UdfpsExtension.h>
|
||||
|
||||
uint32_t getUdfpsZOrder(uint32_t z, bool touched) {
|
||||
if (touched)
|
||||
return 0x41000033;
|
||||
return z;
|
||||
}
|
||||
|
||||
uint64_t getUdfpsUsageBits(uint64_t usageBits, bool) {
|
||||
return usageBits;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
service vendor.fps_hal.realme_sm7125 /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.realme_sm7125
|
||||
service vendor.fps_hal.realme_sm7125 /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.3-service.realme_sm7125
|
||||
# "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.
|
||||
@@ -0,0 +1,11 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.biometrics.fingerprint</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.3</version>
|
||||
<interface>
|
||||
<name>IBiometricsFingerprint</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.realme_sm7125"
|
||||
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.realme_sm7125"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
|
||||
#include "BiometricsFingerprint.h"
|
||||
|
||||
using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
|
||||
using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint;
|
||||
using android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
|
||||
using android::hardware::biometrics::fingerprint::V2_3::implementation::BiometricsFingerprint;
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
using android::OK;
|
||||
|
||||
@@ -50,15 +50,6 @@
|
||||
<fqname>@1.3::ICryptoFactory/wfdhdcp</fqname>
|
||||
<fqname>@1.3::IDrmFactory/wfdhdcp</fqname>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.biometrics.fingerprint</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.2</version>
|
||||
<interface>
|
||||
<name>IBiometricsFingerprint</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.gatekeeper</name>
|
||||
<transport>hwbinder</transport>
|
||||
|
||||
Reference in New Issue
Block a user