I'm trying to lock/unlock the screen using Keyguard and everything works as expected when using the KeyguardManager.KeyguardLock disableKeyguard()
and reenableKeyguard()
functions.
I've tried it with "regular" slider lock, pattern, PIN and password lock and
they are all disabled and enabled when the appropriate functions are called.
The only thing that worries me is that the documentation of these functions has the following statement:
This call has no effect while any DevicePolicyManager is enabled that requires a password
I'm not sure I understand exactly in which cases this might not work and wouldn't like to find out after I release my application...
I tried reading a bit more on DevicePolicyManager
but couldn't find any way to find out if there is an active DevicePolicyManager that will prevent the enable/disable screen lock functions to work.
Can you please describe a scenario that this w开发者_运维技巧ill not work, and how I can identify these cases ?
The most common form of this "in the wild" is the user having a corporate Exchange device admin that requires they have a password. I believe the DeviceAdmin in the APIDemos is sufficient to test against this.
精彩评论