From 2ab819e7c71d954c2a3e09bf3e53c7c229334b1f Mon Sep 17 00:00:00 2001 From: Sebastiano Barezzi Date: Mon, 23 Jan 2023 14:03:01 +0000 Subject: [PATCH] raphael: Checkout NFC to LOS sm8150-common tree * From https://github.com/LineageOS/android_device_xiaomi_sm8150-common. Revert "raphael: build some NFC packages" This reverts commit bbee1443e188cd5cfb08c25bcb26deebe920d652. --- BoardConfig.mk | 11 +- configs/nfc/libnfc-nci.conf | 14 +- configs/nfc/libnfc-nxp.conf | 14 +- configs/nfc/libnfc-nxp_RF.conf | 189 ++++++++++++++++++++++++++ device.mk | 31 +++-- hidl/manifest.xml | 12 -- hidl/manifest_ese.xml | 12 ++ hidl/manifest_nfc.xml | 6 +- init/Android.bp | 16 --- init/init_raphael.cpp | 109 --------------- libinit/Android.bp | 25 ++++ libinit/include/libinit_dalvik_heap.h | 23 ++++ libinit/include/libinit_utils.h | 18 +++ libinit/include/libinit_variant.h | 36 +++++ libinit/init_xiaomi_raphael.cpp | 62 +++++++++ libinit/libinit_dalvik_heap.cpp | 67 +++++++++ libinit/libinit_utils.cpp | 67 +++++++++ libinit/libinit_variant.cpp | 48 +++++++ rootdir/etc/init.qcom.rc | 6 + rootdir/etc/init.target.rc | 1 + rootdir/etc/init.xiaomi.rc | 32 +++-- sepolicy/vendor/file_contexts | 3 + sepolicy/vendor/hal_nfc_default.te | 6 +- sepolicy/vendor/hwservice_contexts | 12 +- 24 files changed, 629 insertions(+), 191 deletions(-) create mode 100644 configs/nfc/libnfc-nxp_RF.conf create mode 100644 hidl/manifest_ese.xml delete mode 100644 init/Android.bp delete mode 100644 init/init_raphael.cpp create mode 100644 libinit/Android.bp create mode 100644 libinit/include/libinit_dalvik_heap.h create mode 100644 libinit/include/libinit_utils.h create mode 100644 libinit/include/libinit_variant.h create mode 100644 libinit/init_xiaomi_raphael.cpp create mode 100644 libinit/libinit_dalvik_heap.cpp create mode 100644 libinit/libinit_utils.cpp create mode 100644 libinit/libinit_variant.cpp diff --git a/BoardConfig.mk b/BoardConfig.mk index 58cbc860..5cbb5807 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -77,12 +77,15 @@ DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \ vendor/evolution/config/device_framework_matrix.xml DEVICE_MANIFEST_FILE := $(DEVICE_PATH)/hidl/manifest.xml DEVICE_MATRIX_FILE := $(DEVICE_PATH)/hidl/compatibility_matrix.xml -ODM_MANIFEST_SKUS += raphael -ODM_MANIFEST_RAPHAEL_FILES := $(DEVICE_PATH)/hidl/manifest_nfc.xml +ODM_MANIFEST_SKUS += nfc nfc_ese +ODM_MANIFEST_NFC_FILES := $(DEVICE_PATH)/hidl/manifest_nfc.xml +ODM_MANIFEST_NFC_ESE_FILES := \ + $(DEVICE_PATH)/hidl/manifest_nfc.xml \ + $(DEVICE_PATH)/hidl/manifest_ese.xml # Init -TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_raphael -TARGET_RECOVERY_DEVICE_MODULES := libinit_raphael +TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):init_xiaomi_raphael +TARGET_RECOVERY_DEVICE_MODULES ?= init_xiaomi_raphael # Kernel BOARD_KERNEL_BASE := 0x00000000 diff --git a/configs/nfc/libnfc-nci.conf b/configs/nfc/libnfc-nci.conf index 40895539..3af3081c 100644 --- a/configs/nfc/libnfc-nci.conf +++ b/configs/nfc/libnfc-nci.conf @@ -12,7 +12,7 @@ NFC_DEBUG_ENABLED=1 ############################################################################### # File used for NFA storage -NFA_STORAGE="/data/vendor/nfc" +NFA_STORAGE="/data/nfc" ############################################################################### # Configure the default NfcA/IsoDep techology and protocol route. Can be @@ -124,15 +124,3 @@ DEFAULT_SYS_CODE={FE:FF} ######################################################################### #Set NCI credit notification timeout value NXP_NCI_CREDIT_NTF_TIMEOUT=2 - -############################################################################### -# Nfc recovery implementation -# 0: Crash Nfc Service -# 1: Toggle Nfc state -RECOVERY_OPTION=1 - -############################################################################### -# Mifare Tag implementation -# 0: General implementation -# 1: Legacy implementation -LEGACY_MIFARE_READER=1 diff --git a/configs/nfc/libnfc-nxp.conf b/configs/nfc/libnfc-nxp.conf index 671d7b22..e11344f9 100644 --- a/configs/nfc/libnfc-nxp.conf +++ b/configs/nfc/libnfc-nxp.conf @@ -7,13 +7,13 @@ # ANDROID_LOG_WARN 0x02 # ANDROID_LOG_ERROR 0x01 # ANDROID_LOG_SILENT 0x00 -NXPLOG_EXTNS_LOGLEVEL=0x02 -NXPLOG_NCIHAL_LOGLEVEL=0x02 -NXPLOG_NCIX_LOGLEVEL=0x02 -NXPLOG_NCIR_LOGLEVEL=0x02 -NXPLOG_FWDNLD_LOGLEVEL=0x02 -NXPLOG_TML_LOGLEVEL=0x02 -NFC_DEBUG_ENABLED=0x00 +NXPLOG_EXTNS_LOGLEVEL=0x03 +NXPLOG_NCIHAL_LOGLEVEL=0x03 +NXPLOG_NCIX_LOGLEVEL=0x03 +NXPLOG_NCIR_LOGLEVEL=0x03 +NXPLOG_FWDNLD_LOGLEVEL=0x03 +NXPLOG_TML_LOGLEVEL=0x03 +NFC_DEBUG_ENABLED=1 ############################################################################### # Nfc Device Node name diff --git a/configs/nfc/libnfc-nxp_RF.conf b/configs/nfc/libnfc-nxp_RF.conf new file mode 100644 index 00000000..16c5d4ef --- /dev/null +++ b/configs/nfc/libnfc-nxp_RF.conf @@ -0,0 +1,189 @@ +############################################################## +## libnfc-nxp_RF.conf FW15 modify by Kevin 5th, Dec 2018###### +## libnfc-nxp_RF.conf FW15 Hybrid mode 12th, Dec 2018######### +## libnfc-nxp_RF.conf FW17 enable LPCD 22th,Feb 2019######### +## libnfc-nxp_RF.conf FW17 add EMVCO RF parameters 1st,March 2019######### +## libnfc-nxp_RF.conf FW17 open DLMA which is used on F1/E5G 3rd,Apr 2019######### +## libnfc-nxp_RF.conf set DCDC to 5v 15th,Apr 2019######### +############################################################################### +# NXP RF configuration ALM/PLM settings +# This section needs to be updated with the correct values based on the platform +#PMU_CFG + +NXP_RF_CONF_BLK_1={20, 02, 53, 03, + A0, 0E, 2C, F0, 00, 3E, 11, E4, E4, E4, 00, 00, 00, 00, 00, A7, 8E, FF, FF, 23, 23, 23, 23, 0A, 00, 00, 00, 00, 02, 00, 00, 01, 00, 10, 00, 04, 00, 00, 00, 17, 40, FF, 07, 13, 07, 05, 13, + A0, A5, 0D, 3B, 3B, 3B, 3B, 3B, 3B, FF, 03, 1F, 00, 00, 00, 00, + A0, 6A, 10, 00, 00, 00, 00, 00, 00, 00, 00, B4, 00, B4, 00, B4, 00, B4, 00 +} + +NXP_RF_CONF_BLK_2={20, 02, ED, 04, + A0, AF, 09, 11, 2F, 00, 2A, 11, 2F, 00, 2A, 00, + A0, 98, 05, 2F, 97, 1C, 80, 2A, + A0, 34, C8, 23, 04, 3D, 01, 00, 18, DE, 0C, 00, 00, DE, 0C, 00, 00, DE, 0C, 00, 00, DE, 0C, 00, 00, DE, 0C, 00, 00, DE, 0C, 00, 00, DE, 0C, 00, 00, DE, 0C, 00, 00, DE, 11, 00, 00, 71, 15, 00, 00, 71, 15, 00, 00, 71, 15, 00, 00, 04, 19, 00, 00, CE, 1A, 00, 00, 60, 1E, 00, 00, 2A, 20, 00, 00, 98, 3A, 00, 00, 98, 3A, 00, 00, 98, 3A, 00, 00, 98, 3A, 00, 00, 98, 3A, 00, 00, 98, 3A, 00, 00, 98, 3A, 00, 00, 98, 3A, 00, 00, 00, 18, 40, 06, 00, 00, 6C, 07, 00, 00, 6C, 07, 00, 00, 66, 08, 00, 00, 66, 08, 00, 00, 92, 09, 00, 00, 92, 09, 00, 00, B8, 0B, 00, 00, C0, 0D, 00, 00, C0, 0D, 00, 00, 4A, 10, 00, 00, 4A, 10, 00, 00, 4A, 10, 00, 00, 4A, 10, 00, 00, 4A, 10, 00, 00, 4A, 10, 00, 00, 4A, 10, 00, 00, 64, 14, 00, 00, 64, 14, 00, 00, 64, 14, 00, 00, 64, 14, 00, 00, 64, 14, 00, 00, 64, 14, 00, 00, 64, 14, 00, 00, +A0, 9E, 0A, 03, 97, 1C, 64, 00, 96, 00, 2B, 52, 03} + +NXP_RF_CONF_BLK_3={20, 02, F1, 01, A0, A9, ED, 00, 2A, FF, 01, 24, FF, 02, 1F, FF, 03, 1A, FF, 04, 16, FF, 05, 12, FF, 06, 0F, FF, 07, 0C, FF, 08, 09, FF, 09, 07, FF, 0A, 05, FF, 0B, 03, FF, 0C, 01, FF, 0D, 00, F5, 0E, 00, DC, 0F, 00, C6, 10, 00, B3, 11, 00, A2, 12, 00, 92, 13, 00, 84, 14, 00, 77, 15, 00, 6B, 16, 00, 60, 17, 00, 57, 18, 00, 4E, 19, 00, 46, 1A, 00, 3F, 1B, 00, 39, 1C, 00, 33, 1D, 00, 2E, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A, 1E, 00, 2A} + + +NXP_RF_CONF_BLK_4={20, 02, C5, 02, + A0, 0B, BB, 00, 1D, 01, 14, 6A, 2A, E8, 03, E8, 03, 06, 10, 0E, 2C, 01, 78, 13, 00, 00, 78, 13, 00, 00, 78, 13, 00, 00, 78, 13, 00, 00, 78, 13, 00, 00, 78, 13, 00, 00, 78, 13, 00, 00, 78, 0A, 00, 00, 78, 0A, 00, 00, 78, 0A, 00, 00, 78, 0A, 00, 00, 78, 0A, 00, 00, 78, 0A, 00, 00, 78, 0A, 00, 00, 78, 0A, 00, 00, 78, 0A, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 78, 00, 00, 00, 3C, 00, 00, 00, 3C, 00, 00, 00, 3C, 00, 00, 00, 00, 00, 00, 00, + A0, A6, 03, C0, 08, 08 +} + +NXP_RF_CONF_BLK_5={20, 02, D8, 04, + A0, AB, 82, 27, 1B, 33, 04, 42, 04, 55, 04, 75, 04, 9E, 04, C7, 04, F0, 04, 20, 05, 4F, 05, 7F, 05, B8, 05, F2, 05, 2B, 06, 72, 06, BA, 06, 02, 07, 49, 07, 91, 07, F0, 07, 50, 08, AF, 08, 0F, 09, 6E, 09, E1, 09, 54, 0A, C6, 0A, 56, 0B, E5, 0B, 74, 0C, 04, 0D, 93, 0D, 52, 0E, 11, 0F, D0, 0F, 8F, 10, 4F, 11, 0E, 12, 2C, 13, 4B, 14, 6A, 15, 88, 16, A7, 17, C6, 18, 44, 1A, C2, 1B, 41, 1D, BF, 1E, 9D, 20, 7B, 22, 58, 24, 96, 26, D3, 28, 11, 2B, 4E, 2D, 4B, 30, 47, 33, 44, 36, 40, 39, 3D, 3C, A2, 3F, 07, 43, 6C, 46, E6, 4A, 61, 4F, + A0, A7, 0B, 00, 02, 77, 17, 1F, 1F, 1F, 0A, FF, 19, 05, + A0, A8, 38, 00, 33, 33, 10, 00, 33, 23, 10, 00, 33, 24, 10, 4B, 23, 44, 10, CF, 22, 43, 10, CF, 22, 43, 10, CF, 22, 43, 10, CE, 22, 43, 10, CF, 22, 43, 10, CE, 22, 43, 10, 00, 33, 22, 10, C0, 22, 23, 10, 00, 33, 22, 10, C0, 22, 23, 10, + A0, 1F, 06, 63, 00, 42, 00, 14, 00 +} + +NXP_RF_CONF_BLK_6={ + 20, 02, F8, 19, + A0, 99, 07, 03, 00, 80, 00, 00, 80, 00, + A0, 68, 2A, 06, 40, 60, 03, 19, 00, 00, 00, 00, 83, 04, 00, C0, 05, 00, 0F, E0, 00, 00, 0F, A0, 00, A0, 00, 03, FA, 00, 00, 00, 4C, 00, 14, 00, 7D, 00, 05, 7F, 00, 00, 01, 00, 03, + A0, 0D, 03, 24, 29, 07, + A0, 0D, 03, 24, 30, 07, + A0, 0D, 03, 25, 29, 01, + A0, 0D, 03, 25, 30, 01, + A0, 0D, 06, 40, 42, F0, C1, 37, CC, + A0, 0D, 06, 41, 45, 31, 12, 00, 00, + A0, 0D, 03, 42, 7C, 54, + A0, 0D, 06, 42, 8D, 00, A0, A4, 64, + A0, 0D, 06, 42, 8B, 00, A2, 23, 00, + A0, 0D, 06, 42, 89, 7F, 12, BD, 01, + A0, 0D, 06, 42, 44, 00, B0, 26, 01, + A0, 0D, 06, 42, 43, A5, 24, 4D, ED, + A0, 0D, 06, 42, 41, FF, FF, 5F, F0, + A0, 0D, 06, 42, 40, 20, 77, 33, 3A, + A0, 0D, 06, 42, 4A, 0E, 83, 81, 0D, + A0, 0D, 06, 42, 49, 79, 46, 26, 00, + A0, 0D, 06, 51, 40, 12, 77, 33, 3A, + A0, 0D, 06, 43, 44, 00, 34, 12, 01, + A0, 0D, 06, 43, 43, A5, 64, 4C, AD, + A0, 0D, 06, 43, 40, 05, 77, 33, 3D, + A0, 0D, 06, 43, 4A, 00, 00, 00, 00, + A0, 0D, 06, 43, 49, 00, 00, 00, 00, + A0, 0D, 06, 44, 44, 00, 34, 12, 01 +} + +NXP_RF_CONF_BLK_7={ + 20, 02, FD, 1C, + A0, 0D, 06, 44, 43, A5, 64, 4C, AD, + A0, 0D, 06, 44, 40, 05, 77, 33, 3D, + A0, 0D, 06, 44, 4A, 00, 00, 00, 00, + A0, 0D, 06, 44, 49, 00, 00, 00, 00, + A0, 0D, 06, 45, 44, 00, 34, 12, 01, + A0, 0D, 06, 45, 43, A5, 64, 4C, AD, + A0, 0D, 06, 45, 40, 05, 77, 33, 3D, + A0, 0D, 06, 45, 4A, 00, 00, 00, 00, + A0, 0D, 06, 45, 49, 00, 00, 00, 00, + A0, 0D, 06, 46, 45, 39, 12, 00, 00, + A0, 0D, 06, 46, 44, 00, 34, 12, 01, + A0, 0D, 06, 47, 43, A5, 64, 4C, ED, + A0, 0D, 06, 47, 40, 05, 77, 33, 3D, + A0, 0D, 06, 47, 4A, 20, AA, 0B, 81, + A0, 0D, 06, 47, 49, B5, 44, 22, 00, + A0, 0D, 06, 48, 43, A5, 64, 4C, AD, + A0, 0D, 06, 48, 40, 05, 77, 33, 3D, + A0, 0D, 06, 48, 4A, 00, 00, 00, 00, + A0, 0D, 06, 48, 49, 00, 00, 00, 00, + A0, 0D, 06, 49, 43, A5, 64, 4C, AD, + A0, 0D, 06, 49, 40, 05, 77, 33, 3D, + A0, 0D, 06, 49, 4A, 00, 00, 00, 00, + A0, 0D, 06, 49, 49, 00, 00, 00, 00, + A0, 0D, 06, 4A, 8B, 48, 02, F0, 80, + A0, 0D, 06, 4A, 43, A5, 64, 4C, AD, + A0, 0D, 06, 4A, 40, 05, 77, 33, 3D, + A0, 0D, 06, 4A, 4A, 00, 00, 00, 00, + A0, 0D, 06, 4A, 49, 00, 00, 00, 00 +} + +NXP_RF_CONF_BLK_8={ + 20, 02, C4, 16, + A0, 0D, 06, 4B, 43, A5, 64, 4C, 6D, + A0, 0D, 06, 4B, 40, 85, 51, 33, 3D, + A0, 0D, 06, 4C, 44, 00, 34, 12, 01, + A0, 0D, 06, 4C, 4A, 00, 00, 00, 00, + A0, 0D, 06, 4C, 49, 00, 00, 00, 00, + A0, 0D, 06, 4D, 44, 00, 34, 12, 01, + A0, 0D, 06, 4D, 4A, 00, 00, 00, 00, + A0, 0D, 06, 4D, 49, 00, 00, 00, 00, + A0, 0D, 06, 4E, 45, 31, 12, 00, 00, + A0, 0D, 03, 4E, 7C, 50, + A0, 0D, 06, 4E, 8D, 00, 00, 00, 06, + A0, 0D, 06, 4E, 8B, 00, A2, 24, 00, + A0, 0D, 06, 4E, 89, 7D, 84, 05, 08, + A0, 0D, 06, 4E, 44, 00, B0, 26, 01, + A0, 0D, 06, 4E, 43, A5, 64, 5C, AD, + A0, 0D, 06, 4E, 41, FF, FF, 5F, F0, + A0, 0D, 06, 4E, 40, 07, 77, 33, 3D, + A0, 0D, 06, 4E, 4A, 2A, 8E, 8D, 2A, + A0, 0D, 06, 4E, 49, 5D, 27, 27, 00, + A0, 0D, 06, 60, 4E, FF, FF, FF, 01, + A0, 0D, 06, 60, 4F, FF, FF, FF, 01, + A0, 0D, 06, 60, 50, FF, FF, FF, 3F +} + +NXP_RF_CONF_BLK_9={20, 02, 4F, 09, + A0, 0D, 03, 61, 09, 7E, + A0, 0D, 06, 60, AB, FF, FF, 00, 00, + A0, 0D, 06, 60, 95, FF, FF, 0F, 00, + A0, 0D, 06, 60, 97, FF, FF, 0F, 00, + A0, 0D, 06, 60, 4C, 20, 0A, 00, 00, + A0, 0D, 06, 82, 82, 47, 80, 00, 00, + A0, 0D, 06, 80, 82, 47, 80, 00, 00, + A0, 0D, 06, 62, 32, AE, 00, 7F, 00, + A0, 0D, 06, 67, 32, AE, 00, 1F, 00 +} + +NXP_RF_CONF_MAX_NUM=9 + +############################################################################### +# Core configuration extensions +# It includes +# Wired mode settings A0ED, A0EE +# Tag Detector A040, A041, A043 +# Low Power mode A007 +# Clock settings A002, A003 +# PbF settings A008 +# Clock timeout settings A004 +# eSE (SVDD) PWR REQ settings A0F2 +# Window size A0D8 +# DWP Speed A0D5 +# How eSE connected to PN553 A012 +# UICC2 bit rate A0D1 +# SWP1A interface A0D4 +# DWP intf behavior config, SVDD Load activated by default if set to 0x31 A037 +NXP_CORE_CONF_EXTN={20, 02, 12, 04, + A0, EC, 01, 01, + A0, ED, 01, 01, + A0, 07, 01, 01, + A0, 47, 02, 00, 27 +} + +# A0, 40, 01, 00 +# A0, 41, 01, 02, +# A0, 43, 01, 04, +# } + +############################################################################### +# Core configuration settings +NXP_CORE_CONF={ 20, 02, 30, 10, + 28, 01, 00, + 21, 01, 00, + 30, 01, 04, + 31, 01, 00, + 32, 01, 60, + 38, 01, 01, + 33, 00, + 54, 01, 06, + 50, 01, 02, + 5B, 01, 00, + 80, 01, 01, + 81, 01, 01, + 82, 01, 0E, + 18, 01, 01, + 68, 01, 01, + 85, 01, 01 + } +############################################################################### diff --git a/device.mk b/device.mk index 67b843dd..729e0038 100644 --- a/device.mk +++ b/device.mk @@ -54,11 +54,6 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml \ frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml \ frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml \ - frameworks/native/data/etc/android.hardware.nfc.ese.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_raphael/android.hardware.nfc.ese.xml \ - frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_raphael/android.hardware.nfc.hce.xml \ - frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_raphael/android.hardware.nfc.hcef.xml \ - frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_raphael/android.hardware.nfc.uicc.xml \ - frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_raphael/android.hardware.nfc.xml \ frameworks/native/data/etc/android.hardware.opengles.aep.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.opengles.aep.xml \ frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \ frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \ @@ -86,9 +81,7 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.software.opengles.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml \ frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \ frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml \ - frameworks/native/data/etc/android.software.vulkan.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ - frameworks/native/data/etc/com.android.nfc_extras.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_raphael/com.android.nfc_extras.xml \ - frameworks/native/data/etc/com.nxp.mifare.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_raphael/com.nxp.mifare.xml + frameworks/native/data/etc/android.software.vulkan.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml # Adaptive Suspend PRODUCT_PROPERTY_OVERRIDES += \ @@ -332,17 +325,33 @@ PRODUCT_PACKAGES += \ android.hardware.nfc@1.2-service \ com.android.nfc_extras \ libchrome.vendor \ - vendor.nxp.hardware.nfc@2.0-service \ - vendor.nxp.nxpnfclegacy@1.0 \ NfcNci \ SecureElement \ Tag +PRODUCT_COPY_FILES += \ + $(call find-copy-subdir-files,*,$(LOCAL_PATH)/configs/nfc/,$(TARGET_COPY_OUT_VENDOR)/etc) + PRODUCT_PACKAGES += \ android.hardware.secure_element@1.2.vendor PRODUCT_COPY_FILES += \ - $(call find-copy-subdir-files,*,$(LOCAL_PATH)/configs/nfc/,$(TARGET_COPY_OUT_VENDOR)/etc) + frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/android.hardware.nfc.hce.xml \ + frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/android.hardware.nfc.hcef.xml \ + frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/android.hardware.nfc.uicc.xml \ + frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/android.hardware.nfc.xml \ + frameworks/native/data/etc/android.hardware.se.omapi.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/android.hardware.se.omapi.uicc.xml \ + frameworks/native/data/etc/com.android.nfc_extras.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/com.android.nfc_extras.xml + +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.nfc.ese.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc_ese/android.hardware.nfc.ese.xml \ + frameworks/native/data/etc/android.hardware.nfc.hce.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc_ese/android.hardware.nfc.hce.xml \ + frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc_ese/android.hardware.nfc.hcef.xml \ + frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc_ese/android.hardware.nfc.uicc.xml \ + frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc_ese/android.hardware.nfc.xml \ + frameworks/native/data/etc/android.hardware.se.omapi.ese.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc_ese/android.hardware.se.omapi.ese.xml \ + frameworks/native/data/etc/android.hardware.se.omapi.uicc.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc_ese/android.hardware.se.omapi.uicc.xml \ + frameworks/native/data/etc/com.android.nfc_extras.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc_ese/com.android.nfc_extras.xml # OMX PRODUCT_PACKAGES += \ diff --git a/hidl/manifest.xml b/hidl/manifest.xml index 4bb6cadd..23c730d9 100644 --- a/hidl/manifest.xml +++ b/hidl/manifest.xml @@ -199,11 +199,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @2.2::IFactory/default @2.3::IFactory/default - - vendor.qti.esepowermanager - hwbinder - @1.1::IEsePowerManager/default - android.hardware.radio hwbinder @@ -217,13 +212,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. hwbinder @1.1::IRadioConfig/default - - android.hardware.secure_element - hwbinder - @1.2::ISecureElement/SIM1 - @1.2::ISecureElement/SIM2 - @1.2::ISecureElement/eSE1 - vendor.qti.hardware.fm hwbinder diff --git a/hidl/manifest_ese.xml b/hidl/manifest_ese.xml new file mode 100644 index 00000000..4c48d1b0 --- /dev/null +++ b/hidl/manifest_ese.xml @@ -0,0 +1,12 @@ + + + android.hardware.secure_element + hwbinder + @1.2::ISecureElement/eSE1 + + + vendor.qti.esepowermanager + hwbinder + @1.1::IEsePowerManager/default + + diff --git a/hidl/manifest_nfc.xml b/hidl/manifest_nfc.xml index 3edd4f2c..f062a7b5 100644 --- a/hidl/manifest_nfc.xml +++ b/hidl/manifest_nfc.xml @@ -1,12 +1,12 @@ - + android.hardware.nfc hwbinder @1.2::INfc/default - vendor.nxp.hardware.nfc + vendor.nxp.nxpnfc hwbinder - @2.0::INqNfc/default + @1.0::INxpNfc/default diff --git a/init/Android.bp b/init/Android.bp deleted file mode 100644 index 47ba7686..00000000 --- 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_raphael", - srcs: ["init_raphael.cpp"], - shared_libs: ["libbase"], - recovery_available: true, - include_dirs: [ - "system/core/init", - "system/libbase/include" - ] -} diff --git a/init/init_raphael.cpp b/init/init_raphael.cpp deleted file mode 100644 index 2b1012ed..00000000 --- a/init/init_raphael.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2021, The LineageOS Project - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#include -#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ -#include -#include -#include -#include - -#include "property_service.h" -#include "vendor_init.h" - -void property_override(char const prop[], char const value[], bool add = true) { - prop_info *pi; - - pi = (prop_info *)__system_property_find(prop); - if (pi) - __system_property_update(pi, value, strlen(value)); - else if (add) - __system_property_add(prop, strlen(prop), value, strlen(value)); -} - -void load_dalvikvm_properties() { - struct sysinfo sys; - sysinfo(&sys); - if (sys.totalram > 8192ull * 1024 * 1024) { - // from - phone-xhdpi-12288-dalvik-heap.mk - property_override("dalvik.vm.heapstartsize", "24m"); - property_override("dalvik.vm.heapgrowthlimit", "384m"); - property_override("dalvik.vm.heaptargetutilization", "0.42"); - property_override("dalvik.vm.heapmaxfree", "56m"); - } else if (sys.totalram > 6144ull * 1024 * 1024) { - // from - phone-xhdpi-8192-dalvik-heap.mk - property_override("dalvik.vm.heapstartsize", "24m"); - property_override("dalvik.vm.heapgrowthlimit", "256m"); - property_override("dalvik.vm.heaptargetutilization", "0.46"); - property_override("dalvik.vm.heapmaxfree", "48m"); - } -} - -std::vector ro_props_default_source_order = { - "", "bootimage.", "odm.", "product.", "system.", "system_ext.", "vendor.", -}; - -void set_ro_build_prop(const std::string& prop, const std::string& value) { - for (const auto& source : ro_props_default_source_order) { - auto prop_name = "ro." + source + "build." + prop; - if (source == "") - property_override(prop_name.c_str(), value.c_str()); - else - property_override(prop_name.c_str(), value.c_str(), false); - } -}; - -void set_ro_product_prop(const std::string& prop, const std::string& value) { - for (const auto& source : ro_props_default_source_order) { - auto prop_name = "ro.product." + source + prop; - property_override(prop_name.c_str(), value.c_str(), false); - } -}; - -void vendor_load_properties() { - std::string region = android::base::GetProperty("ro.boot.hwc", "GLOBAL"); - std::string hardware_revision = android::base::GetProperty("ro.boot.hwversion", "UNKNOWN"); - - std::string model; - std::string device; - std::string fingerprint; - std::string description; - std::string mod_device; - - if (region == "GLOBAL") { - model = "Mi 9T Pro"; - device = "raphael"; - description = "raphael-user 11 RKQ1.200826.002 V12.5.2.0.RFKMIXM release-keys"; - mod_device = "raphael_global"; - } else if (region == "CN") { - model = "Redmi K20 Pro"; - device = "raphael"; - description = "raphael-user 11 RKQ1.200826.002 V12.5.5.0.RFKCNXM release-keys"; - } else if (region == "INDIA") { - model = "Redmi K20 Pro"; - device = "raphaelin"; - description = "raphaelin-user 11 RKQ1.200826.002 V12.5.1.0.RFKINXM release-keys"; - mod_device = "raphaelin_in_global"; - } - - set_ro_product_prop("device", device); - set_ro_product_prop("model", model); - property_override("ro.build.description", description.c_str()); - if (mod_device != "") { - property_override("ro.product.mod_device", mod_device.c_str()); - } - - property_override("ro.boot.hardware.revision", hardware_revision.c_str()); - - // dalvikvm props - load_dalvikvm_properties(); -} diff --git a/libinit/Android.bp b/libinit/Android.bp new file mode 100644 index 00000000..4142deef --- /dev/null +++ b/libinit/Android.bp @@ -0,0 +1,25 @@ +// +// Copyright (C) 2021 The LineageOS Project +// +// SPDX-License-Identifier: Apache-2.0 +// + +cc_library_static { + name: "libinit_xiaomi_raphael", + srcs: [ + "libinit_dalvik_heap.cpp", + "libinit_variant.cpp", + "libinit_utils.cpp", + ], + whole_static_libs: ["libbase"], + export_include_dirs: ["include"], + recovery_available: true, +} + +cc_library_static { + name: "init_xiaomi_raphael", + srcs: ["init_xiaomi_raphael.cpp"], + whole_static_libs: ["libinit_xiaomi_raphael"], + include_dirs: ["system/core/init"], + recovery_available: true, +} diff --git a/libinit/include/libinit_dalvik_heap.h b/libinit/include/libinit_dalvik_heap.h new file mode 100644 index 00000000..75144b27 --- /dev/null +++ b/libinit/include/libinit_dalvik_heap.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef LIBINIT_DALVIK_HEAP_H +#define LIBINIT_DALVIK_HEAP_H + +#include + +typedef struct dalvik_heap_info { + std::string heapstartsize; + std::string heapgrowthlimit; + std::string heapsize; + std::string heapminfree; + std::string heapmaxfree; + std::string heaptargetutilization; +} dalvik_heap_info_t; + +void set_dalvik_heap(void); + +#endif // LIBINIT_DALVIK_HEAP_H diff --git a/libinit/include/libinit_utils.h b/libinit/include/libinit_utils.h new file mode 100644 index 00000000..09ec9765 --- /dev/null +++ b/libinit/include/libinit_utils.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef LIBINIT_UTILS_H +#define LIBINIT_UTILS_H + +#include + +void property_override(std::string prop, std::string value, bool add = true); + +void set_ro_build_prop(const std::string &prop, const std::string &value, bool product = false); + +const std::string fingerprint_to_description(const std::string &fingerprint); + +#endif // LIBINIT_UTILS_H diff --git a/libinit/include/libinit_variant.h b/libinit/include/libinit_variant.h new file mode 100644 index 00000000..8b1cd098 --- /dev/null +++ b/libinit/include/libinit_variant.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef LIBINIT_VARIANT_H +#define LIBINIT_VARIANT_H + +#include +#include + +enum nfc_type { + NFC_TYPE_NONE = 0, + NFC_TYPE_NFC, + NFC_TYPE_NFC_ESE, +}; + +typedef struct variant_info { + std::string hwc_value; + std::string sku_value; + + std::string brand; + std::string device; + std::string marketname; + std::string model; + std::string build_fingerprint; + + nfc_type nfc; +} variant_info_t; + +void search_variant(const std::vector variants); + +void set_variant_props(const variant_info_t variant); + +#endif // LIBINIT_VARIANT_H diff --git a/libinit/init_xiaomi_raphael.cpp b/libinit/init_xiaomi_raphael.cpp new file mode 100644 index 00000000..7f6a0e9a --- /dev/null +++ b/libinit/init_xiaomi_raphael.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2021-2022 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "vendor_init.h" + +#define FINGERPRINT "Xiaomi/raphael/raphael:11/RKQ1.200826.002/V12.5.2.0.RFKMIXM:user/release-keys" + +static const variant_info_t raphael_global_info = { + .hwc_value = "GLOBAL", + .sku_value = "", + + .brand = "Xiaomi", + .device = "raphael", + .marketname = "", + .model = "Mi 9T Pro", + .build_fingerprint = FINGERPRINT, + + .nfc = NFC_TYPE_NFC_ESE, +}; + +static const variant_info_t raphaelin_info = { + .hwc_value = "INDIA", + .sku_value = "", + + .brand = "Xiaomi", + .device = "raphaelin", + .marketname = "", + .model = "Redmi K20 Pro", + .build_fingerprint = FINGERPRINT, + + .nfc = NFC_TYPE_NONE, +}; + +static const variant_info_t raphael_info = { + .hwc_value = "", + .sku_value = "", + + .brand = "Xiaomi", + .device = "raphael", + .marketname = "", + .model = "Redmi K20 Pro", + .build_fingerprint = FINGERPRINT, + + .nfc = NFC_TYPE_NFC_ESE, +}; + +static const std::vector variants = { + raphael_global_info, + raphaelin_info, + raphael_info, +}; + +void vendor_load_properties() { + set_dalvik_heap(); + search_variant(variants); +} diff --git a/libinit/libinit_dalvik_heap.cpp b/libinit/libinit_dalvik_heap.cpp new file mode 100644 index 00000000..ba5992ec --- /dev/null +++ b/libinit/libinit_dalvik_heap.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include + +#define HEAPSTARTSIZE_PROP "dalvik.vm.heapstartsize" +#define HEAPGROWTHLIMIT_PROP "dalvik.vm.heapgrowthlimit" +#define HEAPSIZE_PROP "dalvik.vm.heapsize" +#define HEAPMINFREE_PROP "dalvik.vm.heapminfree" +#define HEAPMAXFREE_PROP "dalvik.vm.heapmaxfree" +#define HEAPTARGETUTILIZATION_PROP "dalvik.vm.heaptargetutilization" + +#define GB(b) (b * 1024ull * 1024 * 1024) + +static const dalvik_heap_info_t dalvik_heap_info_6144 = { + .heapstartsize = "16m", + .heapgrowthlimit = "256m", + .heapsize = "512m", + .heapminfree = "8m", + .heapmaxfree = "32m", + .heaptargetutilization = "0.5", +}; + +static const dalvik_heap_info_t dalvik_heap_info_4096 = { + .heapstartsize = "8m", + .heapgrowthlimit = "256m", + .heapsize = "512m", + .heapminfree = "8m", + .heapmaxfree = "16m", + .heaptargetutilization = "0.6", +}; + +static const dalvik_heap_info_t dalvik_heap_info_2048 = { + .heapstartsize = "8m", + .heapgrowthlimit = "192m", + .heapsize = "512m", + .heapminfree = "512k", + .heapmaxfree = "8m", + .heaptargetutilization = "0.75", +}; + +void set_dalvik_heap() { + struct sysinfo sys; + const dalvik_heap_info_t *dhi; + + sysinfo(&sys); + + if (sys.totalram > GB(5)) + dhi = &dalvik_heap_info_6144; + else if (sys.totalram > GB(3)) + dhi = &dalvik_heap_info_4096; + else + dhi = &dalvik_heap_info_2048; + + property_override(HEAPSTARTSIZE_PROP, dhi->heapstartsize); + property_override(HEAPGROWTHLIMIT_PROP, dhi->heapgrowthlimit); + property_override(HEAPSIZE_PROP, dhi->heapsize); + property_override(HEAPTARGETUTILIZATION_PROP, dhi->heaptargetutilization); + property_override(HEAPMINFREE_PROP, dhi->heapminfree); + property_override(HEAPMAXFREE_PROP, dhi->heapmaxfree); +} diff --git a/libinit/libinit_utils.cpp b/libinit/libinit_utils.cpp new file mode 100644 index 00000000..a6be4d53 --- /dev/null +++ b/libinit/libinit_utils.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ +#include +#include + +#include + +void property_override(std::string prop, std::string value, bool add) { + auto pi = (prop_info *) __system_property_find(prop.c_str()); + if (pi != nullptr) { + __system_property_update(pi, value.c_str(), value.length()); + } else if (add) { + __system_property_add(prop.c_str(), prop.length(), value.c_str(), value.length()); + } +} + +std::vector ro_props_default_source_order = { + "odm.", + "product.", + "system.", + "system_ext.", + "vendor.", + "", +}; + +void set_ro_build_prop(const std::string &prop, const std::string &value, bool product) { + std::string prop_name; + + for (const auto &source : ro_props_default_source_order) { + if (product) + prop_name = "ro.product." + source + prop; + else + prop_name = "ro." + source + "build." + prop; + + property_override(prop_name, value, true); + } +} + +#define FIND_AND_REMOVE(s, delimiter, variable_name) \ + std::string variable_name = s.substr(0, s.find(delimiter)); \ + s.erase(0, s.find(delimiter) + delimiter.length()); + +const std::string fingerprint_to_description(const std::string &fingerprint) { + const std::string delimiter = "/"; + const std::string delimiter2 = ":"; + + std::string build_fingerprint_copy = fingerprint; + + FIND_AND_REMOVE(build_fingerprint_copy, delimiter, brand) + FIND_AND_REMOVE(build_fingerprint_copy, delimiter, product) + FIND_AND_REMOVE(build_fingerprint_copy, delimiter2, device) + FIND_AND_REMOVE(build_fingerprint_copy, delimiter, platform_version) + FIND_AND_REMOVE(build_fingerprint_copy, delimiter, build_id) + FIND_AND_REMOVE(build_fingerprint_copy, delimiter2, build_number) + FIND_AND_REMOVE(build_fingerprint_copy, delimiter, build_variant) + std::string build_version_tags = build_fingerprint_copy; + + const std::string description = product + "-" + build_variant + " " + platform_version + + " " + build_id + " " + build_number + " " + build_version_tags; + + return description; +} diff --git a/libinit/libinit_variant.cpp b/libinit/libinit_variant.cpp new file mode 100644 index 00000000..bd3f5b3c --- /dev/null +++ b/libinit/libinit_variant.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include + +using android::base::GetProperty; + +#define HWC_PROP "ro.boot.hwc" +#define SKU_PROP "ro.boot.product.hardware.sku" + +void search_variant(const std::vector variants) { + std::string hwc_value = GetProperty(HWC_PROP, ""); + std::string sku_value = GetProperty(SKU_PROP, ""); + + for (const auto& variant : variants) { + if ((variant.hwc_value == "" || variant.hwc_value == hwc_value) && + (variant.sku_value == "" || variant.sku_value == sku_value)) { + set_variant_props(variant); + break; + } + } +} + +void set_variant_props(const variant_info_t variant) { + set_ro_build_prop("brand", variant.brand, true); + set_ro_build_prop("device", variant.device, true); + set_ro_build_prop("marketname", variant.marketname, true); + set_ro_build_prop("model", variant.model, true); + + if (access("/system/bin/recovery", F_OK) != 0) { + set_ro_build_prop("fingerprint", variant.build_fingerprint); + property_override("ro.bootimage.build.fingerprint", variant.build_fingerprint); + + property_override("ro.build.description", fingerprint_to_description(variant.build_fingerprint)); + } + + if (variant.nfc == NFC_TYPE_NFC) + property_override(SKU_PROP, "nfc"); + else if (variant.nfc == NFC_TYPE_NFC_ESE) + property_override(SKU_PROP, "nfc_ese"); +} diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index e555d4a2..c7f9d839 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -373,6 +373,12 @@ on post-fs-data #Create dir for TUI mkdir /data/vendor/tui 0700 system drmrpc +service nqnfcinfo /system/vendor/bin/nqnfcinfo + class late_start + group nfc + user system + oneshot + service iop /system/vendor/bin/iop class main user root diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc index cbbde7b6..7e9a9d9e 100644 --- a/rootdir/etc/init.target.rc +++ b/rootdir/etc/init.target.rc @@ -110,6 +110,7 @@ on post-fs-data mkdir /tombstones/dsps 0771 system system mkdir /data/vendor/hbtp 0750 system system mkdir /data/vendor/nnhal 0700 system system + mkdir /data/vendor/nfc 0770 nfc nfc # Haptics write /sys/class/leds/vibrator/vmax 28 diff --git a/rootdir/etc/init.xiaomi.rc b/rootdir/etc/init.xiaomi.rc index 28dc1d6b..74798d70 100644 --- a/rootdir/etc/init.xiaomi.rc +++ b/rootdir/etc/init.xiaomi.rc @@ -43,15 +43,6 @@ on init chmod 0660 /dev/drv8846_dev chmod 0660 /dev/akm09970 -on init && property:ro.boot.hwc=GLOBAL - setprop ro.boot.product.hardware.sku raphael - -on init && property:ro.boot.hwc=CN - setprop ro.boot.product.hardware.sku raphael - -on property:ro.boot.product.hardware.sku=raphael - enable vendor.nfc_hal_service - on property:sys.boot_completed=1 setprop vendor.powerhal.init 1 @@ -90,6 +81,7 @@ service nv_mac /vendor/bin/nv_mac group system inet net_admin wifi net_raw oneshot +# NFC service vendor.nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service override class hal @@ -97,3 +89,25 @@ service vendor.nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service group nfc task_profiles ServiceCapacityLow disabled + +service secureelement-hal_1_2 /vendor/bin/hw/vendor.qti.secure_element@1.2-service + override + class hal + user system + group system + disabled + +service qti_esepowermanager_service_1_1 /vendor/bin/hw/vendor.qti.esepowermanager@1.1-service + override + class hal + user system + group nfc system + disabled + +on boot && property:ro.boot.product.hardware.sku=nfc + enable vendor.nfc_hal_service + +on boot && property:ro.boot.product.hardware.sku=nfc_ese + enable vendor.nfc_hal_service + enable secureelement-hal_1_2 + enable qti_esepowermanager_service_1_1 diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 0688084a..2abfc68a 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -55,6 +55,9 @@ /vendor/bin/nv_mac u:object_r:vendor_wcnss_service_exec:s0 /data/vendor/mac_addr(/.*)? u:object_r:vendor_wifi_vendor_data_file:s0 +# NFC +/vendor/bin/hw/android\.hardware\.nfc_snxxx@1\.2-service u:object_r:hal_nfc_default_exec:s0 + # Thermal /vendor/bin/thermal_symlinks u:object_r:init-thermal-symlinks-sh_exec:s0 diff --git a/sepolicy/vendor/hal_nfc_default.te b/sepolicy/vendor/hal_nfc_default.te index 8322a40f..437f2321 100644 --- a/sepolicy/vendor/hal_nfc_default.te +++ b/sepolicy/vendor/hal_nfc_default.te @@ -1,8 +1,6 @@ # Allow hal_nfc_default to add and find hal_nxpnfc_hwservice -add_hwservice(hal_nfc_default, hal_nxpnfc_hwservice) -add_hwservice(hal_nfc_default, hal_nxpese_hwservice) -allow hal_nfc_default hal_nxpnfc_hwservice:hwservice_manager find; -allow hal_nfc_default hal_nxpese_hwservice:hwservice_manager find; +add_hwservice(hal_nfc_default, hal_nfc_hwservice) +allow hal_nfc_default hal_nfc_hwservice:hwservice_manager find; # Data file accesses. allow hal_nfc_default vendor_nfc_vendor_data_file:dir create_dir_perms; diff --git a/sepolicy/vendor/hwservice_contexts b/sepolicy/vendor/hwservice_contexts index 63235f0f..ed20a335 100644 --- a/sepolicy/vendor/hwservice_contexts +++ b/sepolicy/vendor/hwservice_contexts @@ -1,7 +1,13 @@ +# Fingerprint vendor.goodix.hardware.biometrics.fingerprint::IGoodixFingerprintDaemon u:object_r:hal_fingerprint_hwservice:s0 vendor.xiaomi.hardware.fingerprintextension::IXiaomiFingerprint u:object_r:hal_fingerprint_hwservice:s0 + +# Mlipay vendor.xiaomi.hardware.mlipay::IMlipayService u:object_r:hal_mlipay_hwservice:s0 + +# Motor vendor.xiaomi.hardware.motor::IMotor u:object_r:hal_motor_hwservice:s0 -vendor.nxp.nxpnfc::INxpNfc u:object_r:hal_nxpnfc_hwservice:s0 -vendor.nxp.nxpese::INxpEse u:object_r:hal_nxpese_hwservice:s0 -vendor.nxp.nxpnfclegacy::INxpNfcLegacy u:object_r:hal_nfc_hwservice:s0 + +# NFC +vendor.nxp.nxpese::INxpEse u:object_r:hal_nfc_hwservice:s0 +vendor.nxp.nxpnfc::INxpNfc u:object_r:hal_nfc_hwservice:s0