Make MotionEvent#obtain with classification public
Bug: 257028305
Test: run presubmits
Change-Id: I53d2925033bb3a51751fcf00fc32cb862062d52c
diff --git a/core/api/current.txt b/core/api/current.txt
index 3a0788d..9d15aa8 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -49491,6 +49491,7 @@
method public float getY(int);
method public float getYPrecision();
method public boolean isButtonPressed(int);
+ method @Nullable public static android.view.MotionEvent obtain(long, long, int, int, @NonNull android.view.MotionEvent.PointerProperties[], @NonNull android.view.MotionEvent.PointerCoords[], int, int, float, float, int, int, int, int, int, int);
method public static android.view.MotionEvent obtain(long, long, int, int, android.view.MotionEvent.PointerProperties[], android.view.MotionEvent.PointerCoords[], int, int, float, float, int, int, int, int);
method @Deprecated public static android.view.MotionEvent obtain(long, long, int, int, int[], android.view.MotionEvent.PointerCoords[], int, float, float, int, int, int, int);
method public static android.view.MotionEvent obtain(long, long, int, float, float, float, float, int, float, float, int, int);
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index b3e8fb6..c8a5d8d 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -22,7 +22,9 @@
import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.annotation.IntDef;
+import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.graphics.Matrix;
@@ -1780,19 +1782,18 @@
* @param displayId The display ID associated with this event.
* @param flags The motion event flags.
* @param classification The classification to give this event.
- * @hide
*/
- public static MotionEvent obtain(long downTime, long eventTime,
- int action, int pointerCount, PointerProperties[] pointerProperties,
- PointerCoords[] pointerCoords, int metaState, int buttonState,
- float xPrecision, float yPrecision, int deviceId,
- int edgeFlags, int source, int displayId, int flags,
- @Classification int classification) {
+ public static @Nullable MotionEvent obtain(long downTime, long eventTime, int action,
+ int pointerCount,
+ @SuppressLint("ArrayReturn") @NonNull PointerProperties[] pointerProperties,
+ @SuppressLint("ArrayReturn") @NonNull PointerCoords[] pointerCoords, int metaState,
+ int buttonState, float xPrecision, float yPrecision, int deviceId, int edgeFlags,
+ int source, int displayId, int flags, @Classification int classification) {
MotionEvent ev = obtain();
final boolean success = ev.initialize(deviceId, source, displayId, action, flags, edgeFlags,
metaState, buttonState, classification, 0, 0, xPrecision, yPrecision,
- downTime * NS_PER_MS, eventTime * NS_PER_MS,
- pointerCount, pointerProperties, pointerCoords);
+ downTime * NS_PER_MS, eventTime * NS_PER_MS, pointerCount, pointerProperties,
+ pointerCoords);
if (!success) {
Log.e(TAG, "Could not initialize MotionEvent");
ev.recycle();