android after disableKeyguard the inKeyguardRestrictedInputMode() still return true

2.1k Views Asked by At

version: android 4.4.2

I use keyguardLock.disableKeyguard() unlock the screen, then use keyguardManager.inKeyguardRestrictedInputMode() print screen lock state, it always return true,but the powerManager.isScreenOn() return true,and i can use my phone normally.

ps: I do lock and unlock in a android service.

Is there any thing wrong when use disableKeyguard()?

1

There are 1 best solutions below

7
On BEST ANSWER

The keyguardLock is deprecated starting from API 13. Please use the FLAG_DISMISS_KEYGUARD and/or FLAG_SHOW_WHEN_LOCKED. See here