[android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-22 Thread THill
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

Re: [android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-22 Thread Dianne Hackborn
It is possible for the kernel to hold wake locks for various reasons. If you want to see what was holding wake locks while you were unplugged, use adb shell dumpsys batteryinfo and look at the last set of stats (this is the raw information used to generate the battery usage UI). However the

[android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-22 Thread THill
Thanks Dianne, that makes sense. I didn't realize there was essentially one wake lock that the kernel applications layer use, so when all apps give up the wake lock, they will still get awaken when the cpu wakes to handle kernel processes. This explains why the 1-second timer pops occurred at 1

Re: [android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-22 Thread Mark Murphy
THill wrote: Unfortunately, my production app has specific power usage constraints imposed by the manufacturer/carrier (especially with the device asleep), and it doesn't seem there is a good way to make sure the app completely goes dormant when the device sleeps. Any suggestions are

[android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-14 Thread westmeadboy
So I tried this: Start service Press Home Start some other 3rd party app (so that activity is in the foreground) Press power button to blank screen A few minutes later, I press the power button to unblank the screen and discover the service finished successfully. This means the phone never went

Re: [android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-14 Thread Dianne Hackborn
Use this to see what wake locks are being held in user space: adb shell dumpsys power Note that the device never goes to sleep while plugged in to USB. Also the system will never hold a wake lock for you just because you have an activity or service running. You can have it do so for you in an

[android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-14 Thread westmeadboy
Just to confirm: the device is not plugged into USB and I'm not using any broadcasts or broadcast receivers. When I do plug in and start the service these are the wake locks: mLocks.size=3: SCREEN_DIM_WAKE_LOCK 'StayOnWhilePluggedIn Screen Dim' activated (minState=1)

Re: [android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-14 Thread Mark Murphy
westmeadboy wrote: Just to confirm: the device is not plugged into USB and I'm not using 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 apps using alarms. When I

[android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-13 Thread MrChaz
iirc, that flag means the system gets a wake lock for the life of the activity for you. On Apr 13, 9:52 am, westmeadboy westmead...@yahoo.co.uk wrote: I have a service which, when started, does some stuff (like downloading files) typically taking about 2-3 minutes. If I start this service and

[android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-13 Thread westmeadboy
Oh I see. So if the user presses Home and then uses the power button, then it *could* fall asleep (in the case where the activity has been killed by the system)? On Apr 13, 11:16 am, MrChaz mrchazmob...@googlemail.com wrote: iirc, that flag means the system gets a wake lock for the life of the

Re: [android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-13 Thread Mark Murphy
westmeadboy wrote: Oh I see. So if the user presses Home and then uses the power button, then it *could* fall asleep (in the case where the activity has been killed by the system)? If you eliminate your parenthetical expression, then yes. The activity being killed/not-killed has no impact

[android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-13 Thread westmeadboy
Hmmm, so in that case, why does the device not sleep after the user has used the power button to turn off the screen? Or do you mean that the activity is still considered in the foreground even after that? On Apr 13, 1:50 pm, Mark Murphy mmur...@commonsware.com wrote: westmeadboy wrote: Oh I

Re: [android-developers] Re: Not using a WakeLock so why does the device stay awake?

2010-04-13 Thread Mark Murphy
westmeadboy wrote: Hmmm, so in that case, why does the device not sleep after the user has used the power button to turn off the screen? Or do you mean that the activity is still considered in the foreground even after that? My guess is that it is still considered the foreground until a real