summaryrefslogtreecommitdiff
path: root/perfprofd
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2018-08-06 17:09:19 -0700
committerYifan Hong <elsk@google.com>2018-08-07 14:36:29 -0700
commit78262c94557da83f96998ffa9efd75dd4c490310 (patch)
tree785b4f593524ef93ba18fcd2bfb48b83792e94ad /perfprofd
parent5303cae8baa34fc709005af08dcc1af34a6c1d42 (diff)
downloadextras-78262c94557da83f96998ffa9efd75dd4c490310.tar.gz
perfprofd: Fix get_charging logic
getChargeStatus() can also return FULL for charging, so test for that as well. Change-Id: I611b687cfd9b65ef4ab2e0103d38116c9a893164 Fixes: 112184119 Test: perfprofd_test() has no errors related to get_charging()
Diffstat (limited to 'perfprofd')
-rw-r--r--perfprofd/perfprofdcore.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/perfprofd/perfprofdcore.cc b/perfprofd/perfprofdcore.cc
index 937e7bab..9afeb203 100644
--- a/perfprofd/perfprofdcore.cc
+++ b/perfprofd/perfprofdcore.cc
@@ -304,7 +304,7 @@ bool get_charging()
sp<IHealth> service = get_health_service();
if (service == nullptr) {
- PLOG(ERROR) << "Failed to get health HAL";
+ LOG(ERROR) << "Failed to get health HAL";
return false;
}
Result res = Result::UNKNOWN;
@@ -314,14 +314,15 @@ bool get_charging()
val = out_val;
});
if (!ret.isOk()) {
- PLOG(ERROR) << "Failed to call getChargeStatus on health HAL: " << ret.description();
+ LOG(ERROR) << "Failed to call getChargeStatus on health HAL: " << ret.description();
return false;
}
- if (res != Result::SUCCESS) {
- PLOG(ERROR) << "Failed to retrieve charge status from health HAL: " << toString(res);
+ if (res != Result::SUCCESS || val == BatteryStatus::UNKNOWN) {
+ LOG(ERROR) << "Failed to retrieve charge status from health HAL: result = " << toString(res)
+ << ", status = " << toString(val);
return false;
}
- return val == BatteryStatus::CHARGING;
+ return val == BatteryStatus::CHARGING || val == BatteryStatus::FULL;
#else
return false;
#endif