Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 386085b0 authored by Harry Cutts's avatar Harry Cutts Committed by Android (Google) Code Review
Browse files

Merge "MotionEvent: add API for identifying resampled PointerCoords" into main

parents efa35f6d f3f5f153
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -51147,6 +51147,7 @@ package android.view {
    method public void clear();
    method public void copyFrom(android.view.MotionEvent.PointerCoords);
    method public float getAxisValue(int);
    method @FlaggedApi("com.android.hardware.input.pointer_coords_is_resampled_api") public boolean isResampled();
    method public void setAxisValue(int, float);
    field public float orientation;
    field public float pressure;
+7 −0
Original line number Diff line number Diff line
@@ -17,3 +17,10 @@ flag {
    bug: "294546335"
}


flag {
    namespace: "input_native"
    name: "pointer_coords_is_resampled_api"
    description: "Makes MotionEvent.PointerCoords#isResampled() a public API"
    bug: "298197511"
}
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.view.Display.DEFAULT_DISPLAY;

import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -35,6 +36,8 @@ import android.os.SystemClock;
import android.util.Log;
import android.util.SparseArray;

import com.android.hardware.input.Flags;

import dalvik.annotation.optimization.CriticalNative;
import dalvik.annotation.optimization.FastNative;

@@ -4377,6 +4380,28 @@ public final class MotionEvent extends InputEvent implements Parcelable {
         */
        public boolean isResampled;

        /**
         * Returns true if these pointer coordinates were generated by resampling, rather than from
         * an actual input event from the device at this time.
         * <p>
         * Resampling extrapolates or interpolates touch coordinates reported by the input device to
         * better align them with the refresh rate of the display, resulting in smoother movements,
         * in particular for scrolling. Resampled coordinates are always added to batches, so a
         * motion event will always contain at least one sample that is an original event from the
         * input device (i.e. for which this method will return {@code false}).
         * </p><p>
         * Resampling does not occur if unbuffered dispatch has been requested, or if it has been
         * disabled by the manufacturer (for example, on hardware that already synchronizes its
         * touch events and display frames).
         * </p>
         * @see android.view.View#requestUnbufferedDispatch(int)
         * @see android.view.View#requestUnbufferedDispatch(MotionEvent)
         */
        @FlaggedApi(Flags.FLAG_POINTER_COORDS_IS_RESAMPLED_API)
        public boolean isResampled() {
            return isResampled;
        }

        /**
         * Clears the contents of this object.
         * Resets all axes to zero.