From 36977f68bd2cd158ca1c0014edea04cb684043ff Mon Sep 17 00:00:00 2001 From: Nick Chameyev Date: Thu, 24 Nov 2022 13:54:14 +0000 Subject: [PATCH] Start closing the device immediately in unfold transition test Test testFoldImmediatelyAfterUnfold_runsFoldAnimation should check that we continue animating the transition even if we started folding the device immediately after unfolding a foldable device. There was a race condition between finishing the animation and sending 'start closing' update, the test was failing when 'start closing' update arrived after finishing the transition because this will result into running a separate 'fold' transition and the test expects to have only one transition. Fixed by sending the closing event immediately, in the same stack frame, without extra delay. Fixes: 259839615 Test: atest SystemUITests:com.android.systemui.unfold.progress.PhysicsBasedUnfoldTransitionProgressProviderTest#testFoldImmediatelyAfterUnfold_runsFoldAnimation Change-Id: Id8ad81d6dfcef0802c4e0f8a66e5724cfc98de34 --- .../PhysicsBasedUnfoldTransitionProgressProviderTest.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/tests/src/com/android/systemui/unfold/progress/PhysicsBasedUnfoldTransitionProgressProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/unfold/progress/PhysicsBasedUnfoldTransitionProgressProviderTest.kt index 5509a6cac1ddc..03fd624a8c1de 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/unfold/progress/PhysicsBasedUnfoldTransitionProgressProviderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/unfold/progress/PhysicsBasedUnfoldTransitionProgressProviderTest.kt @@ -124,8 +124,11 @@ class PhysicsBasedUnfoldTransitionProgressProviderTest : SysuiTestCase() { { foldStateProvider.sendFoldUpdate(FOLD_UPDATE_UNFOLDED_SCREEN_AVAILABLE) }, { foldStateProvider.sendHingeAngleUpdate(10f) }, { foldStateProvider.sendHingeAngleUpdate(90f) }, - { foldStateProvider.sendFoldUpdate(FOLD_UPDATE_FINISH_FULL_OPEN) }, - { foldStateProvider.sendFoldUpdate(FOLD_UPDATE_START_CLOSING) }, + { + foldStateProvider.sendFoldUpdate(FOLD_UPDATE_FINISH_FULL_OPEN) + // Start closing immediately after we opened, before the animation ended + foldStateProvider.sendFoldUpdate(FOLD_UPDATE_START_CLOSING) + }, { foldStateProvider.sendHingeAngleUpdate(60f) }, { foldStateProvider.sendHingeAngleUpdate(10f) }, { foldStateProvider.sendFoldUpdate(FOLD_UPDATE_FINISH_CLOSED) },