In my app I disabled the visible keyguard screen with
if (mKkeyguardLock == null) {
mKkeyguardLock = ((KeyguardManager)getSystemService("keyguard")).newKeyguardLock("tag");
}
mKkeyguardLock.disableKeyguard();
Then I reactivated the keyguard:
mKkeyguardLock.reenableKeyguard();
mKkeyguardLock = null;
This works, but the lock gets visible then immediately. But it should be enabled but inactive. Difference: The app remains visible. Only if the user presses the power button briefly, the lockscreen gets visible. Do you have any idea how to reenable but not activate the keyguard?
I also tried:
Window wind = MyActivity.this.getWindow();
if (wind != null) {
wind.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD);
}
and reenabling
wind.addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED);
This does not reactivate the keyguard at all. Thank you