so I am looking into PowerManager to prevent phone from going to sleep.
Two questions:
1) My phone is currently set to turn the display off after X seconds, will the PowerManager.Wakelock functions override this?
2) My phone has a top button which can be used to turn off the display, or shut the phone off. Will PowerManager.WakeLock override this functionality as well?
insight appreciated
functionality in the sources.
There is a function in PowerManager.java goToSleep(time). This
function simply calls method of PowerManagerService goToSleepLocked:
So you can see that all wakelocks are shutdowned in this method.
The method goToSleep can be called only by system components (protected with signature permission). And I think that it is called during the press of your power button. So it rewrites all the wakelocks.