简体   繁体   English

在Android 6.0中使用lockNow后如何保留指纹解锁?

[英]How to retain fingerprint unlock after using lockNow in Android 6.0?

How do we retain the seamless fingerprint unlocking effect after using DevicePolicyManager to perform lockNow() in Android 6.0? 在Android 6.0中使用DevicePolicyManager执行lockNow()之后,如何保持无缝的指纹解锁效果?

Assuming on devices with fingerprint scanner and the app calling lockNow() has "USES_POLICY_FORCE_LOCK" and had been granted Device Administrator status. 假设在具有指纹扫描仪且调用了app的应用程序的设备上具有“ USES_POLICY_FORCE_LOCK”,并且已被授予设备管理员状态。

This is the documentation for the lockNow() function: 这是关于lockNow()函数的文档:

public void lockNow () public void lockNow()

Make the device lock immediately, as if the lock screen timeout has expired at the point of this call. 立即使设备锁定,就像锁定屏幕超时已在此调用时到期一样。

The calling device admin must have requested USES_POLICY_FORCE_LOCK to be able to call this method; 调用设备的管理员必须已请求USES_POLICY_FORCE_LOCK才能调用此方法。 if it has not, a security exception will be thrown. 如果还没有,则将引发安全异常。

Gaining Device Administrator status and performing lock just fine. 获得设备管理员状态并执行锁定就可以了。 For sake of reference, see this SO question for the approach I used. 为了便于参考,请参阅此SO问题以了解我使用的方法。

The problem is after the phone locks, the fingerprint scanner no longer smoothly unlocks the phone. 问题是手机锁定后,指纹扫描仪不再能顺利解锁手机。 Instead, the fingerprint scanner prompts me to input the fallback PIN code. 相反,指纹扫描仪会提示我输入后备PIN码。 Is there something new I have to do in Android 6.0 in order to retain the fingerprint unlocking effect after performing a lockNow() call? 为了在执行lockNow()调用后保持指纹解锁效果,我必须在Android 6.0中做些新的事情吗?

I have looked at all the DevicePolicyManager flags ( in the documentation ) and it seems to be offering disabling of things rather than enabling of things. 我查看了所有DevicePolicyManager标志( 在文档中 ),它似乎在提供禁用功能,而不是启用功能。

Thanks! 谢谢!

Looks like Google has marked it Working as Intended without any proper explanation. 似乎Google已将其标记为“预期工作”,而没有任何适当的解释。

https://code.google.com/p/android/issues/detail?id=79735#c110 https://code.google.com/p/android/issues/detail?id=79735#c110

and also here https://code.google.com/p/android/issues/detail?id=191955#c23 还有这里https://code.google.com/p/android/issues/detail?id=191955#c23

So we currently we have no way of locking the screen programmatically while keeping smart lock working. 因此,我们目前无法在保持智能锁正常工作的情况下以编程方式锁定屏幕。 They also say that "developers are using it incorrectly". 他们还说“开发人员使用错误”。 Not sure if they are joking or serious. 不知道他们是在开玩笑还是认真。

EDIT : some unsatisfactory explanation here https://code.google.com/p/android/issues/detail?id=79735#c115 编辑:一些不满意的解释在这里https://code.google.com/p/android/issues/detail?id=79735#c115

As mentioned in this link: https://code.google.com/p/android/issues/detail?id=79735 , this seems to be a problem with smart lock, and not just the google imprint (fingerprint scanner). 如该链接所述: https : //code.google.com/p/android/issues/detail?id=79735 ,这似乎是智能锁的问题,而不仅仅是Google烙印(指纹扫描仪)。

If you can rely on root privileges you can probably use: PowerManager.goToSleep(0); 如果可以依靠root用户特权,则可以使用: PowerManager.goToSleep(0);

Without root privileges it looks like there is no better solution as of today. 没有root特权,看来到目前为止没有更好的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM