From e2307d9a48180a0001a0e2b51777fc151a698cd4 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Wed, 30 Sep 2020 14:21:52 -0700 Subject: Handle cancelled Insets animation If an Insets animation was cancelled before it could complete, handle it gracefully. Fix: 154381667 Test: Run monkey runner that on any window that has edit text atest InsetsControllerTests Change-Id: I052a0455f536a1c839a2782e54f19143295ba6c6 --- core/java/android/view/InsetsAnimationThreadControlRunner.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/java/android/view/InsetsAnimationThreadControlRunner.java') diff --git a/core/java/android/view/InsetsAnimationThreadControlRunner.java b/core/java/android/view/InsetsAnimationThreadControlRunner.java index 123604489da4..09e4557135b5 100644 --- a/core/java/android/view/InsetsAnimationThreadControlRunner.java +++ b/core/java/android/view/InsetsAnimationThreadControlRunner.java @@ -108,6 +108,9 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro mControl = new InsetsAnimationControlImpl(controls, frame, state, listener, types, mCallbacks, durationMs, interpolator, animationType); InsetsAnimationThread.getHandler().post(() -> { + if (mControl.isCancelled()) { + return; + } Trace.asyncTraceBegin(Trace.TRACE_TAG_VIEW, "InsetsAsyncAnimation: " + WindowInsets.Type.toString(types), types); listener.onReady(mControl, types); -- cgit v1.2.3