rosemary: Set up SKU-based ST NFC stack

* Based on miatoll implementation (7c21e60b93)

Change-Id: Ibb852acd55e4c0bc6928236637493520af221db2
This commit is contained in:
Matsvei Niaverau
2022-11-07 18:37:42 +03:00
parent 65fab603f3
commit f0b02514a1
5 changed files with 80 additions and 0 deletions

View File

@@ -74,6 +74,10 @@ BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
# Display # Display
TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS := 0x2000U TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS := 0x2000U
# HIDL
ODM_MANIFEST_SKUS += nfc
ODM_MANIFEST_NFC_FILES := $(DEVICE_PATH)/manifest_nfc.xml
# Init # Init
TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_xiaomi_rosemary TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_xiaomi_rosemary
TARGET_RECOVERY_DEVICE_MODULES := libinit_xiaomi_rosemary TARGET_RECOVERY_DEVICE_MODULES := libinit_xiaomi_rosemary

View File

@@ -247,6 +247,29 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/seccomp/mediaextractor.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaextractor.policy \ $(LOCAL_PATH)/configs/seccomp/mediaextractor.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaextractor.policy \
$(LOCAL_PATH)/configs/seccomp/mediaswcodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaswcodec.policy $(LOCAL_PATH)/configs/seccomp/mediaswcodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaswcodec.policy
# NFC
PRODUCT_PACKAGES += \
com.android.nfc_extras \
libchrome.vendor \
NfcNci \
SecureElement \
Tag \
android.hardware.nfc@1.0.vendor \
android.hardware.nfc@1.1.vendor \
android.hardware.nfc@1.2.vendor \
android.hardware.secure_element@1.0.vendor \
android.hardware.secure_element@1.1.vendor \
android.hardware.secure_element@1.2.vendor
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.nfc.ese.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/android.hardware.nfc.ese.xml \
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.ese.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/android.hardware.se.omapi.ese.xml \
frameworks/native/data/etc/com.android.nfc_extras.xml:$(TARGET_COPY_OUT_ODM)/etc/permissions/sku_nfc/com.android.nfc_extras.xml
# Overlays # Overlays
DEVICE_PACKAGE_OVERLAYS += \ DEVICE_PACKAGE_OVERLAYS += \
$(LOCAL_PATH)/overlay-lineage $(LOCAL_PATH)/overlay-lineage
@@ -344,6 +367,7 @@ PRODUCT_PACKAGES += \
init.mt6785.rc \ init.mt6785.rc \
init.mt6785.usb.rc \ init.mt6785.usb.rc \
init.sensor_1_0.rc \ init.sensor_1_0.rc \
init.stnfc.rc \
init.target.rc \ init.target.rc \
ueventd.mtk.rc ueventd.mtk.rc

12
manifest_nfc.xml Normal file
View File

@@ -0,0 +1,12 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.nfc</name>
<transport>hwbinder</transport>
<version>1.2</version>
<interface>
<name>INfc</name>
<instance>default</instance>
</interface>
<fqname>@1.2::INfc/default</fqname>
</hal>
</manifest>

View File

@@ -51,6 +51,13 @@ prebuilt_etc {
vendor: true, vendor: true,
} }
prebuilt_etc {
name: "init.stnfc.rc",
src: "etc/init.stnfc.rc",
sub_dir: "init/hw",
vendor: true,
}
prebuilt_etc { prebuilt_etc {
name: "init.target.rc", name: "init.target.rc",
src: "etc/init.target.rc", src: "etc/init.target.rc",

33
rootdir/etc/init.stnfc.rc Normal file
View File

@@ -0,0 +1,33 @@
# This file needs to be executed by vendor_init at boot of the device,
# in normal and FM mode.
# Start the HAL service in all modes (FM, meta, normal)
on post-fs && property:ro.boot.hwname=rosemary
start nfc_hal_service
setprop ro.vendor.se.type HCE,UICC
# For factory mode, nfcstackp to create the socket as vendor here
on post-fs-data
mkdir /data/vendor/nfc_socket 0770 nfc nfc
# start STFlashTool at boot to ensure a NFC FW is loaded for factory tests
service stflashtool /vendor/bin/STFlashTool
class late_start
user nfc
group nfc
disabled
oneshot
service nfcstackp_vendor /vendor/bin/nfcstackp-vendor
class late_start
user nfc
group nfc
disabled
# start nfcstackp_vendor by properties (FM or EM HIDL will set value)
on property:vendor.nfc.nfcstackp.enable=0
stop nfcstackp_vendor
on property:vendor.nfc.nfcstackp.enable=1
start nfcstackp_vendor