Merge "healthd: Add support for the new Health HAL v3 properties." into main

This commit is contained in:
David Anderson 2023-12-12 20:22:31 +00:00 committed by Gerrit Code Review
commit bc9acc9f64
2 changed files with 17 additions and 0 deletions

View file

@ -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<int>(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<std::string>* out) {
*out = std::nullopt;
return OK;
}
void BatteryMonitor::dumpState(int fd) {
int v;
char vs[128];

View file

@ -18,6 +18,7 @@
#define HEALTHD_BATTERYMONITOR_H
#include <memory>
#include <optional>
#include <batteryservice/BatteryService.h>
#include <utils/String8.h>
@ -86,6 +87,8 @@ class BatteryMonitor {
int getChargingPolicy();
int getBatteryHealthData(int id);
status_t getSerialNumber(std::optional<std::string>* out);
static void logValues(const android::hardware::health::V2_1::HealthInfo& health_info,
const struct healthd_config& healthd_config);