Pavol
Pavol

Reputation: 572

How to set fingerprint lock screen from adb?

I am trying to enroll fingerprint to android emulator with adb command line.

I know I can set PIN with this command:

adb shell locksettings set-pin 1111

I can enter security settings with this:

adb shell am start -a android.settings.SECURITY_SETTINGS

I can touch fingerprint to sensor with:

adb -e emu finger touch 1

But is there way how to enroll fingerprint? Thank You!!

Upvotes: 5

Views: 7127

Answers (1)

pddthinh
pddthinh

Reputation: 161

Here are my steps to enroll a fingerprint on the emulator by only using adb command (tested on a x86_64, Google API 28 emulator):

  • Set the lock screen passcode to be 1111
$ adb shell locksettings set-pin 1111
  • Start the Settings app
$ adb shell am start -a android.settings.SECURITY_SETTINGS
  • Tap the Fingerprint item
$ adb shell input tap 274 1469
  • Tap the Next button on the confirm screen
$ adb shell input tap 914 1704

NOTE: the tap's coordinate was getting on the same emulator by enabling the Show Touch Location under the Developer Options setting.

  • Enter the passcode in the confirmation screen
$ adb shell input text 1111 && adb shell input keyevent 66
  • Execute the following command for at least 3 times to finish the fingerprint enrollment
$ adb -e emu finger touch 1
  • Finally, close the screen
$ adb shell input tap 914 1704

Updated: To find the location for the click/tap action (e.g. 914 1704) enable the Pointer location in the Developer Option as attached image

Upvotes: 2

Related Questions