To unlock the screen in my service, I used disableKeyguard
method in KeyguardManager
.
KeyguardManager.KeyguardLock kl = keyguardManager.newKeyguardLock("MyKeyguardLock");
kl.disableKeyguard();
However, it also removes the auto sleep/turn off my screen. I want to maintain the option. It means that the screen will be turned on using above code, then if the user does not press anything to screen, it will auto turn off after a period of time. I know a method to reenable the keyguardManager as kl.reenableKeyguard();
, but it has to call somewhere. Thank you so much