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

Commit d633106d authored by Yabin Cui's avatar Yabin Cui Committed by Gerrit Code Review
Browse files

Merge "healthd: support reading charge status from BatteryMonitor."

parents 0fc00668 aedf6038
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -341,6 +341,17 @@ bool BatteryMonitor::update(void) {
            props.chargerWirelessOnline;
}

int BatteryMonitor::getChargeStatus() {
    int result = BATTERY_STATUS_UNKNOWN;
    if (!mHealthdConfig->batteryStatusPath.isEmpty()) {
        char buf[128];
        if (readFromFile(mHealthdConfig->batteryStatusPath, buf, sizeof(buf)) > 0) {
            result = getBatteryStatus(buf);
        }
    }
    return result;
}

status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
    status_t ret = BAD_VALUE;

+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ class BatteryMonitor {
    BatteryMonitor();
    void init(struct healthd_config *hc);
    bool update(void);
    int getChargeStatus();
    status_t getProperty(int id, struct BatteryProperty *val);
    void dumpState(int fd);