Skip to content

Commit c3131e6

Browse files
committed
add finger print command to android Driver
1 parent c7dd6f7 commit c3131e6

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/main/java/io/appium/java_client/MobileCommand.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class MobileCommand {
5757
protected static final String GET_NETWORK_CONNECTION = "getNetworkConnection";
5858
protected static final String IS_LOCKED = "isLocked";
5959
protected static final String LONG_PRESS_KEY_CODE = "longPressKeyCode";
60+
protected static final String FINGER_PRINT = "fingerPrint";
6061
protected static final String OPEN_NOTIFICATIONS = "openNotifications";
6162
protected static final String PRESS_KEY_CODE = "pressKeyCode";
6263
protected static final String PUSH_FILE = "pushFile";
@@ -103,6 +104,7 @@ private static Map<String, CommandInfo> createCommandRepository() {
103104
result.put(IS_LOCKED, postC("/session/:sessionId/appium/device/is_locked"));
104105
result.put(LONG_PRESS_KEY_CODE,
105106
postC("/session/:sessionId/appium/device/long_press_keycode"));
107+
result.put(FINGER_PRINT, postC("/session/:sessionId/appium/device/finger_print"));
106108
result.put(OPEN_NOTIFICATIONS,
107109
postC("/session/:sessionId/appium/device/open_notifications"));
108110
result.put(PRESS_KEY_CODE,

src/main/java/io/appium/java_client/android/AndroidDeviceActionShortcuts.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.appium.java_client.android;
1818

19+
import static io.appium.java_client.android.AndroidMobileCommandHelper.fingerPrintCommand;
1920
import static io.appium.java_client.android.AndroidMobileCommandHelper.longPressKeyCodeCommand;
2021
import static io.appium.java_client.android.AndroidMobileCommandHelper.pressKeyCodeCommand;
2122

@@ -46,6 +47,15 @@ default void pressKeyCode(int key, Integer metastate) {
4647
CommandExecutionHelper.execute(this, pressKeyCodeCommand(key, metastate));
4748
}
4849

50+
/**
51+
* Authenticate users by using their finger print scans on supported emulators.
52+
*
53+
* @param fingerPrintId finger prints stored in Android Keystore system (from 1 to 10)
54+
*/
55+
default void fingerPrint(int fingerPrintId) {
56+
CommandExecutionHelper.execute(this, fingerPrintCommand(fingerPrintId));
57+
}
58+
4959
/**
5060
* Send a long key event to the device.
5161
*

src/main/java/io/appium/java_client/android/AndroidMobileCommandHelper.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,19 @@ public class AndroidMobileCommandHelper extends MobileCommand {
147147
LONG_PRESS_KEY_CODE, prepareArguments(parameters, values));
148148
}
149149

150+
/**
151+
* This method forms a {@link java.util.Map} of parameters for the
152+
* finger print authentication invocation.
153+
*
154+
* @param fingerPrintId finger prints stored in Android Keystore system (from 1 to 10)
155+
* @return a key-value pair. The key is the command name. The value is a
156+
* {@link java.util.Map} command arguments.
157+
*/
158+
public static Map.Entry<String, Map<String, ?>> fingerPrintCommand(int fingerPrintId) {
159+
return new AbstractMap.SimpleEntry<>(FINGER_PRINT,
160+
prepareArguments("fingerprintId", fingerPrintId));
161+
}
162+
150163
/**
151164
* This method forms a {@link java.util.Map} of parameters for the
152165
* notification opening.

0 commit comments

Comments
 (0)