From f6e0f39cde58daa4d104ac9c99eb7f4d307a48d8 Mon Sep 17 00:00:00 2001 From: Ilya Matyukhin Date: Mon, 7 Feb 2022 15:40:21 -0800 Subject: [PATCH] Add new fields to fingerprint PointerContext The new fields provide additional information to the HAL about the touch events originating from the framework. Bug: 205915651 Test: m android.hardware.biometrics.common-update-api Test: m android.hardware.biometrics.fingerprint-update-api Test: lunch cf_x86_phone-userdebug && m Change-Id: I987e26ac03e3268eea30feb9bbddffe6ca8d0035 --- .../biometrics/common/OperationContext.aidl | 2 +- .../biometrics/common/OperationContext.aidl | 4 +- .../fingerprint/PointerContext.aidl | 11 ++-- .../fingerprint/PointerContext.aidl | 63 ++++++++++++++++--- 4 files changed, 65 insertions(+), 15 deletions(-) diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl index 3a6461ed91..9d1cb8ff86 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl @@ -36,6 +36,6 @@ package android.hardware.biometrics.common; parcelable OperationContext { int id = 0; android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN; - boolean isAoD = false; + boolean isAod = false; boolean isCrypto = false; } diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl index 390e6985e4..72fe660126 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl @@ -41,8 +41,8 @@ parcelable OperationContext { */ OperationReason reason = OperationReason.UNKNOWN; - /* Flag indicating that the display is in AoD mode. */ - boolean isAoD = false; + /* Flag indicating that the display is in AOD mode. */ + boolean isAod = false; /** Flag indicating that crypto was requested. */ boolean isCrypto = false; diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl index e383330b69..43db6cfb51 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -34,10 +34,13 @@ package android.hardware.biometrics.fingerprint; @VintfStability parcelable PointerContext { - int pointerId = 0; - int x = 0; - int y = 0; + int pointerId = -1; + float x = 0.000000f; + float y = 0.000000f; float minor = 0.000000f; float major = 0.000000f; - boolean isAoD = false; + float orientation = 0.000000f; + boolean isAod = false; + long time = 0; + long gestureStart = 0; } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl index 4975175d8c..e025d3440d 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -21,14 +21,35 @@ package android.hardware.biometrics.fingerprint; */ @VintfStability parcelable PointerContext { - /* See android.view.MotionEvent#getPointerId. */ - int pointerId = 0; + /** + * Pointer ID obtained from MotionEvent#getPointerId or -1 if the ID cannot be obtained, for + * example if this event originated from a low-level wake-up gesture. + * + * See android.view.MotionEvent#getPointerId. + */ + int pointerId = -1; - /* The distance in pixels from the left edge of the display. */ - int x = 0; + /** + * The distance in pixels from the left edge of the display. + * + * This is obtained from MotionEvent#getRawX and translated relative to Surface#ROTATION_0. + * Meaning, this value is always reported as if the device is in its natural (e.g. portrait) + * orientation. + * + * See android.view.MotionEvent#getRawX. + */ + float x = 0f; - /* The distance in pixels from the top edge of the display. */ - int y = 0; + /** + * The distance in pixels from the top edge of the display. + * + * This is obtained from MotionEvent#getRawY and translated relative to Surface#ROTATION_0. + * Meaning, this value is always reported as if the device is in its natural (e.g. portrait) + * orientation. + * + * See android.view.MotionEvent#getRawY. + */ + float y = 0f; /* See android.view.MotionEvent#getTouchMinor. */ float minor = 0f; @@ -36,6 +57,32 @@ parcelable PointerContext { /* See android.view.MotionEvent#getTouchMajor. */ float major = 0f; - /* Flag indicating that the display is in AoD mode. */ - boolean isAoD = false; + /* See android.view.MotionEvent#getOrientation. */ + float orientation = 0f; + + /* Flag indicating that the display is in AOD mode. */ + boolean isAod = false; + + /** + * The time of the user interaction that produced this event, in milliseconds. + * + * This is obtained from MotionEvent#getEventTime, which uses SystemClock.uptimeMillis() as + * the clock. + * + * See android.view.MotionEvent#getEventTime + */ + long time = 0; + + /** + * The time of the first user interaction in this gesture, in milliseconds. + * + * If this event is MotionEvent#ACTION_DOWN, it means it's the first event in this gesture, + * and `gestureStart` will be equal to `time`. + * + * This is obtained from MotionEvent#getDownTime, which uses SystemClock.uptimeMillis() as + * the clock. + * + * See android.view.MotionEvent#getDownTime + */ + long gestureStart = 0; }