8

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!

Community
  • 1
  • 1
Duy Nguyen
  • 2,869
  • 1
  • 12
  • 6
  • I'm not sure but I think my problem is related to yours. I'll keep an eye here also http://stackoverflow.com/questions/33945568/how-to-use-flag-dismiss-keyguard-with-fingerprint-sensor – anandbibek Nov 28 '15 at 19:30

2 Answers2

4

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

anandbibek
  • 1,659
  • 16
  • 20
  • Quoting there response `"We have looked into the issue you have reported and would like to inform that this is` **working as intended due to the app developers incorrectly making use of lockNow()**. `This needs to be handled by the respective app developers for the upcoming release of Android N. "` What did I just read??? – anandbibek May 31 '16 at 15:49
  • Thank you! At least a Googler in post #115 from June 2, 2016 in issue 79735 you linked to above provided clarifications as to WHY they flagged it as "working as intended"... – Duy Nguyen Jun 11 '16 at 05:26
  • On #116 the counter arguments are good. Google's approach still baffles me. They cited DoS as security concern. But funny thing is how Android is full of such DoS opportunities everywhere. For example, how 3rd party app locks and lockscreens work, by constantly bringing up an activity to the front in an endless loop – anandbibek Jun 11 '16 at 17:07
0

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.

prasun
  • 7,073
  • 9
  • 41
  • 59
e-shfiyut
  • 3,538
  • 2
  • 30
  • 31