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?
It’s not possible, in that you cannot write an app that cancels another app’s
WakeLocks.FWIW, you can use
adb shell dumpsysto find out about outstandingWakeLocks, among other things.