From 8bbfc2b6678860dcbc5f3b023b5a7334dfbf8103 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Sat, 9 Sep 2023 16:44:18 +0000 Subject: [PATCH] Reset the frozen recents list state when switching to button navigation - A quickswitch will freeze the spatial order of the recents list (to allow quickswitching back), but if a nav mode change happens immediately after, then the recents list will continue to be frozen leaving the list in the wrong order (which can cause a flake or failure) Bug: 298544839 Test: atest NexusLauncherTests:com.android.quickstep.TaplTestsQuickstep Change-Id: Iabac305ea12cf4a2eb704802a315b6feba49f88a --- .../quickstep/NavigationModeSwitchRule.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java index eded1c961f..275200393c 100644 --- a/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java +++ b/quickstep/tests/src/com/android/quickstep/NavigationModeSwitchRule.java @@ -26,7 +26,10 @@ import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_ import android.content.Context; import android.content.pm.PackageManager; +import android.graphics.Point; +import android.os.SystemClock; import android.util.Log; +import android.view.MotionEvent; import androidx.test.uiautomator.UiDevice; @@ -115,6 +118,18 @@ public class NavigationModeSwitchRule implements TestRule { private void evaluateWithThreeButtons() throws Throwable { if (setActiveOverlay(mLauncher, NAV_BAR_MODE_3BUTTON_OVERLAY, LauncherInstrumentation.NavigationModel.THREE_BUTTON, description)) { + // After switching to three button, ensure that we interact with the screen + // within the app area to reset the frozen recents state (if a quickswitch + // was just performed), otherwise the list may be in the wrong order + // spatially when executing the next test + final Point center = new Point(mLauncher.getDevice().getDisplayWidth() / 2, + mLauncher.getDevice().getDisplayHeight() / 2); + final long clickTime = SystemClock.uptimeMillis(); + mLauncher.sendPointer(clickTime, clickTime, MotionEvent.ACTION_DOWN, center, + LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER); + mLauncher.sendPointer(clickTime, clickTime, MotionEvent.ACTION_UP, center, + LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER); + base.evaluate(); } }