google_battery: reveal time_to_full_now in acceptable range
Correct the logic of max_ratio to show TTF condition:
- over TTF_REPORT_MAX_RATIO: not showing for better user experience
- >= 0 and under TTF_REPORT_MAX_RATIO: acceptable, showing TTF
- < 0 means google_ttf not ready, get data from fg
Bug: 219663652
Signed-off-by: Jenny Ho <[email protected]>
Change-Id: I42f22ad8fa748be2cc9e1d1a3fd46affa619bdd8
(cherry picked from commit 218914727c62d27e4c8936cae68c04ad568c7073)
diff --git a/google_battery.c b/google_battery.c
index 6ffc6a1..410d426 100644
--- a/google_battery.c
+++ b/google_battery.c
@@ -5920,12 +5920,12 @@
int max_ratio;
max_ratio = batt_ttf_estimate(&res, batt_drv);
- if (max_ratio == 0) {
+ if (max_ratio >= TTF_REPORT_MAX_RATIO) {
+ val->intval = 0;
+ } else if (max_ratio >= 0) {
if (res < 0)
res = 0;
val->intval = res;
- } else if (max_ratio >= TTF_REPORT_MAX_RATIO) {
- val->intval = 0;
} else if (!batt_drv->fg_psy) {
val->intval = -1;
} else {