I have to activate android\'s system key lock (the one you get when you press the power off/hang up button). See here:
There's a pretty good example here:
http://www.anddev.org/throwing-simulating_keystrokes_programatically-t717.html
It looks like you can programmatically cause any keystroke to be sent to the system. It sounds like the keycode you're looking for is the KEYCODE_ENDCALL, but if that doesn't work there are plenty of other codes to try here:
http://developer.android.com/reference/android/view/KeyEvent.html
I don't know if there's any API call to cause the lock to occur, but this seems like a pretty sturdy workaround until you find a better solution.