From 06629c7544ac22ada41c644c3cd10a4f7c086e28 Mon Sep 17 00:00:00 2001 From: lynnrin Date: Sun, 23 Jun 2024 20:11:19 +0800 Subject: [PATCH] BGT_sprout: Hello BGT_sprout --- Android.bp | 3 - Android.mk | 2 +- AndroidProducts.mk | 6 +- BoardConfig.mk | 16 +- aosp_gauguin.mk => aosp_BGT_sprout.mk | 14 +- device.mk | 30 +- extract-files.sh | 19 +- fingerprint/Android.bp | 33 -- fingerprint/BiometricsFingerprint.cpp | 407 ---------------- fingerprint/BiometricsFingerprint.h | 94 ---- ....fingerprint@2.1-service.xiaomi_gauguin.rc | 44 -- fingerprint/fingerprint.h | 282 ----------- fingerprint/service.cpp | 77 --- init/Android.bp | 16 - init/init_gauguin.cpp | 60 --- keylayout/uinput-fpc.kl | 15 - keylayout/uinput-goodix.kl | 15 - light/Android.bp | 30 -- light/Light.cpp | 225 --------- light/Light.h | 68 --- ...rdware.light@2.0-service.xiaomi_gauguin.rc | 7 - light/service.cpp | 50 -- manifest.xml | 27 -- parts/Android.bp | 29 -- parts/AndroidManifest.xml | 72 --- parts/proguard.flags | 7 - parts/res/values/arrays.xml | 98 ---- parts/res/values/strings.xml | 66 --- parts/res/values/styles.xml | 20 - parts/res/xml/dirac_settings.xml | 54 --- parts/res/xml/doze_settings.xml | 64 --- .../settings/BootCompletedReceiver.java | 39 -- .../lineageos/settings/doze/DozeService.java | 99 ---- .../settings/doze/DozeSettingsActivity.java | 36 -- .../settings/doze/DozeSettingsFragment.java | 159 ------- .../lineageos/settings/doze/DozeUtils.java | 147 ------ .../lineageos/settings/doze/PickupSensor.java | 93 ---- .../settings/doze/ProximitySensor.java | 107 ----- rootdir/Android.mk | 4 +- rootdir/etc/init.qcom.rc | 2 +- rootdir/etc/init.xiaomi.rc | 124 ----- .../Android.bp | 4 +- .../AndroidManifest.xml | 2 +- .../res/xml/vendor.xml | 0 .../Android.bp | 4 +- .../AndroidManifest.xml | 2 +- .../res/values/config.xml | 0 .../res/values/dimens.xml | 0 .../res/xml/power_profile.xml | 0 .../Android.bp | 4 +- .../AndroidManifest.xml | 2 +- .../res/values/config.xml | 0 .../SettingsOverlayM2007J17C/Android.bp | 4 - .../AndroidManifest.xml | 9 - .../res/drawable/regulatory_info.png | Bin 26716 -> 0 bytes .../res/values/config.xml | 21 - .../SettingsOverlayM2007J17G/Android.bp | 4 - .../AndroidManifest.xml | 9 - .../res/drawable/regulatory_info.png | Bin 200616 -> 0 bytes .../res/values/config.xml | 21 - .../SettingsOverlayM2007J17I/Android.bp | 4 - .../AndroidManifest.xml | 9 - .../res/drawable/regulatory_info.png | Bin 40384 -> 0 bytes .../res/values/config.xml | 21 - .../Android.bp | 4 +- .../AndroidManifest.xml | 2 +- .../res/values/config.xml | 0 .../res/values/dimens.xml | 0 .../Android.bp | 4 +- .../AndroidManifest.xml | 2 +- .../res/values/config.xml | 0 sepolicy/private/platform_app.te | 1 - sepolicy/private/priv_app.te | 1 - sepolicy/private/system_app.te | 1 - sepolicy/public/attributes | 2 - sepolicy/vendor/file_contexts | 20 - sepolicy/vendor/hal_misys.te | 5 - sepolicy/vendor/hal_misys_default.te | 15 - sepolicy/vendor/hal_mlipay.te | 4 - sepolicy/vendor/hal_mlipay_default.te | 16 - sepolicy/vendor/hwservice.te | 3 - sepolicy/vendor/hwservice_contexts | 5 - sepolicy/vendor/property_contexts | 3 - setup-makefiles.sh | 4 +- vibrator/Android.bp | 41 -- vibrator/Vibrator.cpp | 445 ------------------ vibrator/etc/excluded-input-devices.xml | 34 -- vibrator/include/Vibrator.h | 85 ---- vibrator/service.cpp | 50 -- ...ardware.vibrator.service.xiaomi_gauguin.rc | 4 - ...rdware.vibrator.service.xiaomi_gauguin.xml | 33 -- 91 files changed, 47 insertions(+), 3617 deletions(-) rename aosp_gauguin.mk => aosp_BGT_sprout.mk (70%) delete mode 100644 fingerprint/Android.bp delete mode 100644 fingerprint/BiometricsFingerprint.cpp delete mode 100644 fingerprint/BiometricsFingerprint.h delete mode 100644 fingerprint/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin.rc delete mode 100644 fingerprint/fingerprint.h delete mode 100644 fingerprint/service.cpp delete mode 100644 init/Android.bp delete mode 100644 init/init_gauguin.cpp delete mode 100644 keylayout/uinput-fpc.kl delete mode 100644 keylayout/uinput-goodix.kl delete mode 100644 light/Android.bp delete mode 100644 light/Light.cpp delete mode 100644 light/Light.h delete mode 100644 light/android.hardware.light@2.0-service.xiaomi_gauguin.rc delete mode 100644 light/service.cpp delete mode 100644 parts/Android.bp delete mode 100644 parts/AndroidManifest.xml delete mode 100644 parts/proguard.flags delete mode 100644 parts/res/values/arrays.xml delete mode 100644 parts/res/values/strings.xml delete mode 100644 parts/res/values/styles.xml delete mode 100644 parts/res/xml/dirac_settings.xml delete mode 100644 parts/res/xml/doze_settings.xml delete mode 100644 parts/src/org/lineageos/settings/BootCompletedReceiver.java delete mode 100644 parts/src/org/lineageos/settings/doze/DozeService.java delete mode 100644 parts/src/org/lineageos/settings/doze/DozeSettingsActivity.java delete mode 100644 parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java delete mode 100644 parts/src/org/lineageos/settings/doze/DozeUtils.java delete mode 100644 parts/src/org/lineageos/settings/doze/PickupSensor.java delete mode 100644 parts/src/org/lineageos/settings/doze/ProximitySensor.java delete mode 100644 rootdir/etc/init.xiaomi.rc rename rro_overlays/{FrameworkResOverlayGauguin => CarrierConfigOverlayBGT_sprout}/Android.bp (55%) rename rro_overlays/{CarrierConfigOverlayGauguin => CarrierConfigOverlayBGT_sprout}/AndroidManifest.xml (95%) rename rro_overlays/{CarrierConfigOverlayGauguin => CarrierConfigOverlayBGT_sprout}/res/xml/vendor.xml (100%) rename rro_overlays/{CarrierConfigOverlayGauguin => FrameworkResOverlayBGT_sprout}/Android.bp (56%) rename rro_overlays/{FrameworkResOverlayGauguin => FrameworkResOverlayBGT_sprout}/AndroidManifest.xml (95%) rename rro_overlays/{FrameworkResOverlayGauguin => FrameworkResOverlayBGT_sprout}/res/values/config.xml (100%) rename rro_overlays/{FrameworkResOverlayGauguin => FrameworkResOverlayBGT_sprout}/res/values/dimens.xml (100%) rename rro_overlays/{FrameworkResOverlayGauguin => FrameworkResOverlayBGT_sprout}/res/xml/power_profile.xml (100%) rename rro_overlays/{SettingsOverlayGauguin => SettingsOverlayBGT_sprout}/Android.bp (58%) rename rro_overlays/{SettingsOverlayGauguin => SettingsOverlayBGT_sprout}/AndroidManifest.xml (96%) rename rro_overlays/{SettingsOverlayGauguin => SettingsOverlayBGT_sprout}/res/values/config.xml (100%) delete mode 100644 rro_overlays/SettingsOverlayM2007J17C/Android.bp delete mode 100644 rro_overlays/SettingsOverlayM2007J17C/AndroidManifest.xml delete mode 100644 rro_overlays/SettingsOverlayM2007J17C/res/drawable/regulatory_info.png delete mode 100644 rro_overlays/SettingsOverlayM2007J17C/res/values/config.xml delete mode 100644 rro_overlays/SettingsOverlayM2007J17G/Android.bp delete mode 100644 rro_overlays/SettingsOverlayM2007J17G/AndroidManifest.xml delete mode 100644 rro_overlays/SettingsOverlayM2007J17G/res/drawable/regulatory_info.png delete mode 100644 rro_overlays/SettingsOverlayM2007J17G/res/values/config.xml delete mode 100644 rro_overlays/SettingsOverlayM2007J17I/Android.bp delete mode 100644 rro_overlays/SettingsOverlayM2007J17I/AndroidManifest.xml delete mode 100644 rro_overlays/SettingsOverlayM2007J17I/res/drawable/regulatory_info.png delete mode 100644 rro_overlays/SettingsOverlayM2007J17I/res/values/config.xml rename rro_overlays/{SystemUIOverlayGauguin => SystemUIOverlayBGT_sprout}/Android.bp (58%) rename rro_overlays/{SystemUIOverlayGauguin => SystemUIOverlayBGT_sprout}/AndroidManifest.xml (96%) rename rro_overlays/{SystemUIOverlayGauguin => SystemUIOverlayBGT_sprout}/res/values/config.xml (100%) rename rro_overlays/{SystemUIOverlayGauguin => SystemUIOverlayBGT_sprout}/res/values/dimens.xml (100%) rename rro_overlays/{TelephonyOverlayGauguin => TelephonyOverlayBGT_sprout}/Android.bp (58%) rename rro_overlays/{TelephonyOverlayGauguin => TelephonyOverlayBGT_sprout}/AndroidManifest.xml (95%) rename rro_overlays/{TelephonyOverlayGauguin => TelephonyOverlayBGT_sprout}/res/values/config.xml (100%) delete mode 100644 sepolicy/private/platform_app.te delete mode 100644 sepolicy/private/priv_app.te delete mode 100644 sepolicy/private/system_app.te delete mode 100644 sepolicy/public/attributes delete mode 100644 sepolicy/vendor/hal_misys.te delete mode 100644 sepolicy/vendor/hal_misys_default.te delete mode 100644 sepolicy/vendor/hal_mlipay.te delete mode 100644 sepolicy/vendor/hal_mlipay_default.te delete mode 100644 sepolicy/vendor/hwservice.te delete mode 100644 vibrator/Android.bp delete mode 100644 vibrator/Vibrator.cpp delete mode 100644 vibrator/etc/excluded-input-devices.xml delete mode 100644 vibrator/include/Vibrator.h delete mode 100644 vibrator/service.cpp delete mode 100644 vibrator/vendor.qti.hardware.vibrator.service.xiaomi_gauguin.rc delete mode 100644 vibrator/vendor.qti.hardware.vibrator.service.xiaomi_gauguin.xml diff --git a/Android.bp b/Android.bp index ad009dd..b04a4b0 100644 --- a/Android.bp +++ b/Android.bp @@ -5,7 +5,4 @@ // soong_namespace { - imports: [ - "hardware/xiaomi", - ], } diff --git a/Android.mk b/Android.mk index e460b0d..3c0d480 100644 --- a/Android.mk +++ b/Android.mk @@ -6,7 +6,7 @@ LOCAL_PATH := $(call my-dir) -ifeq ($(TARGET_DEVICE),gauguin) +ifeq ($(TARGET_DEVICE),BGT_sprout) include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/AndroidProducts.mk b/AndroidProducts.mk index fcc93d8..cd860bf 100644 --- a/AndroidProducts.mk +++ b/AndroidProducts.mk @@ -5,8 +5,8 @@ # PRODUCT_MAKEFILES := \ - $(LOCAL_DIR)/aosp_gauguin.mk + $(LOCAL_DIR)/aosp_BGT_sprout.mk COMMON_LUNCH_CHOICES := \ - aosp_gauguin-userdebug \ - aosp_gauguin-eng + aosp_BGT_sprout-userdebug \ + aosp_BGT_sprout-eng diff --git a/BoardConfig.mk b/BoardConfig.mk index c7bd4c6..192878a 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -DEVICE_PATH := device/xiaomi/gauguin +DEVICE_PATH := device/nokia/BGT_sprout # Architecture TARGET_ARCH := arm64 @@ -20,14 +20,14 @@ TARGET_2ND_CPU_ABI2 := armeabi TARGET_2ND_CPU_VARIANT := cortex-a76 # Assert -TARGET_OTA_ASSERT_DEVICE := gauguin,gauguinpro,gauguininpro +TARGET_OTA_ASSERT_DEVICE := BGT_sprout # Build BUILD_BROKEN_DUP_RULES := true BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true # Bootloader -TARGET_BOOTLOADER_BOARD_NAME := gauguin +TARGET_BOOTLOADER_BOARD_NAME := lito TARGET_NO_BOOTLOADER := true # Kernel @@ -40,8 +40,8 @@ BOARD_KERNEL_SEPARATED_DTBO := true BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOTIMG_HEADER_VERSION) TARGET_KERNEL_ADDITIONAL_FLAGS := DTC_EXT=$(shell pwd)/prebuilts/misc/$(HOST_OS)-x86/dtc/dtc TARGET_KERNEL_CLANG_COMPILE := true -TARGET_KERNEL_SOURCE := kernel/xiaomi/gauguin -TARGET_KERNEL_CONFIG := vendor/gauguin_user_defconfig +TARGET_KERNEL_SOURCE := kernel/BGT_sprout +TARGET_KERNEL_CONFIG := vendor/lito_defconfig TARGET_KERNEL_LLVM_BINUTILS := false TARGET_KERNEL_CLANG_PATH := $(shell pwd)/prebuilts/clang/kernel/linux-x86/clang-r416183b @@ -81,10 +81,6 @@ DEVICE_MATRIX_FILE := $(DEVICE_PATH)/compatibility_matrix.xml ODM_MANIFEST_NFC_FILES := $(DEVICE_PATH)/manifest_nfc.xml ODM_MANIFEST_SKUS += nfc -# Init -TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_gauguin -TARGET_RECOVERY_DEVICE_MODULES := libinit_gauguin - # Media TARGET_USES_ION := true @@ -191,4 +187,4 @@ WIFI_HIDL_UNIFIED_SUPPLICANT_SERVICE_RC_ENTRY := true WPA_SUPPLICANT_VERSION := VER_0_8_X # Inherit from the proprietary version -include vendor/xiaomi/gauguin/BoardConfigVendor.mk +include vendor/nokia/BGT_sprout/BoardConfigVendor.mk diff --git a/aosp_gauguin.mk b/aosp_BGT_sprout.mk similarity index 70% rename from aosp_gauguin.mk rename to aosp_BGT_sprout.mk index 6df5485..5260852 100644 --- a/aosp_gauguin.mk +++ b/aosp_BGT_sprout.mk @@ -8,8 +8,8 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk) -# Inherit from gauguin device -$(call inherit-product, device/xiaomi/gauguin/device.mk) +# Inherit from BGT_sprout device +$(call inherit-product, device/nokia/BGT_sprout/device.mk) # Inherit some common AOSP stuff. $(call inherit-product, vendor/aosp/config/common_full_phone.mk) @@ -19,9 +19,9 @@ TARGET_INCLUDE_LIVE_WALLPAPERS := false TARGET_SUPPORTS_QUICK_TAP := true # Device identifier. This must come after all inclusions. -PRODUCT_NAME := aosp_gauguin -PRODUCT_DEVICE := gauguin -PRODUCT_BRAND := Xiaomi -PRODUCT_MANUFACTURER := Xiaomi +PRODUCT_NAME := aosp_BGT_sprout +PRODUCT_DEVICE := BGT_sprout +PRODUCT_BRAND := nokia +PRODUCT_MANUFACTURER := nokia -PRODUCT_GMS_CLIENTID_BASE := android-xiaomi +PRODUCT_GMS_CLIENTID_BASE := android-nokia diff --git a/device.mk b/device.mk index c04cbc6..ca3dd0a 100644 --- a/device.mk +++ b/device.mk @@ -14,23 +14,22 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/developer_gsi_keys.mk) $(call inherit-product, frameworks/native/build/phone-xhdpi-6144-dalvik-heap.mk) # Get non-open-source specific aspects -$(call inherit-product, vendor/xiaomi/gauguin/gauguin-vendor.mk) +$(call inherit-product, vendor/nokia/BGT_sprout/BGT_sprout-vendor.mk) # Overlays PRODUCT_PACKAGES += \ - CarrierConfigOverlayGauguin \ - FrameworkResOverlayGauguin \ - SettingsOverlayGauguin \ + CarrierConfigOverlayBGT_sprout \ + FrameworkResOverlayBGT_sprout \ + SettingsOverlayBGT_sprout \ SettingsOverlayM2007J17C \ SettingsOverlayM2007J17G \ SettingsOverlayM2007J17I \ - SystemUIOverlayGauguin \ - TelephonyOverlayGauguin \ + SystemUIOverlayBGT_sprout \ + TelephonyOverlayBGT_sprout \ # Soong namespaces PRODUCT_SOONG_NAMESPACES += \ - $(LOCAL_PATH) \ - hardware/xiaomi + $(LOCAL_PATH) # Boot animation TARGET_SCREEN_HEIGHT := 2400 @@ -198,10 +197,6 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ android.hardware.drm@1.4-service.clearkey -# Fingerprint -PRODUCT_PACKAGES += \ - android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin - # Fastbootd PRODUCT_PACKAGES += \ fastbootd @@ -259,7 +254,6 @@ PRODUCT_PACKAGES += \ init.qcom.usb.sh \ init.recovery.qcom.rc \ init.target.rc \ - init.xiaomi.rc \ ueventd.qcom.rc # IPACM @@ -286,10 +280,6 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ android.hardware.keymaster@4.1.vendor -# Lights -PRODUCT_PACKAGES += \ - android.hardware.light@2.0-service.xiaomi_gauguin - # LiveDisplay PRODUCT_PACKAGES += \ vendor.lineage.livedisplay@2.0-service-sdm @@ -374,10 +364,6 @@ PRODUCT_PACKAGES += \ libOmxVenc \ libstagefrighthw -# Parts -PRODUCT_PACKAGES += \ - XiaomiParts - # Perf PRODUCT_PACKAGES += \ vendor.qti.hardware.perf@2.2.vendor @@ -460,7 +446,7 @@ PRODUCT_PACKAGES += \ # Vibrator PRODUCT_PACKAGES += \ - vendor.qti.hardware.vibrator.service.xiaomi_gauguin + vendor.qti.hardware.vibrator.service PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/vibrator/etc/excluded-input-devices.xml:$(TARGET_COPY_OUT_VENDOR)/etc/excluded-input-devices.xml diff --git a/extract-files.sh b/extract-files.sh index 10df9a4..2eb311a 100755 --- a/extract-files.sh +++ b/extract-files.sh @@ -8,8 +8,8 @@ set -e -DEVICE=gauguin -VENDOR=xiaomi +DEVICE=BGT_sprout +VENDOR=nokia # Load extract_utils and do some sanity checks MY_DIR="${BASH_SOURCE%/*}" @@ -53,21 +53,6 @@ if [ -z "${SRC}" ]; then SRC="adb" fi -function blob_fixup() { - case "${1}" in - vendor/lib64/vendor.qti.hardware.camera.postproc@1.0-service-impl.so) - hexdump -ve '1/1 "%.2X"' "${2}" | sed "s/210080529A0A0094/210080521F2003D5/g" | xxd -r -p > "${EXTRACT_TMP_DIR}/${1##*/}" - mv "${EXTRACT_TMP_DIR}/${1##*/}" "${2}" - ;; - vendor/lib64/camera/components/com.mi.node.watermark.so) - "${PATCHELF}" --add-needed "libpiex_shim.so" "${2}" - ;; - vendor/lib64/camera/components/com.mi.node.superlowlightraw.so) - "${PATCHELF}" --add-needed "libweakcount_shim.so" "${2}" - ;; - esac -} - # Initialize the helper setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}" diff --git a/fingerprint/Android.bp b/fingerprint/Android.bp deleted file mode 100644 index 5166887..0000000 --- a/fingerprint/Android.bp +++ /dev/null @@ -1,33 +0,0 @@ -// -// Copyright (C) 2017-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. - -cc_binary { - name: "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin", - relative_install_path: "hw", - defaults: ["hidl_defaults"], - init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin.rc"], - srcs: ["service.cpp", "BiometricsFingerprint.cpp"], - shared_libs: [ - "libbase", - "libhardware", - "libhidlbase", - "liblog", - "libutils", - "libcutils", - "android.hardware.biometrics.fingerprint@2.1", - "vendor.xiaomi.hardware.fingerprintextension@1.0", - ], - proprietary: true, -} diff --git a/fingerprint/BiometricsFingerprint.cpp b/fingerprint/BiometricsFingerprint.cpp deleted file mode 100644 index 20bf114..0000000 --- a/fingerprint/BiometricsFingerprint.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * Copyright (C) 2018-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. - */ - -#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin" - -#include "BiometricsFingerprint.h" - -#include -#include -#include -#include -#include -#include - -namespace android { -namespace hardware { -namespace biometrics { -namespace fingerprint { -namespace V2_1 { -namespace implementation { - -// Supported fingerprint HAL version -static const uint16_t kVersion = HARDWARE_MODULE_API_VERSION(2, 1); - -using RequestStatus = android::hardware::biometrics::fingerprint::V2_1::RequestStatus; - -BiometricsFingerprint* BiometricsFingerprint::sInstance = nullptr; - -BiometricsFingerprint::BiometricsFingerprint() : mClientCallback(nullptr), mDevice(nullptr) { - sInstance = this; // keep track of the most recent instance - mDevice = openHal(); - if (!mDevice) { - ALOGE("Can't open HAL module"); - } -} - -BiometricsFingerprint::~BiometricsFingerprint() { - ALOGV("~BiometricsFingerprint()"); - if (mDevice == nullptr) { - ALOGE("No valid device"); - return; - } - int err; - if (0 != (err = mDevice->common.close(reinterpret_cast(mDevice)))) { - ALOGE("Can't close fingerprint module, error: %d", err); - return; - } - mDevice = nullptr; -} - -Return BiometricsFingerprint::ErrorFilter(int32_t error) { - switch (error) { - case 0: - return RequestStatus::SYS_OK; - case -2: - return RequestStatus::SYS_ENOENT; - case -4: - return RequestStatus::SYS_EINTR; - case -5: - return RequestStatus::SYS_EIO; - case -11: - return RequestStatus::SYS_EAGAIN; - case -12: - return RequestStatus::SYS_ENOMEM; - case -13: - return RequestStatus::SYS_EACCES; - case -14: - return RequestStatus::SYS_EFAULT; - case -16: - return RequestStatus::SYS_EBUSY; - case -22: - return RequestStatus::SYS_EINVAL; - case -28: - return RequestStatus::SYS_ENOSPC; - case -110: - return RequestStatus::SYS_ETIMEDOUT; - default: - ALOGE("An unknown error returned from fingerprint vendor library: %d", error); - return RequestStatus::SYS_UNKNOWN; - } -} - -// Translate from errors returned by traditional HAL (see fingerprint.h) to -// HIDL-compliant FingerprintError. -FingerprintError BiometricsFingerprint::VendorErrorFilter(int32_t error, int32_t* vendorCode) { - *vendorCode = 0; - switch (error) { - case FINGERPRINT_ERROR_HW_UNAVAILABLE: - return FingerprintError::ERROR_HW_UNAVAILABLE; - case FINGERPRINT_ERROR_UNABLE_TO_PROCESS: - return FingerprintError::ERROR_UNABLE_TO_PROCESS; - case FINGERPRINT_ERROR_TIMEOUT: - return FingerprintError::ERROR_TIMEOUT; - case FINGERPRINT_ERROR_NO_SPACE: - return FingerprintError::ERROR_NO_SPACE; - case FINGERPRINT_ERROR_CANCELED: - return FingerprintError::ERROR_CANCELED; - case FINGERPRINT_ERROR_UNABLE_TO_REMOVE: - return FingerprintError::ERROR_UNABLE_TO_REMOVE; - case FINGERPRINT_ERROR_LOCKOUT: - return FingerprintError::ERROR_LOCKOUT; - default: - if (error >= FINGERPRINT_ERROR_VENDOR_BASE) { - // vendor specific code. - *vendorCode = error - FINGERPRINT_ERROR_VENDOR_BASE; - return FingerprintError::ERROR_VENDOR; - } - } - ALOGE("Unknown error from fingerprint vendor library: %d", error); - return FingerprintError::ERROR_UNABLE_TO_PROCESS; -} - -// Translate acquired messages returned by traditional HAL (see fingerprint.h) -// to HIDL-compliant FingerprintAcquiredInfo. -FingerprintAcquiredInfo BiometricsFingerprint::VendorAcquiredFilter(int32_t info, - int32_t* vendorCode) { - *vendorCode = 0; - switch (info) { - case FINGERPRINT_ACQUIRED_GOOD: - return FingerprintAcquiredInfo::ACQUIRED_GOOD; - case FINGERPRINT_ACQUIRED_PARTIAL: - return FingerprintAcquiredInfo::ACQUIRED_PARTIAL; - case FINGERPRINT_ACQUIRED_INSUFFICIENT: - return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT; - case FINGERPRINT_ACQUIRED_IMAGER_DIRTY: - return FingerprintAcquiredInfo::ACQUIRED_IMAGER_DIRTY; - case FINGERPRINT_ACQUIRED_TOO_SLOW: - return FingerprintAcquiredInfo::ACQUIRED_TOO_SLOW; - case FINGERPRINT_ACQUIRED_TOO_FAST: - return FingerprintAcquiredInfo::ACQUIRED_TOO_FAST; - default: - if (info >= FINGERPRINT_ACQUIRED_VENDOR_BASE) { - // vendor specific code. - *vendorCode = info - FINGERPRINT_ACQUIRED_VENDOR_BASE; - return FingerprintAcquiredInfo::ACQUIRED_VENDOR; - } - } - ALOGE("Unknown acquiredmsg from fingerprint vendor library: %d", info); - return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT; -} - -Return BiometricsFingerprint::setNotify( - const sp& clientCallback) { - std::lock_guard lock(mClientCallbackMutex); - mClientCallback = clientCallback; - // This is here because HAL 2.1 doesn't have a way to propagate a - // unique token for its driver. Subsequent versions should send a unique - // token for each call to setNotify(). This is fine as long as there's only - // one fingerprint device on the platform. - return reinterpret_cast(mDevice); -} - -Return BiometricsFingerprint::preEnroll() { - return mDevice->pre_enroll(mDevice); -} - -Return BiometricsFingerprint::enroll(const hidl_array& hat, - uint32_t gid, uint32_t timeoutSec) { - const hw_auth_token_t* authToken = reinterpret_cast(hat.data()); - return ErrorFilter(mDevice->enroll(mDevice, authToken, gid, timeoutSec)); -} - -Return BiometricsFingerprint::postEnroll() { - return ErrorFilter(mDevice->post_enroll(mDevice)); -} - -Return BiometricsFingerprint::getAuthenticatorId() { - return mDevice->get_authenticator_id(mDevice); -} - -Return BiometricsFingerprint::cancel() { - return ErrorFilter(mDevice->cancel(mDevice)); -} - -Return BiometricsFingerprint::enumerate() { - return ErrorFilter(mDevice->enumerate(mDevice)); -} - -Return BiometricsFingerprint::remove(uint32_t gid, uint32_t fid) { - return ErrorFilter(mDevice->remove(mDevice, gid, fid)); -} - -Return BiometricsFingerprint::setActiveGroup(uint32_t gid, - const hidl_string& storePath) { - if (storePath.size() >= PATH_MAX || storePath.size() <= 0) { - ALOGE("Bad path length: %zd", storePath.size()); - return RequestStatus::SYS_EINVAL; - } - std::string mutableStorePath = storePath; - if (android::base::StartsWith(mutableStorePath, "/data/system/users/")) { - mutableStorePath = "/data/vendor_de/"; - mutableStorePath += - static_cast(storePath).substr(strlen("/data/system/users/")); - } - if (access(mutableStorePath.c_str(), W_OK)) { - return RequestStatus::SYS_EINVAL; - } - - return ErrorFilter(mDevice->set_active_group(mDevice, gid, mutableStorePath.c_str())); -} - -Return BiometricsFingerprint::authenticate(uint64_t operationId, uint32_t gid) { - return ErrorFilter(mDevice->authenticate(mDevice, operationId, gid)); -} - -IBiometricsFingerprint* BiometricsFingerprint::getInstance() { - if (!sInstance) { - sInstance = new BiometricsFingerprint(); - } - return sInstance; -} - -void setFpVendorProp(const char* fp_vendor) { - property_set("persist.vendor.sys.fp.vendor", fp_vendor); -} - -fingerprint_device_t* getDeviceForVendor(const char* class_name) { - const hw_module_t* hw_module = nullptr; - int err; - - err = hw_get_module_by_class(FINGERPRINT_HARDWARE_MODULE_ID, class_name, &hw_module); - if (err) { - ALOGE("Failed to get fingerprint module: class %s, error %d", class_name, err); - return nullptr; - } - - if (hw_module == nullptr) { - ALOGE("No valid fingerprint module: class %s", class_name); - return nullptr; - } - - fingerprint_module_t const* fp_module = reinterpret_cast(hw_module); - - if (fp_module->common.methods->open == nullptr) { - ALOGE("No valid open method: class %s", class_name); - return nullptr; - } - - hw_device_t* device = nullptr; - - err = fp_module->common.methods->open(hw_module, nullptr, &device); - if (err) { - ALOGE("Can't open fingerprint methods, class %s, error: %d", class_name, err); - return nullptr; - } - - if (kVersion != device->version) { - ALOGE("Wrong fingerprint version: expected %d, got %d", kVersion, device->version); - return nullptr; - } - - fingerprint_device_t* fp_device = reinterpret_cast(device); - - ALOGI("Loaded fingerprint module: class %s", class_name); - return fp_device; -} - -fingerprint_device_t* getFingerprintDevice() { - fingerprint_device_t* fp_device; - - fp_device = getDeviceForVendor("fpc"); - if (fp_device == nullptr) { - ALOGE("Failed to load fpc fingerprint module"); - } else { - setFpVendorProp("fpc"); - return fp_device; - } - - fp_device = getDeviceForVendor("goodix"); - if (fp_device == nullptr) { - ALOGE("Failed to load goodix fingerprint module"); - } else { - setFpVendorProp("goodix"); - return fp_device; - } - - setFpVendorProp("none"); - - return nullptr; -} - -fingerprint_device_t* BiometricsFingerprint::openHal() { - int err; - - fingerprint_device_t* fp_device; - fp_device = getFingerprintDevice(); - if (fp_device == nullptr) { - return nullptr; - } - - if (0 != (err = fp_device->set_notify(fp_device, BiometricsFingerprint::notify))) { - ALOGE("Can't register fingerprint module callback, error: %d", err); - return nullptr; - } - - return fp_device; -} - -void BiometricsFingerprint::notify(const fingerprint_msg_t* msg) { - BiometricsFingerprint* thisPtr = - static_cast(BiometricsFingerprint::getInstance()); - std::lock_guard lock(thisPtr->mClientCallbackMutex); - if (thisPtr == nullptr || thisPtr->mClientCallback == nullptr) { - ALOGE("Receiving callbacks before the client callback is registered."); - return; - } - const uint64_t devId = reinterpret_cast(thisPtr->mDevice); - switch (msg->type) { - case FINGERPRINT_ERROR: { - int32_t vendorCode = 0; - FingerprintError result = VendorErrorFilter(msg->data.error, &vendorCode); - ALOGD("onError(%d)", result); - if (!thisPtr->mClientCallback->onError(devId, result, vendorCode).isOk()) { - ALOGE("failed to invoke fingerprint onError callback"); - } - } break; - case FINGERPRINT_ACQUIRED: { - int32_t vendorCode = 0; - FingerprintAcquiredInfo result = - VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode); - ALOGD("onAcquired(%d)", result); - if (!thisPtr->mClientCallback->onAcquired(devId, result, vendorCode).isOk()) { - ALOGE("failed to invoke fingerprint onAcquired callback"); - } - } break; - case FINGERPRINT_TEMPLATE_ENROLLING: - ALOGD("onEnrollResult(fid=%d, gid=%d, rem=%d)", msg->data.enroll.finger.fid, - msg->data.enroll.finger.gid, msg->data.enroll.samples_remaining); - if (!thisPtr->mClientCallback - ->onEnrollResult(devId, msg->data.enroll.finger.fid, - msg->data.enroll.finger.gid, - msg->data.enroll.samples_remaining) - .isOk()) { - ALOGE("failed to invoke fingerprint onEnrollResult callback"); - } - break; - case FINGERPRINT_TEMPLATE_REMOVED: - ALOGD("onRemove(fid=%d, gid=%d, rem=%d)", msg->data.removed.finger.fid, - msg->data.removed.finger.gid, msg->data.removed.remaining_templates); - if (!thisPtr->mClientCallback - ->onRemoved(devId, msg->data.removed.finger.fid, msg->data.removed.finger.gid, - msg->data.removed.remaining_templates) - .isOk()) { - ALOGE("failed to invoke fingerprint onRemoved callback"); - } - break; - case FINGERPRINT_AUTHENTICATED: - if (msg->data.authenticated.finger.fid != 0) { - ALOGD("onAuthenticated(fid=%d, gid=%d)", msg->data.authenticated.finger.fid, - msg->data.authenticated.finger.gid); - const uint8_t* hat = reinterpret_cast(&msg->data.authenticated.hat); - const hidl_vec token( - std::vector(hat, hat + sizeof(msg->data.authenticated.hat))); - if (!thisPtr->mClientCallback - ->onAuthenticated(devId, msg->data.authenticated.finger.fid, - msg->data.authenticated.finger.gid, token) - .isOk()) { - ALOGE("failed to invoke fingerprint onAuthenticated callback"); - } - } else { - // Not a recognized fingerprint - if (!thisPtr->mClientCallback - ->onAuthenticated(devId, msg->data.authenticated.finger.fid, - msg->data.authenticated.finger.gid, hidl_vec()) - .isOk()) { - ALOGE("failed to invoke fingerprint onAuthenticated callback"); - } - } - break; - case FINGERPRINT_TEMPLATE_ENUMERATING: - ALOGD("onEnumerate(fid=%d, gid=%d, rem=%d)", msg->data.enumerated.finger.fid, - msg->data.enumerated.finger.gid, msg->data.enumerated.remaining_templates); - if (!thisPtr->mClientCallback - ->onEnumerate(devId, msg->data.enumerated.finger.fid, - msg->data.enumerated.finger.gid, - msg->data.enumerated.remaining_templates) - .isOk()) { - ALOGE("failed to invoke fingerprint onEnumerate callback"); - } - break; - } -} - -Return BiometricsFingerprint::extCmd(int32_t cmd, int32_t param) { - return mDevice->extCmd(mDevice, cmd, param); -} - -} // namespace implementation -} // namespace V2_1 -} // namespace fingerprint -} // namespace biometrics -} // namespace hardware -} // namespace android diff --git a/fingerprint/BiometricsFingerprint.h b/fingerprint/BiometricsFingerprint.h deleted file mode 100644 index 2d0d145..0000000 --- a/fingerprint/BiometricsFingerprint.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * 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. - */ - -#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H -#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H - -#include -#include -#include -#include -#include -#include -#include - -#include "fingerprint.h" - -namespace android { -namespace hardware { -namespace biometrics { -namespace fingerprint { -namespace V2_1 { -namespace implementation { - -using ::android::sp; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint; -using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback; -using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus; - -using ::vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint; - -struct BiometricsFingerprint : public IBiometricsFingerprint, public IXiaomiFingerprint { - BiometricsFingerprint(); - ~BiometricsFingerprint(); - - status_t registerAsSystemService(); - - // Method to wrap legacy HAL with BiometricsFingerprint class - static IBiometricsFingerprint* getInstance(); - - // Methods from ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint follow. - Return setNotify( - const sp& clientCallback) override; - Return preEnroll() override; - Return enroll(const hidl_array& hat, uint32_t gid, - uint32_t timeoutSec) override; - Return postEnroll() override; - Return getAuthenticatorId() override; - Return cancel() override; - Return enumerate() override; - Return remove(uint32_t gid, uint32_t fid) override; - Return setActiveGroup(uint32_t gid, const hidl_string& storePath) override; - Return authenticate(uint64_t operationId, uint32_t gid) override; - - Return extCmd(int32_t cmd, int32_t param) override; - - static fingerprint_device_t* openHal(); - static void notify( - const fingerprint_msg_t* msg); /* Static callback for legacy HAL implementation */ - static Return ErrorFilter(int32_t error); - static FingerprintError VendorErrorFilter(int32_t error, int32_t* vendorCode); - static FingerprintAcquiredInfo VendorAcquiredFilter(int32_t error, int32_t* vendorCode); - static BiometricsFingerprint* sInstance; - - std::mutex mClientCallbackMutex; - sp mClientCallback; - fingerprint_device_t* mDevice; -}; - -} // namespace implementation -} // namespace V2_1 -} // namespace fingerprint -} // namespace biometrics -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H diff --git a/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin.rc b/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin.rc deleted file mode 100644 index 5b79883..0000000 --- a/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin.rc +++ /dev/null @@ -1,44 +0,0 @@ -service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin - class late_start - user system - group system input uhid - -on init - chmod 0666 /dev/goodix_fp - chown system system /dev/goodix_fp - chmod 0664 /dev/fortsense_fp - chown system system /dev/fortsense_fp - -on boot - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq_enable - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/fingerdown_wait - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/vendor - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg - chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/irq - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/vendor - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg - chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg - - chmod 0666 /dev/input/event2 - -on post-fs-data - mkdir /data/vendor/fpc 0770 system system - mkdir /data/vendor/goodix 0770 system system - mkdir /data/vendor/fpdump 0770 system system - mkdir /data/vendor/fortsense 0770 system system - mkdir /mnt/vendor/persist/goodix 0770 system system - mkdir /mnt/vendor/persist/fpc 0770 system system diff --git a/fingerprint/fingerprint.h b/fingerprint/fingerprint.h deleted file mode 100644 index 91a5b71..0000000 --- a/fingerprint/fingerprint.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * 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. - */ - -#ifndef ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H -#define ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H - -#include -#include - -#define FINGERPRINT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0) -#define FINGERPRINT_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0) -#define FINGERPRINT_MODULE_API_VERSION_2_1 HARDWARE_MODULE_API_VERSION(2, 1) -#define FINGERPRINT_MODULE_API_VERSION_3_0 HARDWARE_MODULE_API_VERSION(3, 0) -#define FINGERPRINT_HARDWARE_MODULE_ID "fingerprint" - -typedef enum fingerprint_msg_type { - FINGERPRINT_ERROR = -1, - FINGERPRINT_ACQUIRED = 1, - FINGERPRINT_TEMPLATE_ENROLLING = 3, - FINGERPRINT_TEMPLATE_REMOVED = 4, - FINGERPRINT_AUTHENTICATED = 5, - FINGERPRINT_TEMPLATE_ENUMERATING = 6, -} fingerprint_msg_type_t; - -/* - * Fingerprint errors are meant to tell the framework to terminate the current operation and ask - * for the user to correct the situation. These will almost always result in messaging and user - * interaction to correct the problem. - * - * For example, FINGERPRINT_ERROR_CANCELED should follow any acquisition message that results in - * a situation where the current operation can't continue without user interaction. For example, - * if the sensor is dirty during enrollment and no further enrollment progress can be made, - * send FINGERPRINT_ACQUIRED_IMAGER_DIRTY followed by FINGERPRINT_ERROR_CANCELED. - */ -typedef enum fingerprint_error { - FINGERPRINT_ERROR_HW_UNAVAILABLE = 1, /* The hardware has an error that can't be resolved. */ - FINGERPRINT_ERROR_UNABLE_TO_PROCESS = 2, /* Bad data; operation can't continue */ - FINGERPRINT_ERROR_TIMEOUT = 3, /* The operation has timed out waiting for user input. */ - FINGERPRINT_ERROR_NO_SPACE = 4, /* No space available to store a template */ - FINGERPRINT_ERROR_CANCELED = 5, /* The current operation can't proceed. See above. */ - FINGERPRINT_ERROR_UNABLE_TO_REMOVE = 6, /* fingerprint with given id can't be removed */ - FINGERPRINT_ERROR_LOCKOUT = 7, /* the fingerprint hardware is in lockout due to too many attempts */ - FINGERPRINT_ERROR_VENDOR_BASE = 1000 /* vendor-specific error messages start here */ -} fingerprint_error_t; - -/* - * Fingerprint acquisition info is meant as feedback for the current operation. Anything but - * FINGERPRINT_ACQUIRED_GOOD will be shown to the user as feedback on how to take action on the - * current operation. For example, FINGERPRINT_ACQUIRED_IMAGER_DIRTY can be used to tell the user - * to clean the sensor. If this will cause the current operation to fail, an additional - * FINGERPRINT_ERROR_CANCELED can be sent to stop the operation in progress (e.g. enrollment). - * In general, these messages will result in a "Try again" message. - */ -typedef enum fingerprint_acquired_info { - FINGERPRINT_ACQUIRED_GOOD = 0, - FINGERPRINT_ACQUIRED_PARTIAL = 1, /* sensor needs more data, i.e. longer swipe. */ - FINGERPRINT_ACQUIRED_INSUFFICIENT = 2, /* image doesn't contain enough detail for recognition*/ - FINGERPRINT_ACQUIRED_IMAGER_DIRTY = 3, /* sensor needs to be cleaned */ - FINGERPRINT_ACQUIRED_TOO_SLOW = 4, /* mostly swipe-type sensors; not enough data collected */ - FINGERPRINT_ACQUIRED_TOO_FAST = 5, /* for swipe and area sensors; tell user to slow down*/ - FINGERPRINT_ACQUIRED_DETECTED = 6, /* when the finger is first detected. Used to optimize wakeup. - Should be followed by one of the above messages */ - FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000 /* vendor-specific acquisition messages start here */ -} fingerprint_acquired_info_t; - -typedef struct fingerprint_finger_id { - uint32_t gid; - uint32_t fid; -} fingerprint_finger_id_t; - -typedef struct fingerprint_enroll { - fingerprint_finger_id_t finger; - /* samples_remaining goes from N (no data collected, but N scans needed) - * to 0 (no more data is needed to build a template). */ - uint32_t samples_remaining; - uint64_t msg; /* Vendor specific message. Used for user guidance */ -} fingerprint_enroll_t; - -typedef struct fingerprint_iterator { - fingerprint_finger_id_t finger; - uint32_t remaining_templates; -} fingerprint_iterator_t; - -typedef fingerprint_iterator_t fingerprint_enumerated_t; -typedef fingerprint_iterator_t fingerprint_removed_t; - -typedef struct fingerprint_acquired { - fingerprint_acquired_info_t acquired_info; /* information about the image */ -} fingerprint_acquired_t; - -typedef struct fingerprint_authenticated { - fingerprint_finger_id_t finger; - hw_auth_token_t hat; -} fingerprint_authenticated_t; - -typedef struct fingerprint_msg { - fingerprint_msg_type_t type; - union { - fingerprint_error_t error; - fingerprint_enroll_t enroll; - fingerprint_enumerated_t enumerated; - fingerprint_removed_t removed; - fingerprint_acquired_t acquired; - fingerprint_authenticated_t authenticated; - } data; -} fingerprint_msg_t; - -/* Callback function type */ -typedef void (*fingerprint_notify_t)(const fingerprint_msg_t* msg); - -/* Synchronous operation */ -typedef struct fingerprint_device { - /** - * Common methods of the fingerprint device. This *must* be the first member - * of fingerprint_device as users of this structure will cast a hw_device_t - * to fingerprint_device pointer in contexts where it's known - * the hw_device_t references a fingerprint_device. - */ - struct hw_device_t common; - - /* - * Client provided callback function to receive notifications. - * Do not set by hand, use the function above instead. - */ - fingerprint_notify_t notify; - - /* - * Set notification callback: - * Registers a user function that would receive notifications from the HAL - * The call will block if the HAL state machine is in busy state until HAL - * leaves the busy state. - * - * Function return: 0 if callback function is successfuly registered - * or a negative number in case of error, generally from the errno.h set. - */ - int (*set_notify)(struct fingerprint_device* dev, fingerprint_notify_t notify); - - /* - * Fingerprint pre-enroll enroll request: - * Generates a unique token to upper layers to indicate the start of an enrollment transaction. - * This token will be wrapped by security for verification and passed to enroll() for - * verification before enrollment will be allowed. This is to ensure adding a new fingerprint - * template was preceded by some kind of credential confirmation (e.g. device password). - * - * Function return: 0 if function failed - * otherwise, a uint64_t of token - */ - uint64_t (*pre_enroll)(struct fingerprint_device* dev); - - /* - * Fingerprint enroll request: - * Switches the HAL state machine to collect and store a new fingerprint - * template. Switches back as soon as enroll is complete - * (fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENROLLING && - * fingerprint_msg.data.enroll.samples_remaining == 0) - * or after timeout_sec seconds. - * The fingerprint template will be assigned to the group gid. User has a choice - * to supply the gid or set it to 0 in which case a unique group id will be generated. - * - * Function return: 0 if enrollment process can be successfully started - * or a negative number in case of error, generally from the errno.h set. - * A notify() function may be called indicating the error condition. - */ - int (*enroll)(struct fingerprint_device* dev, const hw_auth_token_t* hat, uint32_t gid, - uint32_t timeout_sec); - - /* - * Finishes the enroll operation and invalidates the pre_enroll() generated challenge. - * This will be called at the end of a multi-finger enrollment session to indicate - * that no more fingers will be added. - * - * Function return: 0 if the request is accepted - * or a negative number in case of error, generally from the errno.h set. - */ - int (*post_enroll)(struct fingerprint_device* dev); - - /* - * get_authenticator_id: - * Returns a token associated with the current fingerprint set. This value will - * change whenever a new fingerprint is enrolled, thus creating a new fingerprint - * set. - * - * Function return: current authenticator id or 0 if function failed. - */ - uint64_t (*get_authenticator_id)(struct fingerprint_device* dev); - - /* - * Cancel pending enroll or authenticate, sending FINGERPRINT_ERROR_CANCELED - * to all running clients. Switches the HAL state machine back to the idle state. - * Unlike enroll_done() doesn't invalidate the pre_enroll() challenge. - * - * Function return: 0 if cancel request is accepted - * or a negative number in case of error, generally from the errno.h set. - */ - int (*cancel)(struct fingerprint_device* dev); - - /* - * Enumerate all the fingerprint templates found in the directory set by - * set_active_group() - * For each template found a notify() will be called with: - * fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENUMERATED - * fingerprint_msg.data.enumerated.finger indicating a template id - * fingerprint_msg.data.enumerated.remaining_templates indicating how many more - * enumeration messages to expect. - * Note: If there are no fingerprints, then this should return 0 and the first fingerprint - * enumerated should have fingerid=0 and remaining=0 - * Function return: 0 if enumerate request is accepted - * or a negative number in case of error, generally from the errno.h set. - */ - int (*enumerate)(struct fingerprint_device* dev); - - /* - * Fingerprint remove request: - * Deletes a fingerprint template. - * Works only within the path set by set_active_group(). - * The fid parameter can be used as a widcard: - * * fid == 0 -- delete all the templates in the group. - * * fid != 0 -- delete this specific template from the group. - * For each template found a notify() will be called with: - * fingerprint_msg.type == FINGERPRINT_TEMPLATE_REMOVED - * fingerprint_msg.data.removed.finger indicating a template id deleted - * fingerprint_msg.data.removed.remaining_templates indicating how many more - * templates will be deleted by this operation. - * - * Function return: 0 if fingerprint template(s) can be successfully deleted - * or a negative number in case of error, generally from the errno.h set. - */ - int (*remove)(struct fingerprint_device* dev, uint32_t gid, uint32_t fid); - - /* - * Restricts the HAL operation to a set of fingerprints belonging to a - * group provided. - * The caller must provide a path to a storage location within the user's - * data directory. - * - * Function return: 0 on success - * or a negative number in case of error, generally from the errno.h set. - */ - int (*set_active_group)(struct fingerprint_device* dev, uint32_t gid, const char* store_path); - - /* - * Authenticates an operation identifed by operation_id - * - * Function return: 0 on success - * or a negative number in case of error, generally from the errno.h set. - */ - int (*authenticate)(struct fingerprint_device* dev, uint64_t operation_id, uint32_t gid); - - /** - * Call a Xiaomi fingerprint extension command. - */ - int (*extCmd)(struct fingerprint_device* dev, int32_t cmd, int32_t param); - - /* Reserved for backward binary compatibility */ - void* reserved[4]; -} fingerprint_device_t; - -typedef struct fingerprint_module { - /** - * Common methods of the fingerprint module. This *must* be the first member - * of fingerprint_module as users of this structure will cast a hw_module_t - * to fingerprint_module pointer in contexts where it's known - * the hw_module_t references a fingerprint_module. - */ - struct hw_module_t common; -} fingerprint_module_t; - -#endif /* ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H */ diff --git a/fingerprint/service.cpp b/fingerprint/service.cpp deleted file mode 100644 index d66e8b8..0000000 --- a/fingerprint/service.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * 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. - */ - -#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_gauguin" - -#include -#include - -#include "BiometricsFingerprint.h" - -// libhwbinder: -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; - -// Generated HIDL files -using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint; - -using android::status_t; - -status_t BiometricsFingerprint::registerAsSystemService() { - status_t ret = 0; - - ret = IBiometricsFingerprint::registerAsService(); - if (ret != 0) { - ALOGE("Failed to register IBiometricsFingerprint (%d)", ret); - goto fail; - } else { - ALOGI("Successfully registered IBiometricsFingerprint"); - } - - ret = IXiaomiFingerprint::registerAsService(); - if (ret != 0) { - ALOGE("Failed to register IXiaomiFingerprint (%d)", ret); - goto fail; - } else { - ALOGI("Successfully registered IXiaomiFingerprint"); - } - -fail: - return ret; -} - -int main() { - android::sp service = nullptr; - - service = new BiometricsFingerprint(); - if (service == nullptr) { - ALOGE("Instance of BiometricsFingerprint is null"); - return 1; - } - - configureRpcThreadpool(1, true /*callerWillJoin*/); - - status_t status = service->registerAsSystemService(); - if (status != android::OK) { - ALOGE("Cannot register service for Fingerprint HAL(%d).", status); - return 1; - } - - joinRpcThreadpool(); - - return 0; // should never get here -} diff --git a/init/Android.bp b/init/Android.bp deleted file mode 100644 index 32f544f..0000000 --- a/init/Android.bp +++ /dev/null @@ -1,16 +0,0 @@ -// -// Copyright (C) 2021 The LineageOS Project -// -// SPDX-License-Identifier: Apache-2.0 -// - -cc_library_static { - name: "libinit_gauguin", - srcs: ["init_gauguin.cpp"], - shared_libs: ["libbase"], - recovery_available: true, - include_dirs: [ - "system/core/init", - "system/libbase/include" - ] -} diff --git a/init/init_gauguin.cpp b/init/init_gauguin.cpp deleted file mode 100644 index dfb0fd0..0000000 --- a/init/init_gauguin.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2021, The LineageOS Project - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ -#include - -#include "vendor_init.h" -#include "property_service.h" - -void property_override(char const prop[], char const value[]) { - prop_info *pi; - - pi = (prop_info*) __system_property_find(prop); - - if (pi) - __system_property_update(pi, value, strlen(value)); - else - __system_property_add(prop, strlen(prop), value, strlen(value)); -} - -void load_gauguin() { - property_override("ro.build.fingerprint", "Xiaomi/gauguin_global/gauguin:12/SKQ1.211006.001/V13.0.4.0.SJSMIXM:user/release-keys"); - property_override("ro.product.brand", "Xiaomi"); - property_override("ro.product.device", "gauguin"); - property_override("ro.product.model", "M2007J17G"); - property_override("ro.boot.product.hardware.sku", "nfc"); - property_override("ro.build.version.security_patch", "2022-07-01"); -} - -void load_gauguinpro() { - property_override("ro.build.fingerprint", "Redmi/gauguinpro/gauguinpro:12/SKQ1.211006.001/V13.0.6.0.SJSCNXM:user/release-keys"); - property_override("ro.product.brand", "Redmi"); - property_override("ro.product.device", "gauguinpro"); - property_override("ro.product.model", "M2007J17C"); - property_override("ro.boot.product.hardware.sku", "nfc"); - property_override("ro.build.version.security_patch", "2022-07-01"); -} - -void load_gauguininpro() { - property_override("ro.build.fingerprint", "Xiaomi/gauguininpro/gauguininpro:12/SKQ1.211006.001/V13.0.6.0.SJSINXM:user/release-keys"); - property_override("ro.product.brand", "Xiaomi"); - property_override("ro.product.device", "gauguininpro"); - property_override("ro.product.model", "M2007J17I"); - property_override("ro.build.version.security_patch", "2022-08-01"); -} - -void vendor_load_properties() { - std::string region = android::base::GetProperty("ro.boot.hwc", ""); - - if (region.find("CN") != std::string::npos) - load_gauguinpro(); - else if (region.find("INDIA") != std::string::npos) - load_gauguininpro(); - else if (region.find("GLOBAL") != std::string::npos) - load_gauguin(); -} diff --git a/keylayout/uinput-fpc.kl b/keylayout/uinput-fpc.kl deleted file mode 100644 index 762839c..0000000 --- a/keylayout/uinput-fpc.kl +++ /dev/null @@ -1,15 +0,0 @@ -# -# FPC1020 Touch sensor driver -# -# Copyright (c) 2013,2014 Fingerprint Cards AB -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License Version 2 -# as published by the Free Software Foundation. -# - -#key 304 DPAD_CENTER VIRTUAL -#key 102 HOME VIRTUAL -#key 108 SYSTEM_NAVIGATION_DOWN -#key 103 SYSTEM_NAVIGATION_DOWN - diff --git a/keylayout/uinput-goodix.kl b/keylayout/uinput-goodix.kl deleted file mode 100644 index d936a9b..0000000 --- a/keylayout/uinput-goodix.kl +++ /dev/null @@ -1,15 +0,0 @@ -# -# FPC1020 Touch sensor driver -# -# Copyright (c) 2013,2014 Fingerprint Cards AB -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License Version 2 -# as published by the Free Software Foundation. -# - -# HOME --> DPAD_CENTER -#key 102 DPAD_CENTER VIRTUAL -#key 105 DPAD_LEFT VIRTUAL -#key 106 DPAD_RIGHT VIRTUAL - diff --git a/light/Android.bp b/light/Android.bp deleted file mode 100644 index 169baa4..0000000 --- a/light/Android.bp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2019 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. - -cc_binary { - relative_install_path: "hw", - defaults: ["hidl_defaults"], - name: "android.hardware.light@2.0-service.xiaomi_gauguin", - init_rc: ["android.hardware.light@2.0-service.xiaomi_gauguin.rc"], - srcs: ["service.cpp", "Light.cpp"], - vendor: true, - shared_libs: [ - "android.hardware.light@2.0", - "libbase", - "libhardware", - "libhidlbase", - "liblog", - "libutils", - ], -} diff --git a/light/Light.cpp b/light/Light.cpp deleted file mode 100644 index 7a3bf8c..0000000 --- a/light/Light.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (C) 2018-2019 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. - */ - -#define LOG_TAG "LightService" - -#include - -#include "Light.h" - -#include - -#define LCD_LED "/sys/class/backlight/panel0-backlight/" -#define WHITE_LED "/sys/class/leds/white/" - -#define BREATH "breath" -#define BRIGHTNESS "brightness" - -#define MAX_LED_BRIGHTNESS 10 -#define MAX_LCD_BRIGHTNESS 4095 - -namespace { -/* - * Write value to path and close file. - */ -static void set(std::string path, std::string value) { - std::ofstream file(path); - - if (!file.is_open()) { - ALOGW("failed to write %s to %s", value.c_str(), path.c_str()); - return; - } - - file << value; -} - -static void set(std::string path, int value) { - set(path, std::to_string(value)); -} - -static uint32_t getBrightness(const LightState& state) { - uint32_t alpha, red, green, blue; - - /* - * Extract brightness from AARRGGBB. - */ - alpha = (state.color >> 24) & 0xFF; - red = (state.color >> 16) & 0xFF; - green = (state.color >> 8) & 0xFF; - blue = state.color & 0xFF; - - /* - * Scale RGB brightness if Alpha brightness is not 0xFF. - */ - if (alpha != 0xFF) { - red = red * alpha / 0xFF; - green = green * alpha / 0xFF; - blue = blue * alpha / 0xFF; - } - - return (77 * red + 150 * green + 29 * blue) >> 8; -} - -static inline uint32_t scaleBrightness(uint32_t brightness, uint32_t maxBrightness) { - if (brightness == 0) { - return 0; - } - - return (brightness - 1) * (maxBrightness - 1) / (0xFF - 1) + 1; -} - -static inline uint32_t getScaledBrightness(const LightState& state, uint32_t maxBrightness) { - return scaleBrightness(getBrightness(state), maxBrightness); -} - -static void handleBacklight(const LightState& state) { - uint32_t brightness = getScaledBrightness(state, MAX_LCD_BRIGHTNESS); - set(LCD_LED BRIGHTNESS, brightness); -} - -static void handleNotification(const LightState& state) { - uint32_t whiteBrightness = getScaledBrightness(state, MAX_LED_BRIGHTNESS); - - /* Disable breathing or blinking */ - set(WHITE_LED BREATH, 0); - set(WHITE_LED BRIGHTNESS, 0); - - if (!whiteBrightness) { - return; - } - - switch (state.flashMode) { - case Flash::HARDWARE: - case Flash::TIMED: - /* Breathing */ - set(WHITE_LED BREATH, 1); - break; - case Flash::NONE: - default: - set(WHITE_LED BRIGHTNESS, whiteBrightness); - } -} - -static inline bool isStateLit(const LightState& state) { - return state.color & 0x00ffffff; -} - -static inline bool isStateEqual(const LightState& first, const LightState& second) { - if (first.color == second.color && first.flashMode == second.flashMode && - first.flashOnMs == second.flashOnMs && - first.flashOffMs == second.flashOffMs && - first.brightnessMode == second.brightnessMode) { - return true; - } - - return false; -} - -/* Keep sorted in the order of importance. */ -static std::vector backends = { - { Type::ATTENTION, handleNotification }, - { Type::NOTIFICATIONS, handleNotification }, - { Type::BATTERY, handleNotification }, - { Type::BACKLIGHT, handleBacklight }, -}; - -static LightStateHandler findHandler(Type type) { - for (const LightBackend& backend : backends) { - if (backend.type == type) { - return backend.handler; - } - } - - return nullptr; -} - -static LightState findLitState(LightStateHandler handler) { - LightState emptyState; - - for (const LightBackend& backend : backends) { - if (backend.handler == handler) { - if (isStateLit(backend.state)) { - return backend.state; - } - - emptyState = backend.state; - } - } - - return emptyState; -} - -static void updateState(Type type, const LightState& state) { - for (LightBackend& backend : backends) { - if (backend.type == type) { - backend.state = state; - } - } -} - -} // anonymous namespace - -namespace android { -namespace hardware { -namespace light { -namespace V2_0 { -namespace implementation { - -Return Light::setLight(Type type, const LightState& state) { - /* Lock global mutex until light state is updated. */ - std::lock_guard lock(globalLock); - - LightStateHandler handler = findHandler(type); - if (!handler) { - /* If no handler has been found, then the type is not supported. */ - return Status::LIGHT_NOT_SUPPORTED; - } - - /* Find the old state of the current handler. */ - LightState oldState = findLitState(handler); - - /* Update the cached state value for the current type. */ - updateState(type, state); - - /* Find the new state of the current handler. */ - LightState newState = findLitState(handler); - - if (isStateEqual(oldState, newState)) { - return Status::SUCCESS; - } - - handler(newState); - - return Status::SUCCESS; -} - -Return Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb) { - std::vector types; - - for (const LightBackend& backend : backends) { - types.push_back(backend.type); - } - - _hidl_cb(types); - - return Void(); -} - -} // namespace implementation -} // namespace V2_0 -} // namespace light -} // namespace hardware -} // namespace android diff --git a/light/Light.h b/light/Light.h deleted file mode 100644 index 4f102d8..0000000 --- a/light/Light.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2018 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. - */ - -#ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H -#define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H - -#include -#include -#include -#include -#include -#include - -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::hardware::light::V2_0::Flash; -using ::android::hardware::light::V2_0::ILight; -using ::android::hardware::light::V2_0::LightState; -using ::android::hardware::light::V2_0::Status; -using ::android::hardware::light::V2_0::Type; - -typedef void (*LightStateHandler)(const LightState&); - -struct LightBackend { - Type type; - LightState state; - LightStateHandler handler; - - LightBackend(Type type, LightStateHandler handler) : type(type), handler(handler) { - this->state.color = 0xff000000; - } -}; - -namespace android { -namespace hardware { -namespace light { -namespace V2_0 { -namespace implementation { - -class Light : public ILight { - public: - Return setLight(Type type, const LightState& state) override; - Return getSupportedTypes(getSupportedTypes_cb _hidl_cb) override; - - private: - std::mutex globalLock; -}; - -} // namespace implementation -} // namespace V2_0 -} // namespace light -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H diff --git a/light/android.hardware.light@2.0-service.xiaomi_gauguin.rc b/light/android.hardware.light@2.0-service.xiaomi_gauguin.rc deleted file mode 100644 index 6495560..0000000 --- a/light/android.hardware.light@2.0-service.xiaomi_gauguin.rc +++ /dev/null @@ -1,7 +0,0 @@ -service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.xiaomi_gauguin - interface android.hardware.light@2.0::ILight default - class hal - user system - group system - # shutting off lights while powering-off - shutdown critical diff --git a/light/service.cpp b/light/service.cpp deleted file mode 100644 index c2fa9da..0000000 --- a/light/service.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2018 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. - */ - -#define LOG_TAG "android.hardware.light@2.0-service.xiaomi_gauguin" - -#include - -#include "Light.h" - -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; - -using android::hardware::light::V2_0::ILight; -using android::hardware::light::V2_0::implementation::Light; - -using android::OK; -using android::sp; -using android::status_t; - -int main() { - sp service = new Light(); - - configureRpcThreadpool(1, true); - - status_t status = service->registerAsService(); - if (status != OK) { - ALOGE("Cannot register Light HAL service."); - return 1; - } - - ALOGI("Light HAL service ready."); - - joinRpcThreadpool(); - - ALOGI("Light HAL service failed to join thread pool."); - return 1; -} diff --git a/manifest.xml b/manifest.xml index 4eafca7..35e687f 100644 --- a/manifest.xml +++ b/manifest.xml @@ -572,33 +572,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. default - - vendor.xiaomi.hardware.fingerprintextension - hwbinder - 1.0 - - IXiaomiFingerprint - default - - - - vendor.xiaomi.hardware.touchfeature - hwbinder - 1.0 - - ITouchFeature - default - - - - vendor.xiaomi.hardware.fx.tunnel - hwbinder - 1.0 - - IMiFxTunnel - default - - com.fingerprints.extension hwbinder diff --git a/parts/Android.bp b/parts/Android.bp deleted file mode 100644 index 9740143..0000000 --- a/parts/Android.bp +++ /dev/null @@ -1,29 +0,0 @@ -// -// Copyright (C) 2017-2020 The LineageOS Project -// -// SPDX-License-Identifier: Apache-2.0 -// - -android_app { - name: "XiaomiParts", - defaults: [ - "SettingsLibDefaults", - ], - - srcs: ["src/**/*.java"], - resource_dirs: ["res"], - certificate: "platform", - platform_apis: true, - system_ext_specific: true, - privileged: true, - - static_libs: [ - "androidx.core_core", - "androidx.preference_preference", - "org.lineageos.settings.resources", - ], - - optimize: { - proguard_flags_files: ["proguard.flags"], - }, -} diff --git a/parts/AndroidManifest.xml b/parts/AndroidManifest.xml deleted file mode 100644 index a733faf..0000000 --- a/parts/AndroidManifest.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/parts/proguard.flags b/parts/proguard.flags deleted file mode 100644 index a26c06d..0000000 --- a/parts/proguard.flags +++ /dev/null @@ -1,7 +0,0 @@ --keep class org.lineageos.settings.dirac.* { - *; -} - --keep class org.lineageos.settings.doze.* { - *; -} diff --git a/parts/res/values/arrays.xml b/parts/res/values/arrays.xml deleted file mode 100644 index 05a8fb6..0000000 --- a/parts/res/values/arrays.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - @string/dirac_headset_default - @string/dirac_headset_earbuds - @string/dirac_headset_in_ear_2013 - @string/dirac_headset_piston_1 - @string/dirac_headset_general - @string/dirac_headset_general_inear - @string/dirac_headset_piston_basic - @string/dirac_headset_piston_2 - @string/dirac_headset_piston_standard - @string/dirac_headset_headphone - @string/dirac_headset_piston_youth - @string/dirac_headset_piston_color - @string/dirac_headset_in_ear - @string/dirac_headset_capsule - @string/dirac_headset_in_ear_pro - @string/dirac_headset_comfort - @string/dirac_headset_reduction_noise - @string/dirac_headset_cancelling - @string/dirac_headset_half_in_ear - @string/dirac_headset_in_ear2 - @string/dirac_headset_earphone_basic - @string/dirac_headset_earphone - - - - 0 - 1 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - - - - - @string/dirac_preset_default - @string/dirac_preset_rock - @string/dirac_preset_jazz - @string/dirac_preset_pop - @string/dirac_preset_classical - @string/dirac_preset_hiphop - @string/dirac_preset_blues - @string/dirac_preset_electronic - @string/dirac_preset_country - @string/dirac_preset_dance - @string/dirac_preset_metal - - - - "0,0,0,0,0,0,0" - "4,2,-2,0,-2,-2,4" - "0,0,0,-2,-3,0,0" - "0,-3,-5,0,0,-3,0" - "0,0,0,0,3,6,6" - "3,3,-3,0,-3,0,2" - "2,4,-6,4,0,1,2" - "3,3,-1,0,-3,0,0" - "0,0,-2,-2,2,2,0" - "0,4,2,0,-2,-2,4" - "2,0,0,-2,-4,0,0" - - diff --git a/parts/res/values/strings.xml b/parts/res/values/strings.xml deleted file mode 100644 index e2245a7..0000000 --- a/parts/res/values/strings.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Use ambient display - - - Enable dirac - Dirac sound enhancer - Optimize sound quality with Dirac, Hi-Fi - Headset type - Enable Hi-Fi - Sound preset - - Hi-Fi - Decrease noise and Distortion and increase audio quality - - Default - Mi Earbuds - Mi In-Ear (2013) - Mi Piston 1 - General Earbuds - General In-Ear - Basic Edition - Mi Piston 2 - Mi Piston 3 - Mi Headphone - Youth Edition - Color Edition - Mi In-Ear - Mi Capsule - Mi In-Ear Pro - Mi Comfort - Mi Noise Cancelling (Type-C) - Mi Noise Cancelling (3.5mm) - Mi Half In-Ear - Mi In-Ear 2 - Mi Earphones Basic - Mi Earphones - - Default - Rock - Jazz - Pop - Classical - Hiphop - Blues - Electronic - Country - Dance - Metal - diff --git a/parts/res/values/styles.xml b/parts/res/values/styles.xml deleted file mode 100644 index aab73c8..0000000 --- a/parts/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - -