healthd: Add support for the new Health HAL v3 properties.
Add BATTERY_PROP_PART_STATUS support via getProperty. Add serial number support via a new helper function, since it doesn't fit neatly into the BatteryProperty structure. There are no sysfs nodes for this yet, so currently it is stubbed. Bug: 309792384 Test: fastboot getvar battery-part-status fastboot getvar battery-serial-number Change-Id: I3777e092d4ef26c02a7dd5420c9eaf1ec5aeae92
This commit is contained in:
parent
2cb36706f4
commit
d5ed26a45a
2 changed files with 17 additions and 0 deletions
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue