FingerprintGestureController


public final class FingerprintGestureController
extends Object

java.lang.Object
   ↳ android.accessibilityservice.FingerprintGestureController


An AccessibilityService can capture gestures performed on a device's fingerprint sensor, as long as the device has a sensor capable of detecting gestures.

This capability must be declared by the service as AccessibilityServiceInfo#CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES. It also requires the permission Manifest.permission.USE_FINGERPRINT.

Because capturing fingerprint gestures may have side effects, services with the capability only capture gestures when AccessibilityServiceInfo#FLAG_REQUEST_FINGERPRINT_GESTURES is set.

Note: The fingerprint sensor is used for authentication in critical use cases, so services must carefully design their user's experience when performing gestures on the sensor. When the sensor is in use by an app, for example, when authenticating or enrolling a user, the sensor will not detect gestures. Services need to ensure that users understand when the sensor is in-use for authentication to prevent users from authenticating unintentionally when trying to interact with the service. They can use FingerprintGestureCallback#onGestureDetectionAvailabilityChanged(boolean) to learn when gesture detection becomes unavailable.

Multiple accessibility services may listen for fingerprint gestures simultaneously, so services should provide a way for the user to disable the use of this feature so multiple services don't conflict with each other.

Summary

Nested classes

class FingerprintGestureController.FingerprintGestureCallback

Class that is called back when fingerprint gestures are being used for accessibility. 

Constants

int FINGERPRINT_GESTURE_SWIPE_DOWN

Identifier for a swipe down on the fingerprint sensor

int FINGERPRINT_GESTURE_SWIPE_LEFT

Identifier for a swipe left on the fingerprint sensor

int FINGERPRINT_GESTURE_SWIPE_RIGHT

Identifier for a swipe right on the fingerprint sensor

int FINGERPRINT_GESTURE_SWIPE_UP

Identifier for a swipe up on the fingerprint sensor

Public methods

boolean isGestureDetectionAvailable()

Gets if the fingerprint sensor's gesture detection is available.

void registerFingerprintGestureCallback(FingerprintGestureController.FingerprintGestureCallback callback, Handler handler)

Register a callback to be informed of fingerprint sensor gesture events.

void unregisterFingerprintGestureCallback(FingerprintGestureController.FingerprintGestureCallback callback)

Unregister a listener added with registerFingerprintGestureCallback(FingerprintGestureCallback, Handler).

Inherited methods

Constants

FINGERPRINT_GESTURE_SWIPE_DOWN

Added in API level 26
public static final int FINGERPRINT_GESTURE_SWIPE_DOWN

Identifier for a swipe down on the fingerprint sensor

Constant Value: 8 (0x00000008)

FINGERPRINT_GESTURE_SWIPE_LEFT

Added in API level 26
public static final int FINGERPRINT_GESTURE_SWIPE_LEFT

Identifier for a swipe left on the fingerprint sensor

Constant Value: 2 (0x00000002)

FINGERPRINT_GESTURE_SWIPE_RIGHT

Added in API level 26
public static final int FINGERPRINT_GESTURE_SWIPE_RIGHT

Identifier for a swipe right on the fingerprint sensor

Constant Value: 1 (0x00000001)

FINGERPRINT_GESTURE_SWIPE_UP

Added in API level 26
public static final int FINGERPRINT_GESTURE_SWIPE_UP

Identifier for a swipe up on the fingerprint sensor

Constant Value: 4 (0x00000004)

Public methods

isGestureDetectionAvailable

Added in API level 26
public boolean isGestureDetectionAvailable ()

Gets if the fingerprint sensor's gesture detection is available.

Returns
boolean true if the sensor's gesture detection is available. false if it is not currently detecting gestures (for example, if it is enrolling a finger).

registerFingerprintGestureCallback

Added in API level 26
public void registerFingerprintGestureCallback (FingerprintGestureController.FingerprintGestureCallback callback, 
                Handler handler)

Register a callback to be informed of fingerprint sensor gesture events.

Parameters
callback FingerprintGestureController.FingerprintGestureCallback: The listener to be added. This value cannot be null.

handler Handler: The handler to use for the callback. If null, callbacks will happen on the service's main thread.

unregisterFingerprintGestureCallback

Added in API level 26
public void unregisterFingerprintGestureCallback (FingerprintGestureController.FingerprintGestureCallback callback)

Unregister a listener added with registerFingerprintGestureCallback(FingerprintGestureCallback, Handler).

Parameters
callback FingerprintGestureController.FingerprintGestureCallback: The callback to remove. Removing a callback that was never added has no effect.