What's the difference between isDeviceLocked and isKeyguardSecure in android's KeyguardManager?

后端 未结 1 2035
有刺的猬
有刺的猬 2020-12-16 16:03

Below is excerpted from http://developer.android.com/reference/android/app/KeyguardManager.html

public boolean isDeviceLocked ()

Returns

相关标签:
1条回答
  • 2020-12-16 16:37

    public boolean isDeviceLocked ()

    This method takes the current UI state of the Lockscreen into account.

    So if a secure Screen Lock has been setup, it will contrary to isKeyguardSecure() return false if:

    • The user has unlocked the Lockscreen and is using the device
    • The Smart Lock feature (Settings -> Security -> Smart Lock) allows the device to be unlocked without further authentication

    public boolean isKeyguardSecure ()

    This method does NOT take the current UI state of the Lockscreen into account.

    So if a secure Screen Lock has been setup, it will always return true, regardless of if the Lockscreen has been unlocked by the user or if Smart Lock allows unlock without further authentication.

    I was not able to reproduce the behavior reported by ByteHamster btw.

    0 讨论(0)
提交回复
热议问题