I've seen similar behavior as the OP.

I have a simple activity that starts a timer in onCreate, logging a
message every second.  No wake lock is requested, so after the time
indicated in setting, the device sleeps (allowed to dim, then sleep
naturally, not with power button press).  After letting it sit like
that for a few minutes, I plug it in via USB & check the logs, where I
can see the timer continued running through the sleep.

If I then do 'adb shell dumpsys power', the only wake locks shown are:
mLocks.size=2:
  SCREEN_DIM_WAKE_LOCK           'StayOnWhilePluggedIn Screen Dim'
activated (minState=1)
  PARTIAL_WAKE_LOCK              'StayOnWhilePluggedIn Partial'
activated (minState=0)

which makes sense since the device is now plugged in via USB.

Is this expected behavior?  Seems to go against the idea that all
threads are suspended during the sleep...

Thanks for any clarification,
Tim

On Apr 14, 4:31 am, Mark Murphy <[email protected]> wrote:
> westmeadboy wrote:
> > Just to confirm: the device isnotplugged into USB and I'mnotusing
> > any broadcasts or broadcast receivers.
>
> You aren't, but unless you have a completely clean device (or have
> hammered stuff into submission with a task killer), there might be other
> appsusingalarms.
>
>
>
> > When I do plug in and start the service these are thewakelocks:
>
> > mLocks.size=3:
> >   SCREEN_DIM_WAKE_LOCK           'StayOnWhilePluggedIn Screen Dim'
> > activated (minState=1)
> >   PARTIAL_WAKE_LOCK              'StayOnWhilePluggedIn Partial'
> > activated (minState=0)
> >   SCREEN_BRIGHT_WAKE_LOCK        'KEEP_SCREEN_ON_FLAG' activated
> > (minState=3)
>
> > and then when I homescreen, other app, turn the screen off (as
> > describe above) but leave the device plugged in, the third one
> > disappears.
>
> > So I would assume that when I unplug the USB, the first two to
> > disappear also...
>
> Make sure your screen timeout setting is set to a low value (yes, I
> know, you're manually turning off the screen, but humor me for a bit).
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.0
> Available!

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

Reply via email to