Handler uses SystemClock.uptimeMillis(), which only increments when the CPU
is running.  (Note that the CPU can be running while the screen is off, but
often isn't).  So for scheduling in handlers, the time during which the CPU
asleep basically doesn't count as time at all.

On Thu, Jan 15, 2009 at 9:12 PM, brs <bernhard.r.su...@gmail.com> wrote:

>
> What happens to runnables scheduled with postDelayed when the phone
> goes to sleep? Having pending handlers does not seem to prevent the
> phone from sleeping, but what should happen once it wakes up again. Is
> the sleep period like a lapse of lost time and the delay clock keeps
> counting down as if the sleep never happened or are all handlers which
> would have expired during the time the phone was asleep going to fire
> immediately?
>
> I am also seeing some strange stuff, when I use postDelayed to
> periodically update a display and the screen lock is engaged (without
> the phone going to sleep yet, as far as I can tell). Once the phone is
> unlocked, the UI seems to go into some sort of fast-forward. Is this
> due to the handlers firing more rapidly (only one is re-scheduled at a
> time, so this would be rather strange) or some kind of queued update
> events to the display which are executed once the screen is unlocked.
> I guess one should generally never do any UI updates after onPause(),
> but there is nothing preventing it...
>
> Bernhard
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to