Not using a WakeLock so why does the device stay awake?

by Dianne Hackborn » Wed, 14 Apr 2010 15:36:31 GMT

Sponsored Links
 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 activity via
FLAG_KEEP_SCREEN_ON in a window, and the alarm manager will temporarily hold
one for you while sending an alarm broadcast to a broadcast receiver.


Not using a WakeLock so why does the device stay awake?

by Dianne Hackborn » Fri, 23 Apr 2010 01:59:22 GMT

 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
kernel wake lock information is extremely hard to understand, and
unfortunately I can't say for sure off-hand how to interpret it. :}


Sponsored Links

Other Threads

1. Service with timer

I have a service running that has a Timer. The Timer schedules a
TimerTask to run at a certain interval. The TimerTask simply display's
a notification. In theory it all sort of works but I find it very

The notifications only occur when the device is not sleeping. Also
sometimes it seems as though the Timer is only counting time when the
device is not asleep. If I leave the device asleep for 15 minutes then
wake it up after a minute or two I will get 4 notifications in a row.
All the ones that should have been displayed periodically over the
last 15 minutes.

Am I handling this situation the correct way? Is a timer the correct
way to do this? How can I make the device wake from sleep and display
the notifications at the correct intervals?

public class GameScoreService extends Service {

    Timer timer = null;

        private void startService() {

                timer = new Timer();

                timer.scheduleAtFixedRate(new getNewScores(), 5000, 180000);

        class getNewScores extends TimerTask {
                public void run() {

                        ...perform notification

    public void onStart(Intent intent, int startId) {

        super.onStart(intent, startId);



2. port openRecordStore from J2ME to android

which class I should be using to do that?


3. HelloSpinner Example!!

4. How to display RGB 565 byte array on the screen

5. How to draw a piece of Bitmap

6. Using SDK 1.5 to build 1.1 apps?

7. Is anyone else getting bored of announced product releases that don't materialise ...