Loading core/java/android/window/BackProgressAnimator.java +5 −1 Original line number Diff line number Diff line Loading @@ -16,12 +16,15 @@ package android.window; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; 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; Loading Loading @@ -210,7 +213,8 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL } /** Returns true if the back animation is in progress. */ boolean isBackAnimationInProgress() { @VisibleForTesting(visibility = PACKAGE) public boolean isBackAnimationInProgress() { return mBackAnimationInProgress; } Loading core/java/android/window/WindowOnBackInvokedDispatcher.java +1 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,7 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // We should call onBackCancelled() when an active callback is removed from // dispatcher. sendCancelledIfInProgress(callback); mHandler.post(mProgressAnimator::reset); setTopOnBackInvokedCallback(getTopCallback()); } } Loading core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -348,12 +348,16 @@ public class WindowOnBackInvokedDispatcherTest { waitForIdle(); verify(mCallback1).onBackStarted(any(BackEvent.class)); assertTrue(mDispatcher.mProgressAnimator.isBackAnimationInProgress()); mDispatcher.unregisterOnBackInvokedCallback(mCallback1); waitForIdle(); verify(mCallback1).onBackCancelled(); verify(mWindowSession).setOnBackInvokedCallbackInfo(Mockito.eq(mWindow), isNull()); // Verify that ProgressAnimator is reset (and thus does not cause further callback event // dispatching) assertFalse(mDispatcher.mProgressAnimator.isBackAnimationInProgress()); } @Test Loading Loading
core/java/android/window/BackProgressAnimator.java +5 −1 Original line number Diff line number Diff line Loading @@ -16,12 +16,15 @@ package android.window; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; 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; Loading Loading @@ -210,7 +213,8 @@ public class BackProgressAnimator implements DynamicAnimation.OnAnimationUpdateL } /** Returns true if the back animation is in progress. */ boolean isBackAnimationInProgress() { @VisibleForTesting(visibility = PACKAGE) public boolean isBackAnimationInProgress() { return mBackAnimationInProgress; } Loading
core/java/android/window/WindowOnBackInvokedDispatcher.java +1 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,7 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { // We should call onBackCancelled() when an active callback is removed from // dispatcher. sendCancelledIfInProgress(callback); mHandler.post(mProgressAnimator::reset); setTopOnBackInvokedCallback(getTopCallback()); } } Loading
core/tests/coretests/src/android/window/WindowOnBackInvokedDispatcherTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -348,12 +348,16 @@ public class WindowOnBackInvokedDispatcherTest { waitForIdle(); verify(mCallback1).onBackStarted(any(BackEvent.class)); assertTrue(mDispatcher.mProgressAnimator.isBackAnimationInProgress()); mDispatcher.unregisterOnBackInvokedCallback(mCallback1); waitForIdle(); verify(mCallback1).onBackCancelled(); verify(mWindowSession).setOnBackInvokedCallbackInfo(Mockito.eq(mWindow), isNull()); // Verify that ProgressAnimator is reset (and thus does not cause further callback event // dispatching) assertFalse(mDispatcher.mProgressAnimator.isBackAnimationInProgress()); } @Test Loading