From 902de4cc3a218a333999d63f32d10174d7a088ee Mon Sep 17 00:00:00 2001 From: Arthur Hung Date: Mon, 22 Nov 2021 07:02:16 +0000 Subject: [PATCH] Adjust MotionEvent.FLAG_CANCELED flag to public The flas is used to indicates that the pointer has been canceled by accidental touch. Bug: 207322720 Test: atest CtsInputTestCases Change-Id: I7e39242f53e78089adce622ca379109e88cf9ec2 --- core/api/current.txt | 1 + core/java/android/view/MotionEvent.java | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 6009cd0b2e378..80861a7c61d6d 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -48886,6 +48886,7 @@ package android.view { field public static final int EDGE_LEFT = 4; // 0x4 field public static final int EDGE_RIGHT = 8; // 0x8 field public static final int EDGE_TOP = 1; // 0x1 + field public static final int FLAG_CANCELED = 32; // 0x20 field public static final int FLAG_WINDOW_IS_OBSCURED = 1; // 0x1 field public static final int FLAG_WINDOW_IS_PARTIALLY_OBSCURED = 2; // 0x2 field public static final int INVALID_POINTER_ID = -1; // 0xffffffff diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 8db62f6553eba..cc93adc325414 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -478,10 +478,15 @@ public final class MotionEvent extends InputEvent implements Parcelable { public static final int FLAG_IS_GENERATED_GESTURE = 0x8; /** - * This flag associated with {@link #ACTION_POINTER_UP}, this indicates that the pointer - * has been canceled. Typically this is used for palm event when the user has accidental - * touches. - * @hide + * This flag is only set for events with {@link #ACTION_POINTER_UP} and {@link #ACTION_CANCEL}. + * It indicates that the pointer going up was an unintentional user touch. When FLAG_CANCELED + * is set, the typical actions that occur in response for a pointer going up (such as click + * handlers, end of drawing) should be aborted. This flag is typically set when the user was + * accidentally touching the screen, such as by gripping the device, or placing the palm on the + * screen. + * + * @see #ACTION_POINTER_UP + * @see #ACTION_CANCEL */ public static final int FLAG_CANCELED = 0x20;