I use in my program this rutine for lock and unlock screen, and it not go in my new Galaxy Note 2 with android 4.1.1
I use for unlock screen
and for lock screen
B4X:
Sub SetShowWhenLocked
Dim r As Reflector
r.Target = r.GetActivity
r.Target = r.RunMethod("getWindow")
r.RunMethod2("addFlags", 6815872, "java.lang.int")
End Sub
I use for unlock screen
B4X:
r.RunMethod2("addFlags", 6815872, "java.lang.int")
and for lock screen
B4X:
r.RunMethod2("clearFlags", 6815872, "java.lang.int")