How to save fingerprint unlock after using lockNow in Android 6.0?

How do we maintain the seamless fingerprint effect after using DevicePolicyManager to execute lockNow () in Android 6.0?

Assuming that on devices with a fingerprint scanner and when the application is called, lockNow () has "USES_POLICY_FORCE_LOCK" and it was granted the status of the Device Administrator.

This is the documentation for the lockNow () function:

public void lockNow ()

Lock the device immediately, as if the screen lock timeout expired at the time of this call.

The administrator of the calling device must request USES_POLICY_FORCE_LOCK in order to be able to call this method; if this is not the case, a security exception will be thrown.

Getting device administrator status and performing a lock is just fine. For reference, see this SO question for the approach used.

The problem is that after locking the phone, the fingerprint scanner stops smoothly unlocking the phone. Instead, the fingerprint scanner prompts me to enter a backup PIN. Is there anything new that I have to do in Android 6.0 to preserve the effect of unlocking the fingerprints after making the lockNow () call?

I looked at all the DevicePolicyManager flags ( in the documentation ), and it seems to suggest disabling things, rather than enabling things.

Thanks!

+6
source share
2 answers

It seems that Google has noted that it is 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, at present, we are not able to lock the screen programmatically, while maintaining the operation of the smart lock. They also say that "developers are using it the wrong way." Not sure if they are joking or serious.

EDIT: some unsatisfactory explanations here https://code.google.com/p/android/issues/detail?id=79735#c115

+3
source

As mentioned in this link: https://code.google.com/p/android/issues/detail?id=79735 , this seems to be a smart lock problem, not just a google fingerprint (fingerprint scanner).

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

Without root privileges, it seems like there is no better solution today.

0
source

All Articles