Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 414
Duy Nguyen Avatar asked Nov 11 '15 23:11

Duy Nguyen


People also ask

How do I add fingerprints to my Lock screen?

Setting up your fingerprintTap the Settings icon on your Android device and tap Lock screen and security. Scroll down and tap Screen lock type. Add your fingerprint — follow the instructions on your screen and go through the wizard. You'll be prompted to lift and rest your finger on the home button several times.

How do I lock my fingerprint lock on Android?

1 Swipe up Home screen to launch app screen then tap on Settings. 2 Tap on Lock screen. Then tap on Toggle to Enable Fingerprint.


1 Answers

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

like image 170
anandbibek Avatar answered Oct 16 '22 05:10

anandbibek