I turned up this thread while googling disablekeyguard to try and fix a bug happening in my app. Interesting thoughts going on there, they really don't want people creating a replacement for the secure lock that really stops user from doing other things till it is done. Good thing my app wants to add more freedom and not take it away!
How myLock works up to now is it disables the lockscreen automatically on wakeup. It works except for one thing. The home button causes an odd quirk. When I implement the code such that disable always happens at screen on and reenable at screen off, if you try to do home long press to call up the app switcher, it never happens. When you release home, the screen re-draws (see a black screen for an instant) then home screen appears (even if you were already at the home screen). After that, the long press works for the rest of the time the device is awake.
I was just trying to fix this bug to work toward a beta release, but at the same time experimenting with disabling the keyguard and not calling re-enable-- I noticed that in every other usage of disabling the keyguard, it gets forced back on when home is pressed then screen off happens. My code simply breaks after that, the disablekeyguard command doesn't work anymore at screen on. The only reason I would want to code it like that is to try to open the door to customized button wakeup. I think that feature will have to be postponed.
To try to learn how to fix the bug in the working implementation, I found myself looking for the code of what happens when the user is trying to do home button short or long presses to see if there was any way my app could be notified. And indeed it seems the only way would be to have the app be the default home.
I can't figure out how the other apps that skip the keyguard are getting around the bug (keyguard disabler by mikeDg or screenmodewidget), but I really don't want it to allow all buttons to wakeup uncustomizably. All I want to do is eliminate the bug. I am relatively ok with keeping wakeup limited to the power button or slide open actions. You can even program a shake to wake it up since that is done through the sensor. I'm talking with the developer of an app that wants to do that and has it working to wake to the lockscreen.
Our next goal is to launch a custom subclass of the launcher (regular home scren) at every wakeup, immediately after the keyguard disable, so that the end user has a welcome screen where their favorite widgets, app shortcuts, and tools will reside. I want the user to be able to press home to get to the real launcher, or escape to get to whatever was going on before the screen went off. Before I move on to that I will make the utilities widget to be included in a beta release. 2nd beta release will implement the wakeup home.