Debugging power management - how to determine cpu state?

by Tom » Mon, 30 Aug 2010 06:01:33 GMT

Sponsored Links
 My application acquires and releases WakeLocks. What is the best way
to test the app - i.e. is there a standard way to determine when the
cpu is running (e.g. through a debug cable)?



Debugging power management - how to determine cpu state?

by Dianne Hackborn » Mon, 30 Aug 2010 14:05:40 GMT

 It is difficult, because attaching to USB keeps a wake lock held.

You can use "adb shell dumpsys batteryinfo" to see the current stats about
your app, which includes the time spent holding each wake lock.  (You'll
probably want the last section of output, which is the time since last
unplugged.)  Note that the wake lock times are weighted, so if two wake
locks are being held at the same time they will be accounted as using 50% of
the overall time.

Also, of course, you could log when you acquire and release the wake lock
and then look at the log after plugging in again.  "adb logcat -v time"
gives logs with time stamps.

Hmmmm...  that said, if you just care about what you are doing with your own
wake locks, it doesn't matter if the device is kept awake while plugged in
to USB, and you can use "adb shell dumpsys power" to see what wake locks (if
any) you are currently holding at that point in time.


Sponsored Links

Other Threads

1. add text to each image in gridview

Hi, everybody

          I want to add label for each image in gridview how to do
this? I had tried with following code but it shows only images and not

my xml file as:

<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android=""



how to do this.


2. Flexing the Expandable List Adapter

Hi All,

I just wanted to start a discussion about the approach I'm taking for
this particular Activity. Here is what I'm trying to achieve:

1) There are going to be multiple Expandable List Views, each Group
has a Title and a Button and there will be only one Child with data
based on that group.

2) Each Expandable List View has a Main Title attached to the top of

3) There will be a ScrollView to scroll through the Multiple
Expandable List Views.

Here was my solution:

Have a List View contain a TextView for the Main Title and a
Expandable List View as its child. This allows me to scroll the
multiple Expandable Lists Views easily.

I have done the work for a single Expandable List View already but I
noticed attaching a Main Title to a particular subset of groups was
difficult. Making the adapter smarter might be possible but sloppy. I
would think my solution would be a preferred method.

I just wanted some input if any of you believe that there can be
another approach that would be more acceptable. I heard making the
ExpandableListAdapter smarter to make it seems like there are multiple
Expandable List Views is possible, but it seems like the complexity
goes up quite a bit in doing so.



3. display an animated .gif image

4. Scrollview fling

5. wrap_content and fill_parent using Java

6. POSTing to WebView

7. Inyect Assistance data to the GPS