Overwrite the gauge capacity with the backup one if the gauge capacity
reset to nominal.
Test: fake /sys/class/power_supply/bms/charge_full to nominal and
check if it can be restored from /persist/battery/qcom_charge_full
Bug: 158838006
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: I4b85dd5e0c3ca929044aa8776294b841db7214e1
The code was only allowing the Learned Capacity to decrease while
QCOM FG learned capacity may actually go up for some reasons.
Ensure we use the FG learned capacity on update and always restore
the saved one on boot.
Bug: 109734601
Change-Id: I21b559c27a5298e8eea39ec502e4f1d6f7a4b053
Signed-off-by: Thierry Strudel <tstrudel@google.com>
Test:
- delete file /persist/battery/qcom_charge_full
- adb logcat to check code flow related health@2.0
- adb bugreport
- no "avc: denied" on health vendor service
- check learned capacity in both
/sys/class/power_supply/bms/charge_full
/persist/battery/qcom_charge_full
-- decrease /sys/class/power_supply/bms/charge_full
to check backup to /persist/battery/qcom_charge_full
-- increase /sys/class/power_supply/bms/charge_full
to check restore from /persist/battery/qcom_charge_full
(simluate the reset condition)
Bug: 78883741
Change-Id: Ib17bc0938d3a4b78376140a8a1008b4fc82220af
Signed-off-by: Jack Wu <wjack@google.com>