blob: 4ee6249b986ee20b3d37e33b5b8c9db01a0384c6 [file] [log] [blame]
Todd Poynor752faf22013-06-12 13:25:59 -07001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "healthd"
18
Todd Poynor10b235e2013-08-07 15:25:14 -070019#include "healthd.h"
Todd Poynor752faf22013-06-12 13:25:59 -070020#include "BatteryMonitor.h"
Todd Poynor752faf22013-06-12 13:25:59 -070021
22#include <dirent.h>
23#include <errno.h>
24#include <fcntl.h>
25#include <stdio.h>
26#include <stdlib.h>
27#include <unistd.h>
28#include <batteryservice/BatteryService.h>
29#include <cutils/klog.h>
Todd Poynore14b37e2014-05-20 13:54:40 -070030#include <sys/types.h>
Todd Poynorc133b712013-08-14 17:39:13 -070031#include <utils/Errors.h>
Todd Poynor752faf22013-06-12 13:25:59 -070032#include <utils/String8.h>
33#include <utils/Vector.h>
34
35#define POWER_SUPPLY_SUBSYSTEM "power_supply"
36#define POWER_SUPPLY_SYSFS_PATH "/sys/class/" POWER_SUPPLY_SUBSYSTEM
37
38namespace android {
39
40struct sysfsStringEnumMap {
Mark Salyzyn6f5b47f2014-05-15 15:00:59 -070041 const char* s;
Todd Poynor752faf22013-06-12 13:25:59 -070042 int val;
43};
44
45static int mapSysfsString(const char* str,
46 struct sysfsStringEnumMap map[]) {
47 for (int i = 0; map[i].s; i++)
48 if (!strcmp(str, map[i].s))
49 return map[i].val;
50
51 return -1;
52}
53
54int BatteryMonitor::getBatteryStatus(const char* status) {
55 int ret;
56 struct sysfsStringEnumMap batteryStatusMap[] = {
57 { "Unknown", BATTERY_STATUS_UNKNOWN },
58 { "Charging", BATTERY_STATUS_CHARGING },
59 { "Discharging", BATTERY_STATUS_DISCHARGING },
60 { "Not charging", BATTERY_STATUS_NOT_CHARGING },
61 { "Full", BATTERY_STATUS_FULL },
62 { NULL, 0 },
63 };
64
65 ret = mapSysfsString(status, batteryStatusMap);
66 if (ret < 0) {
67 KLOG_WARNING(LOG_TAG, "Unknown battery status '%s'\n", status);
68 ret = BATTERY_STATUS_UNKNOWN;
69 }
70
71 return ret;
72}
73
74int BatteryMonitor::getBatteryHealth(const char* status) {
75 int ret;
76 struct sysfsStringEnumMap batteryHealthMap[] = {
77 { "Unknown", BATTERY_HEALTH_UNKNOWN },
78 { "Good", BATTERY_HEALTH_GOOD },
79 { "Overheat", BATTERY_HEALTH_OVERHEAT },
80 { "Dead", BATTERY_HEALTH_DEAD },
81 { "Over voltage", BATTERY_HEALTH_OVER_VOLTAGE },
82 { "Unspecified failure", BATTERY_HEALTH_UNSPECIFIED_FAILURE },
83 { "Cold", BATTERY_HEALTH_COLD },
84 { NULL, 0 },
85 };
86
87 ret = mapSysfsString(status, batteryHealthMap);
88 if (ret < 0) {
89 KLOG_WARNING(LOG_TAG, "Unknown battery health '%s'\n", status);
90 ret = BATTERY_HEALTH_UNKNOWN;
91 }
92
93 return ret;
94}
95
96int BatteryMonitor::readFromFile(const String8& path, char* buf, size_t size) {
97 char *cp = NULL;
98
99 if (path.isEmpty())
100 return -1;
101 int fd = open(path.string(), O_RDONLY, 0);
102 if (fd == -1) {
103 KLOG_ERROR(LOG_TAG, "Could not open '%s'\n", path.string());
104 return -1;
105 }
106
107 ssize_t count = TEMP_FAILURE_RETRY(read(fd, buf, size));
108 if (count > 0)
109 cp = (char *)memrchr(buf, '\n', count);
110
111 if (cp)
112 *cp = '\0';
113 else
114 buf[0] = '\0';
115
116 close(fd);
117 return count;
118}
119
120BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String8& path) {
121 const int SIZE = 128;
122 char buf[SIZE];
123 int length = readFromFile(path, buf, SIZE);
124 BatteryMonitor::PowerSupplyType ret;
125 struct sysfsStringEnumMap supplyTypeMap[] = {
126 { "Unknown", ANDROID_POWER_SUPPLY_TYPE_UNKNOWN },
127 { "Battery", ANDROID_POWER_SUPPLY_TYPE_BATTERY },
128 { "UPS", ANDROID_POWER_SUPPLY_TYPE_AC },
129 { "Mains", ANDROID_POWER_SUPPLY_TYPE_AC },
130 { "USB", ANDROID_POWER_SUPPLY_TYPE_USB },
131 { "USB_DCP", ANDROID_POWER_SUPPLY_TYPE_AC },
132 { "USB_CDP", ANDROID_POWER_SUPPLY_TYPE_AC },
133 { "USB_ACA", ANDROID_POWER_SUPPLY_TYPE_AC },
134 { "Wireless", ANDROID_POWER_SUPPLY_TYPE_WIRELESS },
135 { NULL, 0 },
136 };
137
138 if (length <= 0)
139 return ANDROID_POWER_SUPPLY_TYPE_UNKNOWN;
140
141 ret = (BatteryMonitor::PowerSupplyType)mapSysfsString(buf, supplyTypeMap);
142 if (ret < 0)
143 ret = ANDROID_POWER_SUPPLY_TYPE_UNKNOWN;
144
145 return ret;
146}
147
148bool BatteryMonitor::getBooleanField(const String8& path) {
149 const int SIZE = 16;
150 char buf[SIZE];
151
152 bool value = false;
153 if (readFromFile(path, buf, SIZE) > 0) {
154 if (buf[0] != '0') {
155 value = true;
156 }
157 }
158
159 return value;
160}
161
162int BatteryMonitor::getIntField(const String8& path) {
163 const int SIZE = 128;
164 char buf[SIZE];
165
166 int value = 0;
167 if (readFromFile(path, buf, SIZE) > 0) {
168 value = strtol(buf, NULL, 0);
169 }
170 return value;
171}
172
173bool BatteryMonitor::update(void) {
Todd Poynor10b235e2013-08-07 15:25:14 -0700174 bool logthis;
Todd Poynor752faf22013-06-12 13:25:59 -0700175
176 props.chargerAcOnline = false;
177 props.chargerUsbOnline = false;
178 props.chargerWirelessOnline = false;
179 props.batteryStatus = BATTERY_STATUS_UNKNOWN;
180 props.batteryHealth = BATTERY_HEALTH_UNKNOWN;
181
Todd Poynorf5d30122013-08-12 17:03:35 -0700182 if (!mHealthdConfig->batteryPresentPath.isEmpty())
183 props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath);
Todd Poynor752faf22013-06-12 13:25:59 -0700184 else
Todd Poynor6dcc45e2013-10-21 20:26:25 -0700185 props.batteryPresent = mBatteryDevicePresent;
Todd Poynor752faf22013-06-12 13:25:59 -0700186
Todd Poynorf5d30122013-08-12 17:03:35 -0700187 props.batteryLevel = getIntField(mHealthdConfig->batteryCapacityPath);
188 props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000;
Todd Poynorb45f1f52013-07-30 18:57:16 -0700189
Todd Poynorf5d30122013-08-12 17:03:35 -0700190 props.batteryTemperature = getIntField(mHealthdConfig->batteryTemperaturePath);
Todd Poynor752faf22013-06-12 13:25:59 -0700191
192 const int SIZE = 128;
193 char buf[SIZE];
194 String8 btech;
195
Todd Poynorf5d30122013-08-12 17:03:35 -0700196 if (readFromFile(mHealthdConfig->batteryStatusPath, buf, SIZE) > 0)
Todd Poynor752faf22013-06-12 13:25:59 -0700197 props.batteryStatus = getBatteryStatus(buf);
198
Todd Poynorf5d30122013-08-12 17:03:35 -0700199 if (readFromFile(mHealthdConfig->batteryHealthPath, buf, SIZE) > 0)
Todd Poynor752faf22013-06-12 13:25:59 -0700200 props.batteryHealth = getBatteryHealth(buf);
201
Todd Poynorf5d30122013-08-12 17:03:35 -0700202 if (readFromFile(mHealthdConfig->batteryTechnologyPath, buf, SIZE) > 0)
Todd Poynor752faf22013-06-12 13:25:59 -0700203 props.batteryTechnology = String8(buf);
204
205 unsigned int i;
206
207 for (i = 0; i < mChargerNames.size(); i++) {
208 String8 path;
209 path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH,
210 mChargerNames[i].string());
211
212 if (readFromFile(path, buf, SIZE) > 0) {
213 if (buf[0] != '0') {
214 path.clear();
215 path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH,
216 mChargerNames[i].string());
217 switch(readPowerSupplyType(path)) {
218 case ANDROID_POWER_SUPPLY_TYPE_AC:
219 props.chargerAcOnline = true;
220 break;
221 case ANDROID_POWER_SUPPLY_TYPE_USB:
222 props.chargerUsbOnline = true;
223 break;
224 case ANDROID_POWER_SUPPLY_TYPE_WIRELESS:
225 props.chargerWirelessOnline = true;
226 break;
227 default:
228 KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n",
229 mChargerNames[i].string());
230 }
231 }
232 }
233 }
234
Todd Poynor10b235e2013-08-07 15:25:14 -0700235 logthis = !healthd_board_battery_update(&props);
Todd Poynorb45f1f52013-07-30 18:57:16 -0700236
Todd Poynor10b235e2013-08-07 15:25:14 -0700237 if (logthis) {
238 char dmesgline[256];
Todd Poynor6dcc45e2013-10-21 20:26:25 -0700239
Todd Poynorc15e9932013-10-22 18:21:27 -0700240 if (props.batteryPresent) {
Todd Poynor6dcc45e2013-10-21 20:26:25 -0700241 snprintf(dmesgline, sizeof(dmesgline),
Todd Poynor10b235e2013-08-07 15:25:14 -0700242 "battery l=%d v=%d t=%s%d.%d h=%d st=%d",
243 props.batteryLevel, props.batteryVoltage,
244 props.batteryTemperature < 0 ? "-" : "",
245 abs(props.batteryTemperature / 10),
246 abs(props.batteryTemperature % 10), props.batteryHealth,
247 props.batteryStatus);
Todd Poynorc15e9932013-10-22 18:21:27 -0700248
249 if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) {
250 int c = getIntField(mHealthdConfig->batteryCurrentNowPath);
251 char b[20];
252
253 snprintf(b, sizeof(b), " c=%d", c / 1000);
254 strlcat(dmesgline, b, sizeof(dmesgline));
255 }
256 } else {
Todd Poynor6dcc45e2013-10-21 20:26:25 -0700257 snprintf(dmesgline, sizeof(dmesgline),
258 "battery none");
Todd Poynor10b235e2013-08-07 15:25:14 -0700259 }
260
261 KLOG_INFO(LOG_TAG, "%s chg=%s%s%s\n", dmesgline,
262 props.chargerAcOnline ? "a" : "",
263 props.chargerUsbOnline ? "u" : "",
264 props.chargerWirelessOnline ? "w" : "");
Todd Poynorb45f1f52013-07-30 18:57:16 -0700265 }
266
Todd Poynorc7464c92013-09-10 12:40:00 -0700267 healthd_mode_ops->battery_update(&props);
Todd Poynor752faf22013-06-12 13:25:59 -0700268 return props.chargerAcOnline | props.chargerUsbOnline |
269 props.chargerWirelessOnline;
270}
271
Todd Poynorc133b712013-08-14 17:39:13 -0700272status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
273 status_t ret = BAD_VALUE;
274
Todd Poynor8f132af2014-05-08 17:15:45 -0700275 val->valueInt64 = LONG_MIN;
276
Todd Poynorc133b712013-08-14 17:39:13 -0700277 switch(id) {
278 case BATTERY_PROP_CHARGE_COUNTER:
279 if (!mHealthdConfig->batteryChargeCounterPath.isEmpty()) {
Todd Poynor8f132af2014-05-08 17:15:45 -0700280 val->valueInt64 =
Todd Poynorc133b712013-08-14 17:39:13 -0700281 getIntField(mHealthdConfig->batteryChargeCounterPath);
282 ret = NO_ERROR;
283 } else {
284 ret = NAME_NOT_FOUND;
285 }
286 break;
287
288 case BATTERY_PROP_CURRENT_NOW:
289 if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) {
Todd Poynor8f132af2014-05-08 17:15:45 -0700290 val->valueInt64 =
Todd Poynorc133b712013-08-14 17:39:13 -0700291 getIntField(mHealthdConfig->batteryCurrentNowPath);
292 ret = NO_ERROR;
293 } else {
294 ret = NAME_NOT_FOUND;
295 }
296 break;
297
Todd Poynorbc102112013-08-27 18:11:49 -0700298 case BATTERY_PROP_CURRENT_AVG:
299 if (!mHealthdConfig->batteryCurrentAvgPath.isEmpty()) {
Todd Poynor8f132af2014-05-08 17:15:45 -0700300 val->valueInt64 =
Todd Poynorbc102112013-08-27 18:11:49 -0700301 getIntField(mHealthdConfig->batteryCurrentAvgPath);
302 ret = NO_ERROR;
303 } else {
304 ret = NAME_NOT_FOUND;
305 }
306 break;
307
Paul Lawrence347c8de2014-03-19 15:04:40 -0700308 case BATTERY_PROP_CAPACITY:
309 if (!mHealthdConfig->batteryCapacityPath.isEmpty()) {
Todd Poynor8f132af2014-05-08 17:15:45 -0700310 val->valueInt64 =
Paul Lawrence347c8de2014-03-19 15:04:40 -0700311 getIntField(mHealthdConfig->batteryCapacityPath);
312 ret = NO_ERROR;
313 } else {
314 ret = NAME_NOT_FOUND;
315 }
316 break;
317
Todd Poynor8f132af2014-05-08 17:15:45 -0700318 case BATTERY_PROP_ENERGY_COUNTER:
Todd Poynore14b37e2014-05-20 13:54:40 -0700319 if (mHealthdConfig->energyCounter) {
320 ret = mHealthdConfig->energyCounter(&val->valueInt64);
321 } else {
322 ret = NAME_NOT_FOUND;
323 }
Todd Poynor8f132af2014-05-08 17:15:45 -0700324 break;
325
Todd Poynorc133b712013-08-14 17:39:13 -0700326 default:
327 break;
328 }
329
Todd Poynorc133b712013-08-14 17:39:13 -0700330 return ret;
331}
332
Todd Poynor020369d2013-09-18 20:09:33 -0700333void BatteryMonitor::dumpState(int fd) {
334 int v;
335 char vs[128];
336
337 snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d\n",
338 props.chargerAcOnline, props.chargerUsbOnline,
339 props.chargerWirelessOnline);
340 write(fd, vs, strlen(vs));
341 snprintf(vs, sizeof(vs), "status: %d health: %d present: %d\n",
342 props.batteryStatus, props.batteryHealth, props.batteryPresent);
343 write(fd, vs, strlen(vs));
344 snprintf(vs, sizeof(vs), "level: %d voltage: %d temp: %d\n",
345 props.batteryLevel, props.batteryVoltage,
346 props.batteryTemperature);
347 write(fd, vs, strlen(vs));
348
349 if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) {
350 v = getIntField(mHealthdConfig->batteryCurrentNowPath);
351 snprintf(vs, sizeof(vs), "current now: %d\n", v);
352 write(fd, vs, strlen(vs));
353 }
354
355 if (!mHealthdConfig->batteryCurrentAvgPath.isEmpty()) {
356 v = getIntField(mHealthdConfig->batteryCurrentAvgPath);
357 snprintf(vs, sizeof(vs), "current avg: %d\n", v);
358 write(fd, vs, strlen(vs));
359 }
360
361 if (!mHealthdConfig->batteryChargeCounterPath.isEmpty()) {
362 v = getIntField(mHealthdConfig->batteryChargeCounterPath);
363 snprintf(vs, sizeof(vs), "charge counter: %d\n", v);
364 write(fd, vs, strlen(vs));
365 }
366}
367
Todd Poynorc7464c92013-09-10 12:40:00 -0700368void BatteryMonitor::init(struct healthd_config *hc) {
Todd Poynor752faf22013-06-12 13:25:59 -0700369 String8 path;
370
Todd Poynorf5d30122013-08-12 17:03:35 -0700371 mHealthdConfig = hc;
Todd Poynor752faf22013-06-12 13:25:59 -0700372 DIR* dir = opendir(POWER_SUPPLY_SYSFS_PATH);
373 if (dir == NULL) {
374 KLOG_ERROR(LOG_TAG, "Could not open %s\n", POWER_SUPPLY_SYSFS_PATH);
375 } else {
376 struct dirent* entry;
377
378 while ((entry = readdir(dir))) {
379 const char* name = entry->d_name;
380
381 if (!strcmp(name, ".") || !strcmp(name, ".."))
382 continue;
383
384 char buf[20];
385 // Look for "type" file in each subdirectory
386 path.clear();
387 path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, name);
388 switch(readPowerSupplyType(path)) {
389 case ANDROID_POWER_SUPPLY_TYPE_AC:
390 case ANDROID_POWER_SUPPLY_TYPE_USB:
391 case ANDROID_POWER_SUPPLY_TYPE_WIRELESS:
392 path.clear();
393 path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, name);
394 if (access(path.string(), R_OK) == 0)
395 mChargerNames.add(String8(name));
396 break;
397
398 case ANDROID_POWER_SUPPLY_TYPE_BATTERY:
Todd Poynor6dcc45e2013-10-21 20:26:25 -0700399 mBatteryDevicePresent = true;
400
Todd Poynorf5d30122013-08-12 17:03:35 -0700401 if (mHealthdConfig->batteryStatusPath.isEmpty()) {
Todd Poynor752faf22013-06-12 13:25:59 -0700402 path.clear();
Todd Poynorf5d30122013-08-12 17:03:35 -0700403 path.appendFormat("%s/%s/status", POWER_SUPPLY_SYSFS_PATH,
404 name);
Todd Poynor752faf22013-06-12 13:25:59 -0700405 if (access(path, R_OK) == 0)
Todd Poynorf5d30122013-08-12 17:03:35 -0700406 mHealthdConfig->batteryStatusPath = path;
Todd Poynor752faf22013-06-12 13:25:59 -0700407 }
408
Todd Poynorf5d30122013-08-12 17:03:35 -0700409 if (mHealthdConfig->batteryHealthPath.isEmpty()) {
Todd Poynor752faf22013-06-12 13:25:59 -0700410 path.clear();
Todd Poynorf5d30122013-08-12 17:03:35 -0700411 path.appendFormat("%s/%s/health", POWER_SUPPLY_SYSFS_PATH,
412 name);
Todd Poynor752faf22013-06-12 13:25:59 -0700413 if (access(path, R_OK) == 0)
Todd Poynorf5d30122013-08-12 17:03:35 -0700414 mHealthdConfig->batteryHealthPath = path;
Todd Poynor752faf22013-06-12 13:25:59 -0700415 }
416
Todd Poynorf5d30122013-08-12 17:03:35 -0700417 if (mHealthdConfig->batteryPresentPath.isEmpty()) {
418 path.clear();
419 path.appendFormat("%s/%s/present", POWER_SUPPLY_SYSFS_PATH,
420 name);
421 if (access(path, R_OK) == 0)
422 mHealthdConfig->batteryPresentPath = path;
423 }
424
425 if (mHealthdConfig->batteryCapacityPath.isEmpty()) {
426 path.clear();
427 path.appendFormat("%s/%s/capacity", POWER_SUPPLY_SYSFS_PATH,
428 name);
429 if (access(path, R_OK) == 0)
430 mHealthdConfig->batteryCapacityPath = path;
431 }
432
433 if (mHealthdConfig->batteryVoltagePath.isEmpty()) {
434 path.clear();
435 path.appendFormat("%s/%s/voltage_now",
436 POWER_SUPPLY_SYSFS_PATH, name);
437 if (access(path, R_OK) == 0) {
438 mHealthdConfig->batteryVoltagePath = path;
439 } else {
440 path.clear();
441 path.appendFormat("%s/%s/batt_vol",
442 POWER_SUPPLY_SYSFS_PATH, name);
443 if (access(path, R_OK) == 0)
444 mHealthdConfig->batteryVoltagePath = path;
445 }
446 }
447
448 if (mHealthdConfig->batteryCurrentNowPath.isEmpty()) {
449 path.clear();
450 path.appendFormat("%s/%s/current_now",
451 POWER_SUPPLY_SYSFS_PATH, name);
452 if (access(path, R_OK) == 0)
453 mHealthdConfig->batteryCurrentNowPath = path;
454 }
455
Todd Poynorbc102112013-08-27 18:11:49 -0700456 if (mHealthdConfig->batteryCurrentAvgPath.isEmpty()) {
457 path.clear();
458 path.appendFormat("%s/%s/current_avg",
459 POWER_SUPPLY_SYSFS_PATH, name);
460 if (access(path, R_OK) == 0)
461 mHealthdConfig->batteryCurrentAvgPath = path;
462 }
463
Todd Poynorf5d30122013-08-12 17:03:35 -0700464 if (mHealthdConfig->batteryChargeCounterPath.isEmpty()) {
465 path.clear();
466 path.appendFormat("%s/%s/charge_counter",
467 POWER_SUPPLY_SYSFS_PATH, name);
468 if (access(path, R_OK) == 0)
469 mHealthdConfig->batteryChargeCounterPath = path;
470 }
471
472 if (mHealthdConfig->batteryTemperaturePath.isEmpty()) {
473 path.clear();
474 path.appendFormat("%s/%s/temp", POWER_SUPPLY_SYSFS_PATH,
475 name);
476 if (access(path, R_OK) == 0) {
477 mHealthdConfig->batteryTemperaturePath = path;
478 } else {
479 path.clear();
480 path.appendFormat("%s/%s/batt_temp",
481 POWER_SUPPLY_SYSFS_PATH, name);
482 if (access(path, R_OK) == 0)
483 mHealthdConfig->batteryTemperaturePath = path;
484 }
485 }
486
487 if (mHealthdConfig->batteryTechnologyPath.isEmpty()) {
488 path.clear();
489 path.appendFormat("%s/%s/technology",
490 POWER_SUPPLY_SYSFS_PATH, name);
491 if (access(path, R_OK) == 0)
492 mHealthdConfig->batteryTechnologyPath = path;
493 }
494
Todd Poynor752faf22013-06-12 13:25:59 -0700495 break;
496
497 case ANDROID_POWER_SUPPLY_TYPE_UNKNOWN:
498 break;
499 }
500 }
501 closedir(dir);
502 }
503
504 if (!mChargerNames.size())
505 KLOG_ERROR(LOG_TAG, "No charger supplies found\n");
Todd Poynor6dcc45e2013-10-21 20:26:25 -0700506 if (!mBatteryDevicePresent) {
507 KLOG_INFO(LOG_TAG, "No battery devices found\n");
508 hc->periodic_chores_interval_fast = -1;
509 hc->periodic_chores_interval_slow = -1;
510 } else {
511 if (mHealthdConfig->batteryStatusPath.isEmpty())
512 KLOG_WARNING(LOG_TAG, "BatteryStatusPath not found\n");
513 if (mHealthdConfig->batteryHealthPath.isEmpty())
514 KLOG_WARNING(LOG_TAG, "BatteryHealthPath not found\n");
515 if (mHealthdConfig->batteryPresentPath.isEmpty())
516 KLOG_WARNING(LOG_TAG, "BatteryPresentPath not found\n");
517 if (mHealthdConfig->batteryCapacityPath.isEmpty())
518 KLOG_WARNING(LOG_TAG, "BatteryCapacityPath not found\n");
519 if (mHealthdConfig->batteryVoltagePath.isEmpty())
520 KLOG_WARNING(LOG_TAG, "BatteryVoltagePath not found\n");
521 if (mHealthdConfig->batteryTemperaturePath.isEmpty())
522 KLOG_WARNING(LOG_TAG, "BatteryTemperaturePath not found\n");
523 if (mHealthdConfig->batteryTechnologyPath.isEmpty())
524 KLOG_WARNING(LOG_TAG, "BatteryTechnologyPath not found\n");
525 }
Todd Poynor752faf22013-06-12 13:25:59 -0700526}
527
528}; // namespace android