From: Danny Wood Date: Fri, 14 Dec 2018 08:02:03 +0000 (+0000) Subject: a7xelte: ramdisk: save/restore the batt_capacity_max value on boot to preserve batter... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cd88b391f9761eec17eddd8f10004a38aa6bcf57;p=GitHub%2FLineageOS%2Fandroid_device_samsung_a7xelte.git a7xelte: ramdisk: save/restore the batt_capacity_max value on boot to preserve battery health Change-Id: If4d61eb642160a00e4885baed4131c367165875f --- diff --git a/ramdisk/etc/init.target.rc b/ramdisk/etc/init.target.rc index 6101287..854c1be 100644 --- a/ramdisk/etc/init.target.rc +++ b/ramdisk/etc/init.target.rc @@ -39,6 +39,9 @@ on fs chmod 660 /sys/devices/13870000.hsi2c/i2c-0/0-0028/iio:device0/shealth_enable chmod 660 /sys/devices/13870000.hsi2c/i2c-0/0-0028/iio:device0/shealth_flush_cadence + # 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 41943040 write /proc/sys/vm/dirty_background_bytes 20971520 @@ -47,3 +50,8 @@ on property:sys.boot_completed=1 write /sys/block/mmcblk0/bdi/read_ahead_kb 128 write /sys/block/mmcblk1/bdi/read_ahead_kb 2048 +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 +