简体   繁体   中英

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?

Assuming on devices with fingerprint scanner and the app calling lockNow() has "USES_POLICY_FORCE_LOCK" and had been granted Device Administrator status.

This is the documentation for the lockNow() function:

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; 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.

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. 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?

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.

Thanks!

Looks like Google has marked it Working as Intended without any proper explanation.

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

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

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).

If you can rely on root privileges you can probably use: PowerManager.goToSleep(0);

Without root privileges it looks like there is no better solution as of today.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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