diff options
| author | 2024-10-23 11:54:11 +0000 | |
|---|---|---|
| committer | 2024-10-23 11:54:11 +0000 | |
| commit | dded1a46a0e8f3c6237cd3f3ec97473a6abd8985 (patch) | |
| tree | 92b34ea9e579bd34f2625b5916b106988fdf0ce9 | |
| parent | 261ca128472940b1f9ea43749671e8920ff03bab (diff) | |
| parent | 11420c435fafd98884af3e47007b453206e68589 (diff) | |
Merge "Add millis suffix to BackEvent#getFrameTime API" into main
8 files changed, 31 insertions, 31 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 9298ca247659..73b35b211f25 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -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(); diff --git a/core/java/android/window/BackEvent.java b/core/java/android/window/BackEvent.java index 90fac361c966..1b9235b21369 100644 --- a/core/java/android/window/BackEvent.java +++ b/core/java/android/window/BackEvent.java @@ -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 + "}"; } } diff --git a/core/java/android/window/BackMotionEvent.java b/core/java/android/window/BackMotionEvent.java index a8ec4eeb039a..cc2afbc6aaa3 100644 --- a/core/java/android/window/BackMotionEvent.java +++ b/core/java/android/window/BackMotionEvent.java @@ -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 diff --git a/core/java/android/window/BackTouchTracker.java b/core/java/android/window/BackTouchTracker.java index 39a30253adbd..4908068d51e4 100644 --- a/core/java/android/window/BackTouchTracker.java +++ b/core/java/android/window/BackTouchTracker.java @@ -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, diff --git a/core/java/android/window/ImeOnBackInvokedDispatcher.java b/core/java/android/window/ImeOnBackInvokedDispatcher.java index 8db1f9509757..bd01899a649b 100644 --- a/core/java/android/window/ImeOnBackInvokedDispatcher.java +++ b/core/java/android/window/ImeOnBackInvokedDispatcher.java @@ -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, diff --git a/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java b/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java index 46bd73e316f6..4d6c30ebbe2b 100644 --- a/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java +++ b/core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java @@ -686,7 +686,7 @@ public class WindowOnBackInvokedDispatcherTest { return new BackMotionEvent( /* touchX = */ 0, /* touchY = */ 0, - /* frameTime = */ 0, + /* frameTimeMillis = */ 0, /* progress = */ progress, /* triggerBack = */ false, /* swipeEdge = */ BackEvent.EDGE_LEFT, diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossTaskBackAnimation.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossTaskBackAnimation.java index 52391d2f5a79..dc50fdbd1af3 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossTaskBackAnimation.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossTaskBackAnimation.java @@ -333,7 +333,7 @@ public class CrossTaskBackAnimation extends ShellBackAnimation { private void onGestureProgress(@NonNull BackEvent backEvent) { if (!mBackInProgress) { mBackInProgress = true; - mDownTime = backEvent.getFrameTime(); + mDownTime = backEvent.getFrameTimeMillis(); } float progress = backEvent.getProgress(); mTouchPos.set(backEvent.getTouchX(), backEvent.getTouchY()); @@ -342,7 +342,7 @@ public class CrossTaskBackAnimation extends ShellBackAnimation { mVelocityTracker.addMovement( MotionEvent.obtain( /* downTime */ mDownTime, - /* eventTime */ backEvent.getFrameTime(), + /* eventTime */ backEvent.getFrameTimeMillis(), /* action */ ACTION_MOVE, /* x */ interpolatedProgress * SPRING_SCALE, /* y */ 0f, diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/back/FlingOnBackAnimationCallback.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/back/FlingOnBackAnimationCallback.kt index 6da06d0711d8..cd2dd04568a7 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/back/FlingOnBackAnimationCallback.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/back/FlingOnBackAnimationCallback.kt @@ -60,7 +60,7 @@ abstract class FlingOnBackAnimationCallback( it.touchY, progress / SCALE_FACTOR, it.swipeEdge, - it.frameTime, + it.frameTimeMillis, ) onBackProgressedCompat(backEvent) } @@ -87,7 +87,7 @@ abstract class FlingOnBackAnimationCallback( } reset() if (predictiveBackTimestampApi()) { - downTime = backEvent.frameTime + downTime = backEvent.frameTimeMillis } onBackStartedCompat(backEvent) } @@ -98,7 +98,7 @@ abstract class FlingOnBackAnimationCallback( velocityTracker.addMovement( MotionEvent.obtain( /* downTime */ downTime!!, - /* eventTime */ backEvent.frameTime, + /* eventTime */ backEvent.frameTimeMillis, /* action */ ACTION_MOVE, /* x */ interpolatedProgress * SCALE_FACTOR, /* y */ 0f, @@ -111,7 +111,7 @@ abstract class FlingOnBackAnimationCallback( backEvent.touchY, interpolatedProgress, backEvent.swipeEdge, - backEvent.frameTime, + backEvent.frameTimeMillis, ) } else { lastBackEvent = |