I dont want to permanently bypass keyguard, just for that moment .For example when a alarm is raised (eg wake up alarm) i can dismiss /snooze it whithout unlocking screen .I
you can add flags to current window, like this:
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
if you don't want it permanent, just clear flags you added when you don't need them, use the method: clearFlags(flags).