From 6f8314900f5b7be91cb3fed8e596360548e5c146 Mon Sep 17 00:00:00 2001 From: Nick Vaccaro Date: Wed, 26 Oct 2016 19:33:48 -0700 Subject: [PATCH] healthd: Show animation before waiting on timer Don't wait for first timer to expire before starting animation. Bug: 32368190 Change-Id: If023e3a9f1dd0c3982c899bcf22e5335f9319f72 --- healthd/healthd.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/healthd/healthd.cpp b/healthd/healthd.cpp index a7be29f46..1c144b34d 100644 --- a/healthd/healthd.cpp +++ b/healthd/healthd.cpp @@ -290,12 +290,18 @@ static void wakealarm_init(void) { } static void healthd_mainloop(void) { + int nevents = 0; while (1) { struct epoll_event events[eventct]; - int nevents; int timeout = awake_poll_interval; int mode_timeout; + /* Don't wait for first timer timeout to run periodic chores */ + if (!nevents) + periodic_chores(); + + healthd_mode_ops->heartbeat(); + mode_timeout = healthd_mode_ops->preparetowait(); if (timeout < 0 || (mode_timeout > 0 && mode_timeout < timeout)) timeout = mode_timeout; @@ -311,11 +317,6 @@ static void healthd_mainloop(void) { if (events[n].data.ptr) (*(void (*)(int))events[n].data.ptr)(events[n].events); } - - if (!nevents) - periodic_chores(); - - healthd_mode_ops->heartbeat(); } return;