From d5a4d8d567f9866f73f8e4910b114b39dab401bc Mon Sep 17 00:00:00 2001 From: Francescodario Cuzzocrea Date: Wed, 2 Oct 2019 21:32:07 +0200 Subject: [PATCH] msm8226-common: fix offline charging --- BoardConfigCommon.mk | 2 -- msm8226.mk | 6 ++++++ rootdir/etc/init.qcom.power.rc | 9 ++------- rootdir/etc/init.qcom.rc | 3 +-- sepolicy/common/file_contexts | 5 +++-- sepolicy/common/healthd.te | 3 +++ sepolicy/common/untrusted_app.te | 2 ++ 7 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 sepolicy/common/healthd.te create mode 100644 sepolicy/common/untrusted_app.te diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index 5b3ce4a..27cae16 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -52,8 +52,6 @@ TARGET_USES_NON_TREBLE_CAMERA := true BOARD_BATTERY_DEVICE_NAME := "battery" BOARD_CHARGING_CMDLINE_NAME := "androidboot.mode" BOARD_CHARGING_CMDLINE_VALUE := "charger" -BOARD_CHARGER_ENABLE_SUSPEND := true -WITH_LINEAGE_CHARGER := false # Dexpreopt ifeq ($(HOST_OS),linux) diff --git a/msm8226.mk b/msm8226.mk index 90577d9..306c50f 100644 --- a/msm8226.mk +++ b/msm8226.mk @@ -178,6 +178,12 @@ PRODUCT_COPY_FILES += \ frameworks/av/media/libstagefright/data/media_codecs_google_video_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video_le.xml \ device/samsung/msm8226-common/configs/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml +# Offline Charger +PRODUCT_PACKAGES += \ + charger \ + charger_res_images \ + lineage_charger_res_images + # OMX PRODUCT_PACKAGES += \ libc2dcolorconvert \ diff --git a/rootdir/etc/init.qcom.power.rc b/rootdir/etc/init.qcom.power.rc index 660c682..8298002 100644 --- a/rootdir/etc/init.qcom.power.rc +++ b/rootdir/etc/init.qcom.power.rc @@ -106,6 +106,7 @@ on charger write /sys/devices/system/cpu/cpu1/online 1 write /sys/devices/system/cpu/cpu2/online 1 write /sys/devices/system/cpu/cpu3/online 1 + write /sys/module/lpm_levels/enable_low_power/l2 4 write /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled 1 write /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled 1 write /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled 1 @@ -131,10 +132,4 @@ on property:sys.boot_completed=1 setprop vendor.post_boot.parsed 1 # Post boot services rm /data/system/perfd/default_values - start mpdecision - -on class_start:late_start - trigger enable-low-power - -on property:init.svc.recovery=running - trigger enable-low-power + start mpdecision diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index a29220c..2ca6e2b 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -587,9 +587,8 @@ service adsprpcd /vendor/bin/adsprpcd service charger /charger class charger critical - group root system seclabel u:r:charger:s0 - + service ds_fmc_appd /vendor/bin/ds_fmc_appd -p "rmnet0" -D class late_start user root diff --git a/sepolicy/common/file_contexts b/sepolicy/common/file_contexts index adb8c03..bc154a0 100644 --- a/sepolicy/common/file_contexts +++ b/sepolicy/common/file_contexts @@ -13,8 +13,6 @@ /dev/pn547 u:object_r:nfc_device:s0 /dev/rfkill u:object_r:wlan_device:s0 /dev/sec-nfc u:object_r:nfc_device:s0 -# this should be needed but it says it is already defined -#/dev/keychord u:object_r:keychord_device:s0 # efs files /efs/bluetooth(/.*)? u:object_r:bluetooth_efs_file:s0 @@ -47,6 +45,9 @@ /sys/devices/i2c\.[0-9]+/i2c-[0-9]+/[0-9]+-[a-z0-9]+/max[a-z0-9]+-charger/power_supply(/.*)? u:object_r:sysfs_batteryinfo:s0 /sys/devices/i2c\.[0-9]+/i2c-[0-9]+/[0-9]+-[a-z0-9]+/power_supply(/.*)? u:object_r:sysfs_batteryinfo:s0 /sys/devices/msm_dwc3/power_supply(/.*)? u:object_r:sysfs_batteryinfo:s0 +/sys/devices/[a-z0-9]+\.i2c/i2c-[0-9]+/[0-9]+-[0-9]+/power_supply(/.*)? u:object_r:sysfs_batteryinfo:s0 +/sys/devices/qpnp-bms-[0-9]+/power_supply(/.*)? u:object_r:sysfs_batteryinfo:s0 +/sys/devices/qpnp-charger-[0-9]+/power_supply(/.*)? u:object_r:sysfs_batteryinfo:s0 # sysfs - block/storage /sys/devices/msm_sdcc\.[0-9]/mmc_host/mmc[0-9]/mmc[0-9]:[0-9]+/block/mmcblk[0-9]/bkops_en u:object_r:sysfs_io_sched_tuneable:s0 diff --git a/sepolicy/common/healthd.te b/sepolicy/common/healthd.te new file mode 100644 index 0000000..dfff040 --- /dev/null +++ b/sepolicy/common/healthd.te @@ -0,0 +1,3 @@ +allow healthd alarm_device:chr_file rw_file_perms; +allow healthd device:dir r_dir_perms; +allow healthd rtc_device:chr_file rw_file_perms; diff --git a/sepolicy/common/untrusted_app.te b/sepolicy/common/untrusted_app.te new file mode 100644 index 0000000..65213db --- /dev/null +++ b/sepolicy/common/untrusted_app.te @@ -0,0 +1,2 @@ +allow untrusted_app sysfs_batteryinfo:dir r_dir_perms; +allow untrusted_app sysfs_batteryinfo:file r_file_perms;