tags:

views:

39

answers:

1

I have trouble with an Android app keeping a partial wake lock on my system; so I'd like to write an app that keeps an eye on the bad app and kills its partial wake lock shortly after it acquires one.

android.os.PowerManager is used to acquire and release wake locks but I don't see any way to get all wake locks in the system; even if I got access to its IPowerManager mService variable, that service doesn't release a wake lock without the IBinder object associated with the wake lock.

So I'm stuck. How do I proceed? Is this even possible?

+1  A: 

It's not possible, in that you cannot write an app that cancels another app's WakeLocks.

FWIW, you can use adb shell dumpsys to find out about outstanding WakeLocks, among other things.

CommonsWare
Luckily yesterday, after even more searching about the bug in the app that holds the wakelock, I found a workaround to get it to stop. Thanks for the dumpsys trick though, that's pretty cool!
Ricket