bool FUSE26Util::mergeFUSEFileInfo(JNIEnv *env, jobject ffiObject, struct fuse_file_info *target) { CSLogTraceEnter("bool FUSE26Util::mergeFUSEFileInfo(%p, %p, %p)", env, ffiObject, target); bool res = false; do { //LOG_DEBUG(" - Getting class Stat"); //jclass statClass = env->FindClass(env, "org/catacombae/jfuse/Stat"); jclass ffiClass = env->GetObjectClass(ffiObject); if(ffiClass == NULL || env->ExceptionCheck() == JNI_TRUE) { CSLogError("Could not get object class!"); if(env->ExceptionCheck()) env->ExceptionDescribe(); break; } //LOG_DEBUG(" - statClass: %X", (int)statClass); //LOG_DEBUG(" - Getting field id for st_mode"); jint flags; jlong fh_old; jint writepage; jboolean direct_io; jboolean keep_cache; jboolean flush; jlong fh; jlong lock_owner; if(!getIntField(env, ffiClass, ffiObject, "flags", &flags)) break; if(!getLongField(env, ffiClass, ffiObject, "fh_old", &fh_old)) break; if(!getIntField(env, ffiClass, ffiObject, "writepage", &writepage)) break; if(!getBooleanField(env, ffiClass, ffiObject, "direct_io", &direct_io)) break; if(!getBooleanField(env, ffiClass, ffiObject, "keep_cache", &keep_cache)) break; if(!getBooleanField(env, ffiClass, ffiObject, "flush", &flush)) break; if(!getLongField(env, ffiClass, ffiObject, "fh", &fh)) break; if(!getLongField(env, ffiClass, ffiObject, "lock_owner", &lock_owner)) break; target->flags = flags; target->fh_old = fh_old; target->writepage = writepage; target->direct_io = direct_io; target->keep_cache = keep_cache; target->flush = flush; target->fh = fh; target->lock_owner = lock_owner; res = true; } while(0); CSLogTraceLeave("bool FUSE26Util::mergeFUSEFileInfo(%p, %p, %p): %d", env, ffiObject, target, res); return res; }
/** * Merges the contents of source (Java class LongRef) with the supplied * uint64_t. */ bool FUSE26Util::mergeFUSEConnInfo(JNIEnv *env, jobject source, struct fuse_conn_info *target) { CSLogTraceEnter("bool FUSE26Util::mergeFUSEConnInfo(%p, %p, %p)", env, source, target); bool res = false; do { jclass clazz = env->GetObjectClass(source); if(clazz == NULL || env->ExceptionCheck() == JNI_TRUE) { CSLogError("Could not get object class!"); if(env->ExceptionCheck()) env->ExceptionDescribe(); break; } jlong proto_major; jlong proto_minor; jboolean async_read; jlong max_write; jlong max_readahead; if(!getLongField(env, clazz, source, "proto_major", &proto_major)) break; if(!getLongField(env, clazz, source, "proto_minor", &proto_minor)) break; if(!getBooleanField(env, clazz, source, "async_read", &async_read)) break; if(!getLongField(env, clazz, source, "max_write", &max_write)) break; if(!getLongField(env, clazz, source, "max_readahead", &max_readahead)) break; target->proto_major = proto_major; target->proto_minor = proto_minor; target->async_read = (async_read == JNI_TRUE ? 1 : 0); target->max_write = max_write; target->max_readahead = max_readahead; res = true; } while(0); CSLogTraceLeave("bool FUSE26Util::mergeFUSEConnInfo(%p, %p, %p): %d", env, source, target, res); return res; }
jobject getFieldValue(JNIEnv * env, jobject obj, jclass fieldClass, jfieldID fieldId) { char* signature; (*jvmti)->GetClassSignature(jvmti, fieldClass, &signature, 0 ); if (strcmp(signature, "Z") == 0) { return getBooleanField(env, obj, fieldId); } else if (strcmp(signature, "B") == 0) { return getByteField(env, obj, fieldId); } else if (strcmp(signature, "C") == 0) { return getCharField(env, obj, fieldId); } else if (strcmp(signature, "S") == 0) { return getShortField(env, obj, fieldId); } else if (strcmp(signature, "I") == 0) { return getIntField(env, obj, fieldId); } else if (strcmp(signature, "J") == 0) { return getLongField(env, obj, fieldId); } else if (strcmp(signature, "F") == 0) { return getFloatField(env, obj, fieldId); } else if (strcmp(signature, "D") == 0) { return getDoubleField(env, obj, fieldId); } else { return getObjectField(env, obj, fieldId); } }
bool BatteryMonitor::update(void) { struct BatteryProperties props; bool logthis; props.chargerAcOnline = false; props.chargerUsbOnline = false; props.chargerWirelessOnline = false; props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; props.batteryCurrentNow = INT_MIN; props.batteryChargeCounter = INT_MIN; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); else props.batteryPresent = true; props.batteryLevel = getIntField(mHealthdConfig->batteryCapacityPath); props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) props.batteryCurrentNow = getIntField(mHealthdConfig->batteryCurrentNowPath); if (!mHealthdConfig->batteryChargeCounterPath.isEmpty()) props.batteryChargeCounter = getIntField(mHealthdConfig->batteryChargeCounterPath); props.batteryTemperature = getIntField(mHealthdConfig->batteryTemperaturePath); const int SIZE = 128; char buf[SIZE]; String8 btech; if (readFromFile(mHealthdConfig->batteryStatusPath, buf, SIZE) > 0) props.batteryStatus = getBatteryStatus(buf); if (readFromFile(mHealthdConfig->batteryHealthPath, buf, SIZE) > 0) props.batteryHealth = getBatteryHealth(buf); if (readFromFile(mHealthdConfig->batteryTechnologyPath, buf, SIZE) > 0) props.batteryTechnology = String8(buf); unsigned int i; for (i = 0; i < mChargerNames.size(); i++) { String8 path; path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); if (readFromFile(path, buf, SIZE) > 0) { if (buf[0] != '0') { path.clear(); path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); switch(readPowerSupplyType(path)) { case ANDROID_POWER_SUPPLY_TYPE_AC: props.chargerAcOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_USB: props.chargerUsbOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_WIRELESS: props.chargerWirelessOnline = true; break; default: KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n", mChargerNames[i].string()); } } } } logthis = !healthd_board_battery_update(&props); if (logthis) { char dmesgline[256]; snprintf(dmesgline, sizeof(dmesgline), "battery l=%d v=%d t=%s%d.%d h=%d st=%d", props.batteryLevel, props.batteryVoltage, props.batteryTemperature < 0 ? "-" : "", abs(props.batteryTemperature / 10), abs(props.batteryTemperature % 10), props.batteryHealth, props.batteryStatus); if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { char b[20]; snprintf(b, sizeof(b), " c=%d", props.batteryCurrentNow / 1000); strlcat(dmesgline, b, sizeof(dmesgline)); } KLOG_INFO(LOG_TAG, "%s chg=%s%s%s\n", dmesgline, props.chargerAcOnline ? "a" : "", props.chargerUsbOnline ? "u" : "", props.chargerWirelessOnline ? "w" : ""); } char prop[PROP_VALUE_MAX]; // always report AC plug-in and capacity 100% if emulated.battery is set to 1 property_get("sys.emulated.battery", prop, "0"); if (!strcmp(prop, "1")) { props.chargerAcOnline = true; props.batteryLevel = 100; props.chargerWirelessOnline = false; } if (mBatteryPropertiesRegistrar != NULL) mBatteryPropertiesRegistrar->notifyListeners(props); if (!strcmp(prop, "1")) { return false; } else { if (0 == props.batteryTemperature) return false; else return props.chargerAcOnline | props.chargerUsbOnline | props.chargerWirelessOnline; } }
bool BatteryMonitor::update(void) { bool logthis; props.chargerAcOnline = false; props.chargerUsbOnline = false; props.chargerWirelessOnline = false; props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); else props.batteryPresent = mBatteryDevicePresent; props.batteryLevel = mBatteryFixedCapacity ? mBatteryFixedCapacity : getIntField(mHealthdConfig->batteryCapacityPath); props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; props.batteryTemperature = mBatteryFixedTemperature ? mBatteryFixedTemperature : getIntField(mHealthdConfig->batteryTemperaturePath); const int SIZE = 128; char buf[SIZE]; String8 btech; if (readFromFile(mHealthdConfig->batteryStatusPath, buf, SIZE) > 0) props.batteryStatus = getBatteryStatus(buf); if (readFromFile(mHealthdConfig->batteryHealthPath, buf, SIZE) > 0) props.batteryHealth = getBatteryHealth(buf); if (readFromFile(mHealthdConfig->batteryTechnologyPath, buf, SIZE) > 0) props.batteryTechnology = String8(buf); // reinitialize the mChargerNames vector everytime there is an update String8 path; DIR* dir = opendir(POWER_SUPPLY_SYSFS_PATH); if (dir == NULL) { KLOG_ERROR(LOG_TAG, "Could not open %s\n", POWER_SUPPLY_SYSFS_PATH); } else { struct dirent* entry; // reconstruct the charger strings mChargerNames.clear(); while ((entry = readdir(dir))) { const char* name = entry->d_name; if (!strcmp(name, ".") || !strcmp(name, "..")) continue; // Look for "type" file in each subdirectory path.clear(); path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, name); switch(readPowerSupplyType(path)) { case ANDROID_POWER_SUPPLY_TYPE_BATTERY: break; default: path.clear(); path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, name); if (access(path.string(), R_OK) == 0) { mChargerNames.add(String8(name)); if (readFromFile(path, buf, SIZE) > 0) { if (buf[0] != '0') { path.clear(); path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, name); switch(readPowerSupplyType(path)) { case ANDROID_POWER_SUPPLY_TYPE_AC: props.chargerAcOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_USB: props.chargerUsbOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_WIRELESS: props.chargerWirelessOnline = true; break; default: KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n", name); } } } } break; } //switch } //while closedir(dir); }//else logthis = !healthd_board_battery_update(&props); if (logthis) { char dmesgline[256]; if (props.batteryPresent) { snprintf(dmesgline, sizeof(dmesgline), "battery l=%d v=%d t=%s%d.%d h=%d st=%d", props.batteryLevel, props.batteryVoltage, props.batteryTemperature < 0 ? "-" : "", abs(props.batteryTemperature / 10), abs(props.batteryTemperature % 10), props.batteryHealth, props.batteryStatus); if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { int c = getIntField(mHealthdConfig->batteryCurrentNowPath); char b[20]; snprintf(b, sizeof(b), " c=%d", c / 1000); strlcat(dmesgline, b, sizeof(dmesgline)); } } else { snprintf(dmesgline, sizeof(dmesgline), "battery none"); } KLOG_WARNING(LOG_TAG, "%s chg=%s%s%s\n", dmesgline, props.chargerAcOnline ? "a" : "", props.chargerUsbOnline ? "u" : "", props.chargerWirelessOnline ? "w" : ""); } healthd_mode_ops->battery_update(&props); return props.chargerAcOnline | props.chargerUsbOnline | props.chargerWirelessOnline; }
bool BatteryMonitor::update(void) { bool logthis; props.chargerAcOnline = false; props.chargerUsbOnline = false; props.chargerWirelessOnline = false; props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); else props.batteryPresent = mBatteryDevicePresent; props.batteryLevel = mBatteryFixedCapacity ? mBatteryFixedCapacity : getIntField(mHealthdConfig->batteryCapacityPath); props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; props.batteryTemperature = mBatteryFixedTemperature ? mBatteryFixedTemperature : getIntField(mHealthdConfig->batteryTemperaturePath); const int SIZE = 128; char buf[SIZE]; String8 btech; if (readFromFile(mHealthdConfig->batteryStatusPath, buf, SIZE) > 0) props.batteryStatus = getBatteryStatus(buf); if (readFromFile(mHealthdConfig->batteryHealthPath, buf, SIZE) > 0) props.batteryHealth = getBatteryHealth(buf); if (readFromFile(mHealthdConfig->batteryTechnologyPath, buf, SIZE) > 0) props.batteryTechnology = String8(buf); unsigned int i; for (i = 0; i < mChargerNames.size(); i++) { String8 path; path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); if (readFromFile(path, buf, SIZE) > 0) { if (buf[0] != '0') { path.clear(); path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); switch(readPowerSupplyType(path)) { case ANDROID_POWER_SUPPLY_TYPE_AC: props.chargerAcOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_USB: props.chargerUsbOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_WIRELESS: props.chargerWirelessOnline = true; break; default: KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n", mChargerNames[i].string()); } } } } logthis = !healthd_board_battery_update(&props); if (logthis) { char dmesgline[256]; if (props.batteryPresent) { snprintf(dmesgline, sizeof(dmesgline), "battery l=%d v=%d t=%s%d.%d h=%d st=%d", props.batteryLevel, props.batteryVoltage, props.batteryTemperature < 0 ? "-" : "", abs(props.batteryTemperature / 10), abs(props.batteryTemperature % 10), props.batteryHealth, props.batteryStatus); if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { int c = getIntField(mHealthdConfig->batteryCurrentNowPath); char b[20]; snprintf(b, sizeof(b), " c=%d", c / 1000); strlcat(dmesgline, b, sizeof(dmesgline)); } } else { snprintf(dmesgline, sizeof(dmesgline), "battery none"); } KLOG_WARNING(LOG_TAG, "%s chg=%s%s%s\n", dmesgline, props.chargerAcOnline ? "a" : "", props.chargerUsbOnline ? "u" : "", props.chargerWirelessOnline ? "w" : ""); } healthd_mode_ops->battery_update(&props); return props.chargerAcOnline | props.chargerUsbOnline | props.chargerWirelessOnline; }
bool BatteryMonitor::update(void) { bool logthis; props.chargerAcOnline = false; props.chargerUsbOnline = false; props.chargerWirelessOnline = false; props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); else props.batteryPresent = mBatteryDevicePresent; props.batteryLevel = mBatteryFixedCapacity ? mBatteryFixedCapacity : getIntField(mHealthdConfig->batteryCapacityPath); props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; props.batteryTemperature = mBatteryFixedTemperature ? mBatteryFixedTemperature : getIntField(mHealthdConfig->batteryTemperaturePath); const int SIZE = 128; char buf[SIZE]; String8 btech; if (readFromFile(mHealthdConfig->batteryStatusPath, buf, SIZE) > 0) props.batteryStatus = getBatteryStatus(buf); if (readFromFile(mHealthdConfig->batteryHealthPath, buf, SIZE) > 0) props.batteryHealth = getBatteryHealth(buf); if (readFromFile(mHealthdConfig->batteryTechnologyPath, buf, SIZE) > 0) props.batteryTechnology = String8(buf); unsigned int i; for (i = 0; i < mChargerNames.size(); i++) { String8 path; path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); if (readFromFile(path, buf, SIZE) > 0) { if (buf[0] != '0') { path.clear(); path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); switch(readPowerSupplyType(path)) { case ANDROID_POWER_SUPPLY_TYPE_AC: props.chargerAcOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_USB: props.chargerUsbOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_WIRELESS: props.chargerWirelessOnline = true; break; default: KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n", mChargerNames[i].string()); } } } } logthis = !healthd_board_battery_update(&props); if (logthis) { char dmesgline[256]; if (props.batteryPresent) { snprintf(dmesgline, sizeof(dmesgline), "battery l=%d v=%d t=%s%d.%d h=%d st=%d", props.batteryLevel, props.batteryVoltage, props.batteryTemperature < 0 ? "-" : "", abs(props.batteryTemperature / 10), abs(props.batteryTemperature % 10), props.batteryHealth, props.batteryStatus); if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { int c = getIntField(mHealthdConfig->batteryCurrentNowPath); char b[20]; snprintf(b, sizeof(b), " c=%d", c / 1000); strlcat(dmesgline, b, sizeof(dmesgline)); } } else { snprintf(dmesgline, sizeof(dmesgline), "battery none"); } size_t len = strlen(dmesgline); snprintf(dmesgline + len, sizeof(dmesgline) - len, " chg=%s%s%s", props.chargerAcOnline ? "a" : "", props.chargerUsbOnline ? "u" : "", props.chargerWirelessOnline ? "w" : ""); log_time realtime(CLOCK_REALTIME); time_t t = realtime.tv_sec; struct tm *tmp = gmtime(&t); if (tmp) { static const char fmt[] = " %Y-%m-%d %H:%M:%S.XXXXXXXXX UTC"; len = strlen(dmesgline); if ((len < (sizeof(dmesgline) - sizeof(fmt) - 8)) // margin && strftime(dmesgline + len, sizeof(dmesgline) - len, fmt, tmp)) { char *usec = strchr(dmesgline + len, 'X'); if (usec) { len = usec - dmesgline; snprintf(dmesgline + len, sizeof(dmesgline) - len, "%09u", realtime.tv_nsec); usec[9] = ' '; } } } KLOG_WARNING(LOG_TAG, "%s\n", dmesgline); } healthd_mode_ops->battery_update(&props); return props.chargerAcOnline | props.chargerUsbOnline | props.chargerWirelessOnline; }
bool BatteryMonitor::update(void) { bool logthis; props.chargerAcOnline = false; props.chargerUsbOnline = false; props.chargerWirelessOnline = false; props.batteryStatus = BATTERY_STATUS_UNKNOWN; props.batteryHealth = BATTERY_HEALTH_UNKNOWN; props.maxChargingCurrent = 0; if (!mHealthdConfig->batteryPresentPath.isEmpty()) props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); else props.batteryPresent = mBatteryDevicePresent; props.batteryLevel = mBatteryFixedCapacity ? mBatteryFixedCapacity : getIntField(mHealthdConfig->batteryCapacityPath); props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) props.batteryCurrent = getIntField(mHealthdConfig->batteryCurrentNowPath) / 1000; if (!mHealthdConfig->batteryFullChargePath.isEmpty()) props.batteryFullCharge = getIntField(mHealthdConfig->batteryFullChargePath); if (!mHealthdConfig->batteryCycleCountPath.isEmpty()) props.batteryCycleCount = getIntField(mHealthdConfig->batteryCycleCountPath); props.batteryTemperature = mBatteryFixedTemperature ? mBatteryFixedTemperature : getIntField(mHealthdConfig->batteryTemperaturePath); // For devices which do not have battery and are always plugged // into power souce. if (mAlwaysPluggedDevice) { props.chargerAcOnline = true; props.batteryPresent = true; props.batteryStatus = BATTERY_STATUS_CHARGING; props.batteryHealth = BATTERY_HEALTH_GOOD; } const int SIZE = 128; char buf[SIZE]; String8 btech; if (readFromFile(mHealthdConfig->batteryStatusPath, buf, SIZE) > 0) props.batteryStatus = getBatteryStatus(buf); if (readFromFile(mHealthdConfig->batteryHealthPath, buf, SIZE) > 0) props.batteryHealth = getBatteryHealth(buf); if (readFromFile(mHealthdConfig->batteryTechnologyPath, buf, SIZE) > 0) props.batteryTechnology = String8(buf); unsigned int i; for (i = 0; i < mChargerNames.size(); i++) { String8 path; path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); if (readFromFile(path, buf, SIZE) > 0) { if (buf[0] != '0') { path.clear(); path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); switch(readPowerSupplyType(path)) { case ANDROID_POWER_SUPPLY_TYPE_AC: props.chargerAcOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_USB: props.chargerUsbOnline = true; break; case ANDROID_POWER_SUPPLY_TYPE_WIRELESS: props.chargerWirelessOnline = true; break; default: KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n", mChargerNames[i].string()); } path.clear(); path.appendFormat("%s/%s/current_max", POWER_SUPPLY_SYSFS_PATH, mChargerNames[i].string()); if (access(path.string(), R_OK) == 0) { int maxChargingCurrent = getIntField(path); if (props.maxChargingCurrent < maxChargingCurrent) { props.maxChargingCurrent = maxChargingCurrent; } } } } } logthis = !healthd_board_battery_update(&props); if (logthis) { char dmesgline[256]; size_t len; if (props.batteryPresent) { snprintf(dmesgline, sizeof(dmesgline), "battery l=%d v=%d t=%s%d.%d h=%d st=%d", props.batteryLevel, props.batteryVoltage, props.batteryTemperature < 0 ? "-" : "", abs(props.batteryTemperature / 10), abs(props.batteryTemperature % 10), props.batteryHealth, props.batteryStatus); len = strlen(dmesgline); if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { len += snprintf(dmesgline + len, sizeof(dmesgline) - len, " c=%d", props.batteryCurrent); } if (!mHealthdConfig->batteryFullChargePath.isEmpty()) { len += snprintf(dmesgline + len, sizeof(dmesgline) - len, " fc=%d", props.batteryFullCharge); } if (!mHealthdConfig->batteryCycleCountPath.isEmpty()) { len += snprintf(dmesgline + len, sizeof(dmesgline) - len, " cc=%d", props.batteryCycleCount); } } else { snprintf(dmesgline, sizeof(dmesgline), "battery none"); } len = strlen(dmesgline); snprintf(dmesgline + len, sizeof(dmesgline) - len, " chg=%s%s%s", props.chargerAcOnline ? "a" : "", props.chargerUsbOnline ? "u" : "", props.chargerWirelessOnline ? "w" : ""); KLOG_WARNING(LOG_TAG, "%s\n", dmesgline); } healthd_mode_ops->battery_update(&props); return props.chargerAcOnline | props.chargerUsbOnline | props.chargerWirelessOnline; }