summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt1
-rw-r--r--core/java/android/view/MotionEvent.java19
2 files changed, 11 insertions, 9 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 3ca7dadfcddc..19f9515b4d53 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -49563,6 +49563,7 @@ package android.view {
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 b3e8fb68ee78..c8a5d8d887f9 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -22,7 +22,9 @@ import static android.view.Display.DEFAULT_DISPLAY;
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 @@ public final class MotionEvent extends InputEvent implements Parcelable {
* @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();