I implemented "dumpsys power" command with Runtime.getRuntime().exec()
as below.

        try{
                Process process = Runtime.getRuntime().exec("dumpsys power");
            BufferedReader bufferedReader = new BufferedReader( new
InputStreamReader(process.getInputStream()), 1024);
            String line = bufferedReader.readLine();
            while ( line != null) {
                TextView text = (TextView)findViewById(R.id.wakelock);
                text.setText(line);
                line = bufferedReader.readLine();
            }
        } catch(Exception e) {
        }

However, the string which bufferedReader.readLine() returns is
"Permission Denial:can't dump PowerManager from from pid=..."

This output is not same as the one with "adb shell dumpsys power".

How can I find the same result as same as "adb shell dumpsys power"?

Please let me know if you find the correct way...

Regards,


On 8月9日, 午前11:53, Hiko <hikosais...@gmail.com> wrote:
> I confirmed that various informations including wakelock something by
> using command "dumpsys power".
> But, I do not know how to check which the application/service is
> wakelocked.
>
> As far as I checked my output,
>
> mLocks.size=0:
>
> the above is output.
>
> This means no wakelock application/service is available in my
> device???
>
> On 8月8日, 午前9:23, Hiko <hikosais...@gmail.com> wrote:
>
>
>
> > Dear Kostya,
>
> > Thank you very much for your information.
>
> > I'll try.
>
> > Regards,
>
> > On Aug 5, 8:42 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
>
> > > In the adb shell, type "dumpsys power".
>
> > > 05.08.2011 15:36, Hiko пишет:
>
> > > > Hi,
>
> > > > I would like to check/detect which process(s) are waklocked in the
> > > > device.
> > > > if you have any idea for this,please let me know.
>
> > > --
> > > Kostya Vasilyev

-- 
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