zenfone9: Build lineage health HAL and related sepolicies

Change-Id: I1ca5f25f3a2d8734647b9cc0ff4885b0b817c6ad
Signed-off-by: micky387 <mickaelsaibi@free.fr>
diff --git a/BoardConfig.mk b/BoardConfig.mk
index b3ac52e..e0b6426 100755
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -151,6 +151,11 @@
 BOARD_VENDOR_KERNEL_MODULES_LOAD := $(strip $(shell cat $(KERNEL_MODULE_DIR)/vendor_dlkm.modules.load))
 BOARD_VENDOR_KERNEL_MODULES := $(KERNEL_MODULES)
 
+# Lineage Health
+TARGET_HEALTH_CHARGING_CONTROL_CHARGING_PATH := /sys/class/asuslib/charging_suspend_en
+TARGET_HEALTH_CHARGING_CONTROL_CHARGING_ENABLED := 0
+TARGET_HEALTH_CHARGING_CONTROL_CHARGING_DISABLED := 1
+
 # NFC
 TARGET_USES_NQ_NFC := true
 
diff --git a/device.mk b/device.mk
index 03c6532..97a3a6a 100755
--- a/device.mk
+++ b/device.mk
@@ -183,6 +183,10 @@
     android.hardware.health@2.1-impl-qti \
     android.hardware.health@2.1-service
 
+# Health for charing control
+PRODUCT_PACKAGES += \
+    vendor.lineage.health-service.default
+
 # HIDL
 PRODUCT_PACKAGES += \
     android.hidl.base@1.0 \
diff --git a/prebuilt/vendor/etc/ueventd.rc b/prebuilt/vendor/etc/ueventd.rc
index 6ef538b..0461c86 100644
--- a/prebuilt/vendor/etc/ueventd.rc
+++ b/prebuilt/vendor/etc/ueventd.rc
@@ -40,6 +40,9 @@
     devname uevent_devpath
     dirname /dev/mem_buf_vm
 
+# Charger
+/sys/class/asuslib charging_suspend_en 0660 system system
+
 # the DIAG device node is not world writable/readable.
 /dev/diag                 0660   system     oem_2901
 /dev/mhi_*_pipe_4         0660   system     system
diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts
index 6e44efd..2ae14cf 100644
--- a/sepolicy/vendor/genfs_contexts
+++ b/sepolicy/vendor/genfs_contexts
@@ -9,6 +9,8 @@
 genfscon proc /Batt_Cycle_Count/condition_value                                                 u:object_r:proc_batinfo:s0
 genfscon proc /Batt_Cycle_Count/cycle_count                                                     u:object_r:proc_batinfo:s0
 
+genfscon sysfs /class/asuslib/charging_suspend_en                                            u:object_r:vendor_sysfs_battery_supply:s0
+
 # Display
 genfscon proc /driver/swipeup                                                                   u:object_r:vendor_proc_graphics:s0
 genfscon proc /driver/gaming_mode                                                               u:object_r:vendor_proc_graphics:s0
diff --git a/sepolicy/vendor/hal_lineage_health_default.te b/sepolicy/vendor/hal_lineage_health_default.te
new file mode 100644
index 0000000..cb1e010
--- /dev/null
+++ b/sepolicy/vendor/hal_lineage_health_default.te
@@ -0,0 +1,3 @@
+# Grant access to battery supply nodes
+allow hal_lineage_health_default vendor_sysfs_battery_supply:file rw_file_perms;
+allow hal_lineage_health_default vendor_sysfs_battery_supply:dir r_dir_perms;