Loading core/api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -63527,8 +63527,8 @@ 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 getFrameTimeMillis(); ctor public BackEvent(float, float, float, int, long); method public long getFrameTimeMillis(); method @FloatRange(from=0, to=1) public float getProgress(); method public int getSwipeEdge(); method public float getTouchX(); core/java/android/window/BackEvent.java +3 −14 Original line number Diff line number Diff line Loading @@ -16,10 +16,6 @@ package android.window; import static com.android.window.flags.Flags.FLAG_PREDICTIVE_BACK_TIMESTAMP_API; import static com.android.window.flags.Flags.predictiveBackTimestampApi; import android.annotation.FlaggedApi; import android.annotation.FloatRange; import android.annotation.IntDef; Loading Loading @@ -62,14 +58,9 @@ public final class BackEvent { /** @hide */ public static BackEvent fromBackMotionEvent(BackMotionEvent backMotionEvent) { if (predictiveBackTimestampApi()) { return new BackEvent(backMotionEvent.getTouchX(), backMotionEvent.getTouchY(), backMotionEvent.getProgress(), backMotionEvent.getSwipeEdge(), backMotionEvent.getFrameTimeMillis()); } else { return new BackEvent(backMotionEvent.getTouchX(), backMotionEvent.getTouchY(), backMotionEvent.getProgress(), backMotionEvent.getSwipeEdge()); } } /** Loading Loading @@ -97,7 +88,6 @@ public final class BackEvent { * @param swipeEdge Indicates which edge the swipe starts from. * @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 frameTimeMillis) { mTouchX = touchX; Loading Loading @@ -156,7 +146,6 @@ public final class BackEvent { /** * Returns the frameTime of the BackEvent in milliseconds. Useful for calculating velocity. */ @FlaggedApi(FLAG_PREDICTIVE_BACK_TIMESTAMP_API) public long getFrameTimeMillis() { return mFrameTimeMillis; } Loading core/java/android/window/BackProgressAnimator.java +3 −71 Original line number Diff line number Diff line Loading @@ -19,18 +19,14 @@ package android.window; import static android.window.BackEvent.EDGE_NONE; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.window.flags.Flags.predictiveBackTimestampApi; import android.annotation.NonNull; import android.annotation.Nullable; import android.util.FloatProperty; import android.util.TimeUtils; import android.view.Choreographer; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.dynamicanimation.animation.DynamicAnimation; import com.android.internal.dynamicanimation.animation.FlingAnimation; import com.android.internal.dynamicanimation.animation.FloatValueHolder; import com.android.internal.dynamicanimation.animation.SpringAnimation; import com.android.internal.dynamicanimation.animation.SpringForce; Loading @@ -50,7 +46,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL * always receive progress values in [0, 1]. */ private static final float SCALE_FACTOR = 100f; private static final float FLING_FRICTION = 8f; private static final float BUTTON_SPRING_STIFFNESS = 100; private final SpringAnimation mSpring; private ProgressCallback mCallback; Loading @@ -62,9 +57,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL private boolean mBackAnimationInProgress = false; @Nullable private Runnable mBackCancelledFinishRunnable; @Nullable private Runnable mBackInvokedFinishRunnable; private FlingAnimation mBackInvokedFlingAnim; private final SpringForce mGestureSpringForce = new SpringForce() .setStiffness(SpringForce.STIFFNESS_MEDIUM) .setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY); Loading @@ -73,13 +65,8 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL private final DynamicAnimation.OnAnimationEndListener mOnAnimationEndListener = (animation, canceled, value, velocity) -> { if (mBackCancelledFinishRunnable != null) invokeBackCancelledRunnable(); if (mBackInvokedFinishRunnable != null) invokeBackInvokedRunnable(); reset(); }; private final DynamicAnimation.OnAnimationUpdateListener mOnBackInvokedFlingUpdateListener = (animation, progress, velocity) -> updateProgressValue(progress, velocity, animation.getLastFrameTime()); private void setProgress(float progress) { mProgress = progress; Loading @@ -104,10 +91,8 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL @Override public void onAnimationUpdate(DynamicAnimation animation, float value, float velocity) { if (mBackInvokedFinishRunnable == null) { updateProgressValue(value, velocity, animation.getLastFrameTime()); } } /** A callback to be invoked when there's a progress value update from the animator. */ Loading Loading @@ -187,12 +172,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL updateProgressValue(/* progress */ 0, /* velocity */ 0, /* frameTime */ System.nanoTime() / TimeUtils.NANOS_PER_MS); invokeBackCancelledRunnable(); } else if (mBackInvokedFinishRunnable != null) { invokeBackInvokedRunnable(); } if (mBackInvokedFlingAnim != null) { mBackInvokedFlingAnim.cancel(); mBackInvokedFlingAnim = null; } mSpring.animateToFinalPosition(0); if (mSpring.canSkipToEnd()) { Loading @@ -208,30 +187,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL mProgress = 0; } /** * Animate the back progress animation a bit further with a high friction considering the * current progress and velocity. * * @param finishCallback the callback to be invoked when the final destination is reached */ public void onBackInvoked(@NonNull Runnable finishCallback) { mBackInvokedFinishRunnable = finishCallback; mSpring.animateToFinalPosition(0); mBackInvokedFlingAnim = new FlingAnimation(new FloatValueHolder()) .setStartValue(mProgress) .setFriction(FLING_FRICTION) .setStartVelocity(mVelocity) .setMinValue(0) .setMaxValue(SCALE_FACTOR); mBackInvokedFlingAnim.addUpdateListener(mOnBackInvokedFlingUpdateListener); mBackInvokedFlingAnim.addEndListener(mOnAnimationEndListener); mBackInvokedFlingAnim.start(); // do an animation-frame immediately to prevent idle frame mBackInvokedFlingAnim.doAnimationFrame( Choreographer.getInstance().getLastFrameTimeNanos() / TimeUtils.NANOS_PER_MS); } /** * Animate the back progress animation from current progress to start position. * This should be called when back is cancelled. Loading @@ -253,17 +208,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL mBackCancelledFinishRunnable = null; } /** * Removes the finishCallback passed into {@link #onBackCancelled} */ public void removeOnBackInvokedFinishCallback() { if (mBackInvokedFlingAnim != null) { mBackInvokedFlingAnim.removeUpdateListener(mOnBackInvokedFlingUpdateListener); mBackInvokedFlingAnim.removeEndListener(mOnAnimationEndListener); } mBackInvokedFinishRunnable = null; } /** Returns true if the back animation is in progress. */ @VisibleForTesting(visibility = PACKAGE) public boolean isBackAnimationInProgress() { Loading Loading @@ -293,13 +237,8 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL return; } BackEvent backEvent; if (predictiveBackTimestampApi()) { backEvent = new BackEvent(mLastBackEvent.getTouchX(), mLastBackEvent.getTouchY(), progress / SCALE_FACTOR, mLastBackEvent.getSwipeEdge(), frameTime); } else { backEvent = new BackEvent(mLastBackEvent.getTouchX(), mLastBackEvent.getTouchY(), progress / SCALE_FACTOR, mLastBackEvent.getSwipeEdge()); } mCallback.onProgressUpdate(backEvent); } Loading @@ -309,11 +248,4 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL mBackCancelledFinishRunnable = null; } private void invokeBackInvokedRunnable() { mBackInvokedFlingAnim.removeUpdateListener(mOnBackInvokedFlingUpdateListener); mBackInvokedFlingAnim.removeEndListener(mOnAnimationEndListener); mBackInvokedFinishRunnable.run(); mBackInvokedFinishRunnable = null; } } No newline at end of file core/java/android/window/ImeOnBackInvokedDispatcher.java +6 −13 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.window; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.window.flags.Flags.predictiveBackTimestampApi; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -295,13 +294,10 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc @Override public void onBackStarted(@NonNull BackEvent backEvent) { try { long frameTime = 0; if (predictiveBackTimestampApi()) { frameTime = backEvent.getFrameTimeMillis(); } mIOnBackInvokedCallback.onBackStarted( new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), frameTime, backEvent.getProgress(), false, backEvent.getSwipeEdge())); new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), backEvent.getFrameTimeMillis(), backEvent.getProgress(), false, backEvent.getSwipeEdge())); } catch (RemoteException e) { Log.e(TAG, "Exception when invoking forwarded callback. e: ", e); } Loading @@ -310,13 +306,10 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc @Override public void onBackProgressed(@NonNull BackEvent backEvent) { try { long frameTime = 0; if (predictiveBackTimestampApi()) { frameTime = backEvent.getFrameTimeMillis(); } mIOnBackInvokedCallback.onBackProgressed( new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), frameTime, backEvent.getProgress(), false, backEvent.getSwipeEdge())); new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), backEvent.getFrameTimeMillis(), backEvent.getProgress(), false, backEvent.getSwipeEdge())); } catch (RemoteException e) { Log.e(TAG, "Exception when invoking forwarded callback. e: ", e); } Loading core/java/android/window/WindowOnBackInvokedDispatcher.java +4 −19 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static android.window.SystemOverrideOnBackInvokedCallback.OVERRIDE_UNDEFI import static com.android.window.flags.Flags.multipleSystemNavigationObserverCallbacks; import static com.android.window.flags.Flags.predictiveBackCallbackCancellationFix; import static com.android.window.flags.Flags.predictiveBackSystemOverrideCallback; import static com.android.window.flags.Flags.predictiveBackTimestampApi; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -322,7 +321,6 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // We should call onBackCancelled() when an active callback is removed from the // dispatcher. mProgressAnimator.removeOnBackCancelledFinishCallback(); mProgressAnimator.removeOnBackInvokedFinishCallback(); sendCancelledIfInProgress(callback); mHandler.post(mProgressAnimator::reset); } Loading @@ -333,7 +331,6 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // We should call onBackCancelled() when an active callback is removed from the // dispatcher. mProgressAnimator.removeOnBackCancelledFinishCallback(); mProgressAnimator.removeOnBackInvokedFinishCallback(); sendCancelledIfInProgress(callback); mHandler.post(mProgressAnimator::reset); } Loading Loading @@ -666,23 +663,11 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { Log.w(TAG, "ProgressAnimator was not in progress, skip onBackInvoked()."); return; } OnBackAnimationCallback animationCallback = getBackAnimationCallback(); if (animationCallback != null && !(callback instanceof ImeBackAnimationController) && !predictiveBackTimestampApi()) { mProgressAnimator.onBackInvoked(() -> { if (mIsSystemCallback) { mSystemNavigationObserverCallbackRunnable.run(); } callback.onBackInvoked(); }); } else { mProgressAnimator.reset(); if (mIsSystemCallback) { mSystemNavigationObserverCallbackRunnable.run(); } callback.onBackInvoked(); } }); } Loading Loading
core/api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -63527,8 +63527,8 @@ 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 getFrameTimeMillis(); ctor public BackEvent(float, float, float, int, long); method public long getFrameTimeMillis(); method @FloatRange(from=0, to=1) public float getProgress(); method public int getSwipeEdge(); method public float getTouchX();
core/java/android/window/BackEvent.java +3 −14 Original line number Diff line number Diff line Loading @@ -16,10 +16,6 @@ package android.window; import static com.android.window.flags.Flags.FLAG_PREDICTIVE_BACK_TIMESTAMP_API; import static com.android.window.flags.Flags.predictiveBackTimestampApi; import android.annotation.FlaggedApi; import android.annotation.FloatRange; import android.annotation.IntDef; Loading Loading @@ -62,14 +58,9 @@ public final class BackEvent { /** @hide */ public static BackEvent fromBackMotionEvent(BackMotionEvent backMotionEvent) { if (predictiveBackTimestampApi()) { return new BackEvent(backMotionEvent.getTouchX(), backMotionEvent.getTouchY(), backMotionEvent.getProgress(), backMotionEvent.getSwipeEdge(), backMotionEvent.getFrameTimeMillis()); } else { return new BackEvent(backMotionEvent.getTouchX(), backMotionEvent.getTouchY(), backMotionEvent.getProgress(), backMotionEvent.getSwipeEdge()); } } /** Loading Loading @@ -97,7 +88,6 @@ public final class BackEvent { * @param swipeEdge Indicates which edge the swipe starts from. * @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 frameTimeMillis) { mTouchX = touchX; Loading Loading @@ -156,7 +146,6 @@ public final class BackEvent { /** * Returns the frameTime of the BackEvent in milliseconds. Useful for calculating velocity. */ @FlaggedApi(FLAG_PREDICTIVE_BACK_TIMESTAMP_API) public long getFrameTimeMillis() { return mFrameTimeMillis; } Loading
core/java/android/window/BackProgressAnimator.java +3 −71 Original line number Diff line number Diff line Loading @@ -19,18 +19,14 @@ package android.window; import static android.window.BackEvent.EDGE_NONE; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.window.flags.Flags.predictiveBackTimestampApi; import android.annotation.NonNull; import android.annotation.Nullable; import android.util.FloatProperty; import android.util.TimeUtils; import android.view.Choreographer; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.dynamicanimation.animation.DynamicAnimation; import com.android.internal.dynamicanimation.animation.FlingAnimation; import com.android.internal.dynamicanimation.animation.FloatValueHolder; import com.android.internal.dynamicanimation.animation.SpringAnimation; import com.android.internal.dynamicanimation.animation.SpringForce; Loading @@ -50,7 +46,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL * always receive progress values in [0, 1]. */ private static final float SCALE_FACTOR = 100f; private static final float FLING_FRICTION = 8f; private static final float BUTTON_SPRING_STIFFNESS = 100; private final SpringAnimation mSpring; private ProgressCallback mCallback; Loading @@ -62,9 +57,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL private boolean mBackAnimationInProgress = false; @Nullable private Runnable mBackCancelledFinishRunnable; @Nullable private Runnable mBackInvokedFinishRunnable; private FlingAnimation mBackInvokedFlingAnim; private final SpringForce mGestureSpringForce = new SpringForce() .setStiffness(SpringForce.STIFFNESS_MEDIUM) .setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY); Loading @@ -73,13 +65,8 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL private final DynamicAnimation.OnAnimationEndListener mOnAnimationEndListener = (animation, canceled, value, velocity) -> { if (mBackCancelledFinishRunnable != null) invokeBackCancelledRunnable(); if (mBackInvokedFinishRunnable != null) invokeBackInvokedRunnable(); reset(); }; private final DynamicAnimation.OnAnimationUpdateListener mOnBackInvokedFlingUpdateListener = (animation, progress, velocity) -> updateProgressValue(progress, velocity, animation.getLastFrameTime()); private void setProgress(float progress) { mProgress = progress; Loading @@ -104,10 +91,8 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL @Override public void onAnimationUpdate(DynamicAnimation animation, float value, float velocity) { if (mBackInvokedFinishRunnable == null) { updateProgressValue(value, velocity, animation.getLastFrameTime()); } } /** A callback to be invoked when there's a progress value update from the animator. */ Loading Loading @@ -187,12 +172,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL updateProgressValue(/* progress */ 0, /* velocity */ 0, /* frameTime */ System.nanoTime() / TimeUtils.NANOS_PER_MS); invokeBackCancelledRunnable(); } else if (mBackInvokedFinishRunnable != null) { invokeBackInvokedRunnable(); } if (mBackInvokedFlingAnim != null) { mBackInvokedFlingAnim.cancel(); mBackInvokedFlingAnim = null; } mSpring.animateToFinalPosition(0); if (mSpring.canSkipToEnd()) { Loading @@ -208,30 +187,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL mProgress = 0; } /** * Animate the back progress animation a bit further with a high friction considering the * current progress and velocity. * * @param finishCallback the callback to be invoked when the final destination is reached */ public void onBackInvoked(@NonNull Runnable finishCallback) { mBackInvokedFinishRunnable = finishCallback; mSpring.animateToFinalPosition(0); mBackInvokedFlingAnim = new FlingAnimation(new FloatValueHolder()) .setStartValue(mProgress) .setFriction(FLING_FRICTION) .setStartVelocity(mVelocity) .setMinValue(0) .setMaxValue(SCALE_FACTOR); mBackInvokedFlingAnim.addUpdateListener(mOnBackInvokedFlingUpdateListener); mBackInvokedFlingAnim.addEndListener(mOnAnimationEndListener); mBackInvokedFlingAnim.start(); // do an animation-frame immediately to prevent idle frame mBackInvokedFlingAnim.doAnimationFrame( Choreographer.getInstance().getLastFrameTimeNanos() / TimeUtils.NANOS_PER_MS); } /** * Animate the back progress animation from current progress to start position. * This should be called when back is cancelled. Loading @@ -253,17 +208,6 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL mBackCancelledFinishRunnable = null; } /** * Removes the finishCallback passed into {@link #onBackCancelled} */ public void removeOnBackInvokedFinishCallback() { if (mBackInvokedFlingAnim != null) { mBackInvokedFlingAnim.removeUpdateListener(mOnBackInvokedFlingUpdateListener); mBackInvokedFlingAnim.removeEndListener(mOnAnimationEndListener); } mBackInvokedFinishRunnable = null; } /** Returns true if the back animation is in progress. */ @VisibleForTesting(visibility = PACKAGE) public boolean isBackAnimationInProgress() { Loading Loading @@ -293,13 +237,8 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL return; } BackEvent backEvent; if (predictiveBackTimestampApi()) { backEvent = new BackEvent(mLastBackEvent.getTouchX(), mLastBackEvent.getTouchY(), progress / SCALE_FACTOR, mLastBackEvent.getSwipeEdge(), frameTime); } else { backEvent = new BackEvent(mLastBackEvent.getTouchX(), mLastBackEvent.getTouchY(), progress / SCALE_FACTOR, mLastBackEvent.getSwipeEdge()); } mCallback.onProgressUpdate(backEvent); } Loading @@ -309,11 +248,4 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL mBackCancelledFinishRunnable = null; } private void invokeBackInvokedRunnable() { mBackInvokedFlingAnim.removeUpdateListener(mOnBackInvokedFlingUpdateListener); mBackInvokedFlingAnim.removeEndListener(mOnAnimationEndListener); mBackInvokedFinishRunnable.run(); mBackInvokedFinishRunnable = null; } } No newline at end of file
core/java/android/window/ImeOnBackInvokedDispatcher.java +6 −13 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.window; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.window.flags.Flags.predictiveBackTimestampApi; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -295,13 +294,10 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc @Override public void onBackStarted(@NonNull BackEvent backEvent) { try { long frameTime = 0; if (predictiveBackTimestampApi()) { frameTime = backEvent.getFrameTimeMillis(); } mIOnBackInvokedCallback.onBackStarted( new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), frameTime, backEvent.getProgress(), false, backEvent.getSwipeEdge())); new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), backEvent.getFrameTimeMillis(), backEvent.getProgress(), false, backEvent.getSwipeEdge())); } catch (RemoteException e) { Log.e(TAG, "Exception when invoking forwarded callback. e: ", e); } Loading @@ -310,13 +306,10 @@ public class ImeOnBackInvokedDispatcher implements OnBackInvokedDispatcher, Parc @Override public void onBackProgressed(@NonNull BackEvent backEvent) { try { long frameTime = 0; if (predictiveBackTimestampApi()) { frameTime = backEvent.getFrameTimeMillis(); } mIOnBackInvokedCallback.onBackProgressed( new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), frameTime, backEvent.getProgress(), false, backEvent.getSwipeEdge())); new BackMotionEvent(backEvent.getTouchX(), backEvent.getTouchY(), backEvent.getFrameTimeMillis(), backEvent.getProgress(), false, backEvent.getSwipeEdge())); } catch (RemoteException e) { Log.e(TAG, "Exception when invoking forwarded callback. e: ", e); } Loading
core/java/android/window/WindowOnBackInvokedDispatcher.java +4 −19 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static android.window.SystemOverrideOnBackInvokedCallback.OVERRIDE_UNDEFI import static com.android.window.flags.Flags.multipleSystemNavigationObserverCallbacks; import static com.android.window.flags.Flags.predictiveBackCallbackCancellationFix; import static com.android.window.flags.Flags.predictiveBackSystemOverrideCallback; import static com.android.window.flags.Flags.predictiveBackTimestampApi; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -322,7 +321,6 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // We should call onBackCancelled() when an active callback is removed from the // dispatcher. mProgressAnimator.removeOnBackCancelledFinishCallback(); mProgressAnimator.removeOnBackInvokedFinishCallback(); sendCancelledIfInProgress(callback); mHandler.post(mProgressAnimator::reset); } Loading @@ -333,7 +331,6 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // We should call onBackCancelled() when an active callback is removed from the // dispatcher. mProgressAnimator.removeOnBackCancelledFinishCallback(); mProgressAnimator.removeOnBackInvokedFinishCallback(); sendCancelledIfInProgress(callback); mHandler.post(mProgressAnimator::reset); } Loading Loading @@ -666,23 +663,11 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { Log.w(TAG, "ProgressAnimator was not in progress, skip onBackInvoked()."); return; } OnBackAnimationCallback animationCallback = getBackAnimationCallback(); if (animationCallback != null && !(callback instanceof ImeBackAnimationController) && !predictiveBackTimestampApi()) { mProgressAnimator.onBackInvoked(() -> { if (mIsSystemCallback) { mSystemNavigationObserverCallbackRunnable.run(); } callback.onBackInvoked(); }); } else { mProgressAnimator.reset(); if (mIsSystemCallback) { mSystemNavigationObserverCallbackRunnable.run(); } callback.onBackInvoked(); } }); } Loading