diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index 0c976322d..efd9907df 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -59,6 +59,7 @@ using aidl::android::hardware::health::BatteryChargingPolicy; using aidl::android::hardware::health::BatteryChargingState; using aidl::android::hardware::health::BatteryHealth; using aidl::android::hardware::health::BatteryHealthData; +using aidl::android::hardware::health::BatteryPartStatus; using aidl::android::hardware::health::BatteryStatus; using aidl::android::hardware::health::HealthInfo; @@ -596,6 +597,9 @@ int BatteryMonitor::getBatteryHealthData(int id) { if (!mHealthdConfig->batteryStateOfHealthPath.empty()) return getIntField(mHealthdConfig->batteryStateOfHealthPath); } + if (id == BATTERY_PROP_PART_STATUS) { + return static_cast(BatteryPartStatus::UNSUPPORTED); + } return 0; } @@ -679,6 +683,11 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { ret = OK; break; + case BATTERY_PROP_PART_STATUS: + val->valueInt64 = getBatteryHealthData(BATTERY_PROP_PART_STATUS); + ret = OK; + break; + default: break; } @@ -686,6 +695,11 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { return ret; } +status_t BatteryMonitor::getSerialNumber(std::optional* out) { + *out = std::nullopt; + return OK; +} + void BatteryMonitor::dumpState(int fd) { int v; char vs[128]; diff --git a/healthd/include/healthd/BatteryMonitor.h b/healthd/include/healthd/BatteryMonitor.h index e9998ba7a..b30458d3c 100644 --- a/healthd/include/healthd/BatteryMonitor.h +++ b/healthd/include/healthd/BatteryMonitor.h @@ -18,6 +18,7 @@ #define HEALTHD_BATTERYMONITOR_H #include +#include #include #include @@ -86,6 +87,8 @@ class BatteryMonitor { int getChargingPolicy(); int getBatteryHealthData(int id); + status_t getSerialNumber(std::optional* out); + static void logValues(const android::hardware::health::V2_1::HealthInfo& health_info, const struct healthd_config& healthd_config);