Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e6e3826 authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Merge "health: expand debug info." into pi-dev

am: 6acac5a3

Change-Id: I4e285570a3a2fdb295b9937fc3fbdee09487ba68
parents 960dda40 6acac5a3
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
#define LOG_TAG "android.hardware.health@2.0-impl"
#define LOG_TAG "android.hardware.health@2.0-impl"
#include <android-base/logging.h>
#include <android-base/logging.h>


#include <android-base/file.h>
#include <health2/Health.h>
#include <health2/Health.h>


#include <hal_conversion.h>
#include <hal_conversion.h>
@@ -189,6 +190,17 @@ Return<void> Health::debug(const hidl_handle& handle, const hidl_vec<hidl_string
    if (handle != nullptr && handle->numFds >= 1) {
    if (handle != nullptr && handle->numFds >= 1) {
        int fd = handle->data[0];
        int fd = handle->data[0];
        battery_monitor_->dumpState(fd);
        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);
        fsync(fd);
    }
    }
    return Void();
    return Void();