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

Commit 11420c43 authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Add millis suffix to BackEvent#getFrameTime API

Bug: 373656418
Test: OnBackInvokedCallbackGestureTest
Test: WindowOnBackInvokedDispatcherTest
Flag: com.android.window.flags.predictive_back_timestamp_api
Change-Id: I143a343ad0eedd63f40533c8adecb81be3e06066
parent 7c6f77f6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -61775,7 +61775,7 @@ package android.window {
  public final class BackEvent {
    ctor public BackEvent(float, float, float, int);
    ctor @FlaggedApi("com.android.window.flags.predictive_back_timestamp_api") public BackEvent(float, float, float, int, long);
    method @FlaggedApi("com.android.window.flags.predictive_back_timestamp_api") public long getFrameTime();
    method @FlaggedApi("com.android.window.flags.predictive_back_timestamp_api") public long getFrameTimeMillis();
    method @FloatRange(from=0, to=1) public float getProgress();
    method public int getSwipeEdge();
    method public float getTouchX();
+10 −10
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public final class BackEvent {
    private final float mTouchX;
    private final float mTouchY;
    private final float mProgress;
    private final long mFrameTime;
    private final long mFrameTimeMillis;

    @SwipeEdge
    private final int mSwipeEdge;
@@ -68,7 +68,7 @@ public final class BackEvent {
        if (predictiveBackTimestampApi()) {
            return new BackEvent(backMotionEvent.getTouchX(), backMotionEvent.getTouchY(),
                    backMotionEvent.getProgress(), backMotionEvent.getSwipeEdge(),
                    backMotionEvent.getFrameTime());
                    backMotionEvent.getFrameTimeMillis());
        } else {
            return new BackEvent(backMotionEvent.getTouchX(), backMotionEvent.getTouchY(),
                    backMotionEvent.getProgress(), backMotionEvent.getSwipeEdge());
@@ -88,7 +88,7 @@ public final class BackEvent {
        mTouchY = touchY;
        mProgress = progress;
        mSwipeEdge = swipeEdge;
        mFrameTime = System.nanoTime() / TimeUtils.NANOS_PER_MS;
        mFrameTimeMillis = System.nanoTime() / TimeUtils.NANOS_PER_MS;
    }

    /**
@@ -98,16 +98,16 @@ public final class BackEvent {
     * @param touchY Absolute Y location of the touch point of this event.
     * @param progress Value between 0 and 1 on how far along the back gesture is.
     * @param swipeEdge Indicates which edge the swipe starts from.
     * @param frameTime frame time of the back event.
     * @param frameTimeMillis frame time of the back event.
     */
    @FlaggedApi(FLAG_PREDICTIVE_BACK_TIMESTAMP_API)
    public BackEvent(float touchX, float touchY, float progress, @SwipeEdge int swipeEdge,
            long frameTime) {
            long frameTimeMillis) {
        mTouchX = touchX;
        mTouchY = touchY;
        mProgress = progress;
        mSwipeEdge = swipeEdge;
        mFrameTime = frameTime;
        mFrameTimeMillis = frameTimeMillis;
    }

    /**
@@ -160,8 +160,8 @@ public final class BackEvent {
     * Returns the frameTime of the BackEvent in milliseconds. Useful for calculating velocity.
     */
    @FlaggedApi(FLAG_PREDICTIVE_BACK_TIMESTAMP_API)
    public long getFrameTime() {
        return mFrameTime;
    public long getFrameTimeMillis() {
        return mFrameTimeMillis;
    }

    @Override
@@ -177,7 +177,7 @@ public final class BackEvent {
                && mTouchY == that.mTouchY
                && mProgress == that.mProgress
                && mSwipeEdge == that.mSwipeEdge
                && mFrameTime == that.mFrameTime;
                && mFrameTimeMillis == that.mFrameTimeMillis;
    }

    @Override
@@ -187,7 +187,7 @@ public final class BackEvent {
                + ", mTouchY=" + mTouchY
                + ", mProgress=" + mProgress
                + ", mSwipeEdge=" + mSwipeEdge
                + ", mFrameTime=" + mFrameTime + "ms"
                + ", mFrameTimeMillis=" + mFrameTimeMillis
                + "}";
    }
}
+9 −9
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import android.view.RemoteAnimationTarget;
public final class BackMotionEvent implements Parcelable {
    private final float mTouchX;
    private final float mTouchY;
    private final long mFrameTime;
    private final long mFrameTimeMillis;
    private final float mProgress;
    private final boolean mTriggerBack;

@@ -49,7 +49,7 @@ public final class BackMotionEvent implements Parcelable {
     *
     * @param touchX Absolute X location of the touch point of this event.
     * @param touchY Absolute Y location of the touch point of this event.
     * @param frameTime Event time of the corresponding touch event.
     * @param frameTimeMillis Event time of the corresponding touch event.
     * @param progress Value between 0 and 1 on how far along the back gesture is.
     * @param triggerBack Indicates whether the back arrow is in the triggered state or not
     * @param swipeEdge Indicates which edge the swipe starts from.
@@ -59,14 +59,14 @@ public final class BackMotionEvent implements Parcelable {
    public BackMotionEvent(
            float touchX,
            float touchY,
            long frameTime,
            long frameTimeMillis,
            float progress,
            boolean triggerBack,
            @BackEvent.SwipeEdge int swipeEdge,
            @Nullable RemoteAnimationTarget departingAnimationTarget) {
        mTouchX = touchX;
        mTouchY = touchY;
        mFrameTime = frameTime;
        mFrameTimeMillis = frameTimeMillis;
        mProgress = progress;
        mTriggerBack = triggerBack;
        mSwipeEdge = swipeEdge;
@@ -80,7 +80,7 @@ public final class BackMotionEvent implements Parcelable {
        mTriggerBack = in.readBoolean();
        mSwipeEdge = in.readInt();
        mDepartingAnimationTarget = in.readTypedObject(RemoteAnimationTarget.CREATOR);
        mFrameTime = in.readLong();
        mFrameTimeMillis = in.readLong();
    }

    @NonNull
@@ -109,7 +109,7 @@ public final class BackMotionEvent implements Parcelable {
        dest.writeBoolean(mTriggerBack);
        dest.writeInt(mSwipeEdge);
        dest.writeTypedObject(mDepartingAnimationTarget, flags);
        dest.writeLong(mFrameTime);
        dest.writeLong(mFrameTimeMillis);
    }

    /**
@@ -156,8 +156,8 @@ public final class BackMotionEvent implements Parcelable {
    /**
     * Returns the frame time of the BackMotionEvent in milliseconds.
     */
    public long getFrameTime() {
        return mFrameTime;
    public long getFrameTimeMillis() {
        return mFrameTimeMillis;
    }

    /**
@@ -175,7 +175,7 @@ public final class BackMotionEvent implements Parcelable {
        return "BackMotionEvent{"
                + "mTouchX=" + mTouchX
                + ", mTouchY=" + mTouchY
                + ", mFrameTime=" + mFrameTime + "ms"
                + ", mFrameTimeMillis=" + mFrameTimeMillis
                + ", mProgress=" + mProgress
                + ", mTriggerBack=" + mTriggerBack
                + ", mSwipeEdge=" + mSwipeEdge
+2 −2
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ public class BackTouchTracker {
        return new BackMotionEvent(
                /* touchX = */ mInitTouchX,
                /* touchY = */ mInitTouchY,
                /* frameTime = */ 0,
                /* frameTimeMillis = */ 0,
                /* progress = */ 0,
                /* triggerBack = */ mTriggerBack,
                /* swipeEdge = */ mSwipeEdge,
@@ -236,7 +236,7 @@ public class BackTouchTracker {
        return new BackMotionEvent(
                /* touchX = */ mLatestTouchX,
                /* touchY = */ mLatestTouchY,
                /* frameTime = */ 0,
                /* frameTimeMillis = */ 0,
                /* progress = */ progress,
                /* triggerBack = */ mTriggerBack,
                /* swipeEdge = */ mSwipeEdge,
+2 −2
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc
            try {
                long frameTime = 0;
                if (predictiveBackTimestampApi()) {
                    frameTime = backEvent.getFrameTime();
                    frameTime = backEvent.getFrameTimeMillis();
                }
                mIOnBackInvokedCallback.onBackStarted(
                        new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), frameTime,
@@ -254,7 +254,7 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc
            try {
                long frameTime = 0;
                if (predictiveBackTimestampApi()) {
                    frameTime = backEvent.getFrameTime();
                    frameTime = backEvent.getFrameTimeMillis();
                }
                mIOnBackInvokedCallback.onBackProgressed(
                        new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), frameTime,
Loading