summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross2014-05-15 19:49:06 -0500
committerColin Cross2014-05-15 19:49:06 -0500
commite1d5247e0090b57f1f5c63df7eba6754c502a449 (patch)
treeea16e5a0241e674927322834d0ce0d6e14b1b787 /healthd/healthd_mode_charger.cpp
parent2bb25bf372ab17bca204b1f42fd69bbd472faa90 (diff)
downloadplatform-system-core-e1d5247e0090b57f1f5c63df7eba6754c502a449.tar.gz
platform-system-core-e1d5247e0090b57f1f5c63df7eba6754c502a449.tar.xz
platform-system-core-e1d5247e0090b57f1f5c63df7eba6754c502a449.zip
healthd: fix warnings
Fix a few warnings missed when turning on -Werror Change-Id: I5728664a90d33b95ab3d6ea8823244c59643aedc
Diffstat (limited to 'healthd/healthd_mode_charger.cpp')
-rw-r--r--healthd/healthd_mode_charger.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index 5807079df..cfac31252 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -17,6 +17,7 @@
17#include <dirent.h> 17#include <dirent.h>
18#include <errno.h> 18#include <errno.h>
19#include <fcntl.h> 19#include <fcntl.h>
20#include <inttypes.h>
20#include <linux/input.h> 21#include <linux/input.h>
21#include <stdbool.h> 22#include <stdbool.h>
22#include <stdio.h> 23#include <stdio.h>
@@ -356,7 +357,7 @@ static void update_screen_state(struct charger *charger, int64_t now)
356 reset_animation(batt_anim); 357 reset_animation(batt_anim);
357 charger->next_screen_transition = -1; 358 charger->next_screen_transition = -1;
358 gr_fb_blank(true); 359 gr_fb_blank(true);
359 LOGV("[%lld] animation done\n", now); 360 LOGV("[%" PRId64 "] animation done\n", now);
360 if (!charger->charger_connected) 361 if (!charger->charger_connected)
361 request_suspend(true); 362 request_suspend(true);
362 return; 363 return;
@@ -369,7 +370,7 @@ static void update_screen_state(struct charger *charger, int64_t now)
369 int batt_cap; 370 int batt_cap;
370 int ret; 371 int ret;
371 372
372 LOGV("[%lld] animation starting\n", now); 373 LOGV("[%" PRId64 "] animation starting\n", now);
373 batt_cap = get_battery_capacity(); 374 batt_cap = get_battery_capacity();
374 if (batt_cap >= 0 && batt_anim->num_frames != 0) { 375 if (batt_cap >= 0 && batt_anim->num_frames != 0) {
375 int i; 376 int i;
@@ -399,7 +400,7 @@ static void update_screen_state(struct charger *charger, int64_t now)
399 * the cycle counter and exit 400 * the cycle counter and exit
400 */ 401 */
401 if (batt_anim->num_frames == 0 || batt_anim->capacity < 0) { 402 if (batt_anim->num_frames == 0 || batt_anim->capacity < 0) {
402 LOGV("[%lld] animation missing or unknown battery status\n", now); 403 LOGV("[%" PRId64 "] animation missing or unknown battery status\n", now);
403 charger->next_screen_transition = now + BATTERY_UNKNOWN_TIME; 404 charger->next_screen_transition = now + BATTERY_UNKNOWN_TIME;
404 batt_anim->cur_cycle++; 405 batt_anim->cur_cycle++;
405 return; 406 return;
@@ -449,13 +450,13 @@ static int set_key_callback(int code, int value, void *data)
449 charger->keys[code].down = down; 450 charger->keys[code].down = down;
450 charger->keys[code].pending = true; 451 charger->keys[code].pending = true;
451 if (down) { 452 if (down) {
452 LOGV("[%lld] key[%d] down\n", now, code); 453 LOGV("[%" PRId64 "] key[%d] down\n", now, code);
453 } else { 454 } else {
454 int64_t duration = now - charger->keys[code].timestamp; 455 int64_t duration = now - charger->keys[code].timestamp;
455 int64_t secs = duration / 1000; 456 int64_t secs = duration / 1000;
456 int64_t msecs = duration - secs * 1000; 457 int64_t msecs = duration - secs * 1000;
457 LOGV("[%lld] key[%d] up (was down for %lld.%lldsec)\n", now, 458 LOGV("[%" PRId64 "] key[%d] up (was down for %" PRId64 ".%" PRId64 "sec)\n",
458 code, secs, msecs); 459 now, code, secs, msecs);
459 } 460 }
460 461
461 return 0; 462 return 0;
@@ -488,7 +489,7 @@ static void process_key(struct charger *charger, int code, int64_t now)
488 if (key->down) { 489 if (key->down) {
489 int64_t reboot_timeout = key->timestamp + POWER_ON_KEY_TIME; 490 int64_t reboot_timeout = key->timestamp + POWER_ON_KEY_TIME;
490 if (now >= reboot_timeout) { 491 if (now >= reboot_timeout) {
491 LOGI("[%lld] rebooting\n", now); 492 LOGI("[%" PRId64 "] rebooting\n", now);
492 android_reboot(ANDROID_RB_RESTART, 0, 0); 493 android_reboot(ANDROID_RB_RESTART, 0, 0);
493 } else { 494 } else {
494 /* if the key is pressed but timeout hasn't expired, 495 /* if the key is pressed but timeout hasn't expired,
@@ -525,10 +526,10 @@ static void handle_power_supply_state(struct charger *charger, int64_t now)
525 request_suspend(false); 526 request_suspend(false);
526 if (charger->next_pwr_check == -1) { 527 if (charger->next_pwr_check == -1) {
527 charger->next_pwr_check = now + UNPLUGGED_SHUTDOWN_TIME; 528 charger->next_pwr_check = now + UNPLUGGED_SHUTDOWN_TIME;
528 LOGI("[%lld] device unplugged: shutting down in %lld (@ %lld)\n", 529 LOGI("[%" PRId64 "] device unplugged: shutting down in %" PRId64 " (@ %" PRId64 ")\n",
529 now, UNPLUGGED_SHUTDOWN_TIME, charger->next_pwr_check); 530 now, (int64_t)UNPLUGGED_SHUTDOWN_TIME, charger->next_pwr_check);
530 } else if (now >= charger->next_pwr_check) { 531 } else if (now >= charger->next_pwr_check) {
531 LOGI("[%lld] shutting down\n", now); 532 LOGI("[%" PRId64 "] shutting down\n", now);
532 android_reboot(ANDROID_RB_POWEROFF, 0, 0); 533 android_reboot(ANDROID_RB_POWEROFF, 0, 0);
533 } else { 534 } else {
534 /* otherwise we already have a shutdown timer scheduled */ 535 /* otherwise we already have a shutdown timer scheduled */
@@ -536,7 +537,7 @@ static void handle_power_supply_state(struct charger *charger, int64_t now)
536 } else { 537 } else {
537 /* online supply present, reset shutdown timer if set */ 538 /* online supply present, reset shutdown timer if set */
538 if (charger->next_pwr_check != -1) { 539 if (charger->next_pwr_check != -1) {
539 LOGI("[%lld] device plugged in: shutdown cancelled\n", now); 540 LOGI("[%" PRId64 "] device plugged in: shutdown cancelled\n", now);
540 kick_animation(charger->batt_anim); 541 kick_animation(charger->batt_anim);
541 } 542 }
542 charger->next_pwr_check = -1; 543 charger->next_pwr_check = -1;
@@ -585,7 +586,7 @@ int healthd_mode_charger_preparetowait(void)
585 struct input_event ev; 586 struct input_event ev;
586 int ret; 587 int ret;
587 588
588 LOGV("[%lld] next screen: %lld next key: %lld next pwr: %lld\n", now, 589 LOGV("[%" PRId64 "] next screen: %" PRId64 " next key: %" PRId64 " next pwr: %" PRId64 "\n", now,
589 charger->next_screen_transition, charger->next_key_check, 590 charger->next_screen_transition, charger->next_key_check,
590 charger->next_pwr_check); 591 charger->next_pwr_check);
591 592