I have to activate android's system key lock (the one you get when you press the power off/hang up button). See here:
I already browsed the docs but everything I found was PowerManager and KeyguardManager. Both seem not to be the solution :-(.
So, does everyone know how to achieve that from a android application? (If special permissions are required, that is no problem but changing the device's settings is not a solution...)
EDIT: Or does someone know that this is definitely not possible at all? Btw. craigs solution with sending keys does not work anymore (see comments).
I have been searching for an answer to the exact same question for a while. Apparently, after 2.0 onwards the device manager privileges for the app level were removed. But with Froyo - 2.2 the device policy manager is revealed granting us developers a multitude of administrative level controls.
http://developer.android.com/guide/topics/admin/device-admin.html