Ponsuyambu
Ponsuyambu

Reputation: 8936

Disable Fingerprint Sensor - Android Emulator

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.

Upvotes: 27

Views: 6177

Answers (2)

James Jordan Taylor
James Jordan Taylor

Reputation: 1718

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.

Upvotes: 3

Pavlo Ostasha
Pavlo Ostasha

Reputation: 16699

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.

Upvotes: 4

Related Questions