universal8890: build nfc hal from source

Change-Id: Ief7ef8f2a597b1a978ea4b0ec4e41391cec03a99
Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
diff --git a/configs/nfc_key b/configs/nfc_key
deleted file mode 100644
index fe16a7a..0000000
--- a/configs/nfc_key
+++ /dev/null
@@ -1 +0,0 @@
-bVpxNHQ3dyF6JUMqRi1KQA==
diff --git a/lineage.dependencies b/lineage.dependencies
index b18755c..d4d2441 100644
--- a/lineage.dependencies
+++ b/lineage.dependencies
@@ -8,6 +8,10 @@
         "target_path": "kernel/samsung/universal7904"
     },
     {
+        "repository": "android_hardware_samsung_nfc",
+        "target_path": "hardware/samsung/nfc"
+    },
+    {
         "repository": "android_hardware_samsung_slsi_libbt",
         "target_path": "hardware/samsung_slsi/libbt"
     },
diff --git a/rootdir/etc/init.exynos7904.rc b/rootdir/etc/init.exynos7904.rc
index e42e1f0..297d3ef 100644
--- a/rootdir/etc/init.exynos7904.rc
+++ b/rootdir/etc/init.exynos7904.rc
@@ -34,6 +34,9 @@
     setrlimit 8 67108864 67108864
 
 on post-fs-data
+# NFC
+    mkdir /data/vendor/nfc 0770 nfc nfc
+
 # TEEGRIS service
     mkdir /data/vendor/tee 0700 system system
 
diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te
index 2e115f5..124f03a 100644
--- a/sepolicy/vendor/file.te
+++ b/sepolicy/vendor/file.te
@@ -23,6 +23,7 @@
 type display_vendor_data_file, file_type, data_file_type;
 type fingerprintd_vendor_data_file, data_file_type, file_type;
 type mediadrm_data_file, file_type, data_file_type;
+type nfc_vendor_data_file, file_type, data_file_type;
 
 # sysfs types
 type sysfs_abox_writable, sysfs_type, rw_fs_type, fs_type;
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 8eebf6f..696ffec 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -53,7 +53,7 @@
 
 ####################################
 # data files
-/data/nfc(/.*)?                    u:object_r:nfc_data_file:s0
+/data/vendor/nfc(/.*)?             u:object_r:nfc_vendor_data_file:s0
 
 /data/misc/radio(/.*)?             u:object_r:radio_data_file:s0
 
@@ -141,6 +141,7 @@
 /(vendor|system/vendor)/bin/hw/android\.hardware\.drm@[0-9]\.[0-9]-service\.widevine    u:object_r:hal_drm_widevine_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.keymaster@[0-9]\.[0-9]-service\.samsung    u:object_r:hal_keymaster_default_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.usb@[0-9]\.[0-9]-service\.basic    u:object_r:hal_usb_default_exec:s0
+/(vendor|system/vendor)/bin/hw/android\.hardware\.nfc@[0-9]\.[0-9]-service.samsung    u:object_r:hal_nfc_default_exec:s0
 /(vendor|system/vendor)/bin/hw/vendor\.samsung\.hardware\.gnss@[0-9]\.[0-9]-service    u:object_r:hal_gnss_default_exec:s0
 /(vendor|system/vendor)/bin/hw/vendor\.trustonic\.tee@[0-9]\.[0-9]-service u:object_r:hal_tee_default_exec:s0
 /(vendor|system/vendor)/bin/hw/vendor\.trustonic\.teeregistry@[0-9]\.[0-9]-service u:object_r:hal_teeregistry_default_exec:s0
diff --git a/sepolicy/vendor/hal_nfc_default.te b/sepolicy/vendor/hal_nfc_default.te
index a0fd6ab..fde8ff2 100644
--- a/sepolicy/vendor/hal_nfc_default.te
+++ b/sepolicy/vendor/hal_nfc_default.te
@@ -1,10 +1,4 @@
-# hal_nfc_default.te
-init_daemon_domain(hal_nfc_default)
+allow hal_nfc_default nfc_vendor_data_file:dir w_dir_perms;
+allow hal_nfc_default nfc_vendor_data_file:file create_file_perms;
 
-# /system/etc/event-log-tags
-allow nfc runtime_event_log_tags_file:file getattr;
-
-allow hal_nfc_default hal_nfc_hwservice:hwservice_manager add;
-
-# vendor.nfc.fw.
 set_prop(hal_nfc_default, vendor_nfc_prop)
diff --git a/sepolicy/vendor/nfc.te b/sepolicy/vendor/nfc.te
index 6c8e449..81f1a91 100644
--- a/sepolicy/vendor/nfc.te
+++ b/sepolicy/vendor/nfc.te
@@ -1 +1,3 @@
 allow nfc sec_efs_file:dir search;
+allow nfc nfc_vendor_data_file:dir rw_dir_perms;
+allow nfc nfc_vendor_data_file:file create_file_perms;
diff --git a/universal7904-common.mk b/universal7904-common.mk
index bb12d0a..a477201 100644
--- a/universal7904-common.mk
+++ b/universal7904-common.mk
@@ -117,6 +117,8 @@
 
 # NFC
 PRODUCT_PACKAGES += \
+    android.hardware.nfc@1.2-service.samsung \
+    com.android.nfc_extras \
     libnfc-nci \
     libnfc_nci_jni \
     NfcNci \
@@ -124,7 +126,6 @@
 
 PRODUCT_COPY_FILES += \
     $(LOCAL_PATH)/configs/libnfc-nci.conf:$(TARGET_COPY_OUT_SYSTEM)/etc/libnfc-nci.conf \
-    $(LOCAL_PATH)/configs/nfc_key:$(TARGET_COPY_OUT_SYSTEM)/etc/nfc_key \
     $(LOCAL_PATH)/configs/nfcee_access.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/nfcee_access.xml
 
 # Net
@@ -144,6 +145,10 @@
     frameworks/native/data/etc/android.hardware.camera.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml \
     frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.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.nfc.hce.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.hce.xml \
+    frameworks/native/data/etc/android.hardware.nfc.hcef.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.hcef.xml \
+    frameworks/native/data/etc/android.hardware.nfc.uicc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.uicc.xml \
+    frameworks/native/data/etc/android.hardware.nfc.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.nfc.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.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 \