Android Keyguard 和 DevicePolicyManager
我正在尝试使用 Keyguard 锁定/解锁屏幕,并且使用 KeyguardManager.KeyguardLock disableKeyguard()
和 reenableKeyguard()
函数。 我尝试过“常规”滑块锁、图案锁、PIN 码和密码锁, 当调用适当的函数时,它们都会被禁用和启用。
唯一让我担心的是这些函数的文档中有以下声明: 当启用任何需要密码的 DevicePolicyManager 时,此调用无效
我不确定我是否准确理解在哪些情况下这可能不起作用,并且不想在发布应用程序后找出答案。 ..
我尝试阅读更多有关 DevicePolicyManager
的内容,但找不到任何方法来查明是否存在活动的 DevicePolicyManager 来阻止启用/禁用屏幕锁定功能的工作。
您能否描述一下这不起作用的场景,以及我如何识别这些情况?
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 will not work, and how I can identify these cases ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这种“野外”最常见的形式是用户拥有要求他们拥有密码的企业 Exchange 设备管理员。我相信 APIDemos 中的 DeviceAdmin 足以对此进行测试。
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.