From 81b2833a2f800c69b74ed6a8c4de58322ca39b1b Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Wed, 4 Apr 2018 15:28:19 -0700 Subject: [PATCH] health: expand debug info. Test: lshal -m android.hardware.health@2.0::IHealth/default Test: lshal -m android.hardware.health@2.0::IHealth/backup Bug: 74057048 Change-Id: Iaca0a7fd32209522d7d759342b98d6e6898595ac --- health/2.0/default/Health.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/health/2.0/default/Health.cpp b/health/2.0/default/Health.cpp index 7a3e650408..6d3be9923b 100644 --- a/health/2.0/default/Health.cpp +++ b/health/2.0/default/Health.cpp @@ -16,6 +16,7 @@ #define LOG_TAG "android.hardware.health@2.0-impl" #include +#include #include #include @@ -189,6 +190,17 @@ Return Health::debug(const hidl_handle& handle, const hidl_vecnumFds >= 1) { int fd = handle->data[0]; battery_monitor_->dumpState(fd); + + getHealthInfo([fd](auto res, const auto& info) { + android::base::WriteStringToFd("\ngetHealthInfo -> ", fd); + if (res == Result::SUCCESS) { + android::base::WriteStringToFd(toString(info), fd); + } else { + android::base::WriteStringToFd(toString(res), fd); + } + android::base::WriteStringToFd("\n", fd); + }); + fsync(fd); } return Void();