24

How to disable Fingerprint sensor in Android Emulator? I could not find any option in settings window or config.ini file.

By default, all the emulators above SDK 23 have fingerprint support. I would like to test my flow in above SDK 23 with no fingerprint support.

Ponsuyambu
  • 4,730
  • 2
  • 20
  • 35

2 Answers2

4

It is not possible to achieve with conventional methods. There are unconventional though.

The reason you cannot disable is that its presence is regulated not via Android Framework but via underlaying Linux OS as for all the other sensors. Thus if your system has driver for this sensor - Android will think that this sensor is present.

So fingerprint sensor presence is driver dependent. The solution is easy now. If there will be no driver - there will be no sensor present. All you have to do is to disable(disconnect from the OS) driver. For that you will need

  • root
  • adb shell or some terminal app installed(su or something)

I am not completely sure how fingerprint driver is depicted in the system(I was doing it with other sensor) but after not very long googling and using of extrapolation I think it may be called something like fpc.

So you may want to search for this in the system drives folder - something like /sys/bus/(platform/spi/blablabla/something)/drivers/fpc.../

In the folder there should be four files - uevent, bind and the ones we will need unbind and deviceName.

And now unbind the sensor - echo deviceName > /sys/bus/(platform/spi/blablabla/something)/drivers/fpc.../unbind

Now the system will think that there is no fingerprint sensor in the system... till the next reboot.

I was doing this on the real device and with other sensor but I think the method should be pretty much the same.

Inspiration taken from here

Hope it helps.

Pavlo Ostasha
  • 8,161
  • 6
  • 23
  • I did a "ls -dla /sys/bus/*/drivers/*" there is no fpc. fpc1020 is in Qualcomm kernel. Android emulator suppose to use goldfish kernel. Do you know by any chance fingerprint driver name used in android emulator 28? – logcat Dec 13 '19 at 13:50
  • Sorry, mate, but no. I suppose you can find it in time but the question is that will this time be reasonable. Maybe it will be better/easier/faster to find a phone without the fingerprint scanner? – Pavlo Ostasha Dec 13 '19 at 14:26
2

There is no clear way to override it in the emulator settings. A workaround would be to extend either BiometricPrompt (API 28+) or FingerprintManagerCompat (27 and below) and provide your own implementation. For an extension of FingerprintManagerCompat you would override isHardwareDetected() to be something like

    override fun isHardwareDetected() {
          if (System.getProperty("os.arch") == "mips64") {
                return false;
          } 
          return super.isHardwareDetected()
    }

For BiometricPrompt you would override BiometricPrompt.authenticate() in a similar manner to return the constant BIOMETRIC_ERROR_HW_UNAVAILABLE.

James Jordan Taylor
  • 1,240
  • 3
  • 17
  • 35