From: Danny Wood Date: Fri, 14 Dec 2018 08:02:03 +0000 (+0000) Subject: s5neolte: ramdisk: save/restore the batt_capacity_max value on boot to X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fd249648cd540fc5cb28eb9181e76035305ef221;p=GitHub%2FLineageOS%2Fandroid_device_samsung_s5neolte.git s5neolte: ramdisk: save/restore the batt_capacity_max value on boot to preserve battery health Change-Id: I95978baffd8134512b4c362993e2f174bb7fcd43 --- diff --git a/ramdisk/etc/init.target.rc b/ramdisk/etc/init.target.rc index 080053c..a022661 100644 --- a/ramdisk/etc/init.target.rc +++ b/ramdisk/etc/init.target.rc @@ -56,7 +56,16 @@ on fs # Permissions for LCD chown system radio /sys/class/lcd/panel/mcd_mode chown system media_rw /sys/class/backlight/panel/weakness_hbm_comp - + + # Restore the previous batt_capacity_max (if it exists) + copy /efs/Battery/prev_batt_capacity_max /sys/class/power_supply/battery/batt_capacity_max + on property:sys.boot_completed=1 write /proc/sys/vm/dirty_bytes 31457280 write /proc/sys/vm/dirty_background_bytes 15728640 + +on shutdown + # Fix permissions then store the current batt_capacity_max value in the EFS partition + chmod 600 /sys/class/power_supply/battery/batt_capacity_max + copy /sys/class/power_supply/battery/batt_capacity_max /efs/Battery/prev_batt_capacity_max +