From 0f5f5b4fc9dd48d3661482b8e5376f2e4a473ea2 Mon Sep 17 00:00:00 2001 From: Schneider Victor-Tulias Date: Wed, 7 May 2025 15:12:28 -0400 Subject: [PATCH] Fix missing tapl key events in TaplTestsQuickstep Because we were closing the recents window too quickly, the final ACTION_UP was never getting received. This change also cleans up the exit flow with the correct animation. Also posting touchModeChanged in OverviewCommandHelper to better support recents window, since the recents window may not be attached to window yet Flag: com.android.launcher3.enable_launcher_overview_in_window Bug: 377678992 Test: TaplTestsQuickstep.testDismissOverviewWithEscKey, TaplTestsQuickstep.testDismissModalTaskAndOverviewWithEscKey, TaplTestsQuickstep.testOpenOverviewWithActionPlusTabKeys Change-Id: I89e6c5716c0399857722114a243ed23c20a5c43d --- .../src/com/android/quickstep/OverviewCommandHelper.kt | 8 +++++--- .../quickstep/fallback/window/RecentsWindowManager.kt | 9 ++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt index 0deea0485f..4e9da7d825 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt @@ -24,7 +24,6 @@ import android.os.Trace import android.util.Log import android.view.Display.DEFAULT_DISPLAY import android.view.View -import android.window.DesktopExperienceFlags import android.window.TransitionInfo import androidx.annotation.BinderThread import androidx.annotation.UiThread @@ -589,14 +588,17 @@ constructor( ) { return } - // When the overview is launched via alt tab (command type is TYPE_KEYBOARD_INPUT), // the touch mode somehow is not change to false by the Android framework. // The subsequent tab to go through tasks in overview can only be dispatched to // focuses views, while focus can only be requested in // {@link View#requestFocusNoSearch(int, Rect)} when touch mode is false. To note, // here we launch overview with live tile. - recentsView.viewRootImpl.touchModeChanged(false) + if (recentsView.isAttachedToWindow) { + recentsView.viewRootImpl.touchModeChanged(false) + } else { + recentsView.post { recentsView.viewRootImpl.touchModeChanged(false) } + } // Ensure that recents view has focus so that it receives the followup key inputs // Stops requesting focused after first view gets focused. recentsView diff --git a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt index 99348c6c3d..5e4725aa1d 100644 --- a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt +++ b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt @@ -38,7 +38,6 @@ import com.android.launcher3.AbstractFloatingView import com.android.launcher3.BaseActivity import com.android.launcher3.LauncherAnimationRunner import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory -import com.android.launcher3.LauncherState.NORMAL import com.android.launcher3.R import com.android.launcher3.compat.AccessibilityManagerCompat import com.android.launcher3.dagger.LauncherAppSingleton @@ -75,9 +74,9 @@ import com.android.quickstep.fallback.RecentsState import com.android.quickstep.fallback.RecentsState.BACKGROUND_APP import com.android.quickstep.fallback.RecentsState.BG_LAUNCHER import com.android.quickstep.fallback.RecentsState.DEFAULT +import com.android.quickstep.fallback.RecentsState.HOME import com.android.quickstep.fallback.RecentsState.MODAL_TASK import com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT -import com.android.quickstep.fallback.toLauncherState import com.android.quickstep.fallback.toLauncherStateOrdinal import com.android.quickstep.util.RecentsAtomicAnimationFactory import com.android.quickstep.util.RecentsWindowProtoLogProxy @@ -398,7 +397,7 @@ constructor( override fun onStateSetEnd(state: RecentsState) { super.onStateSetEnd(state) RecentsWindowProtoLogProxy.logOnStateSetEnd(state.toString()) - if (state.toLauncherState() == NORMAL) { + if (!state.isRecentsViewVisible) { cleanupRecentsWindow() } AccessibilityManagerCompat.sendStateEventToTest(baseContext, state.toLauncherStateOrdinal()) @@ -445,7 +444,7 @@ constructor( stateManager.goToState(DEFAULT, true) true } else if (isInState(DEFAULT)) { - returnToHomescreen() + stateManager.goToState(HOME, true) true } else { super.onRootViewDispatchKeyEvent(event) @@ -465,7 +464,7 @@ constructor( } override fun isStarted(): Boolean { - return isShowing() && isInState(DEFAULT) + return isShowing() && stateManager.state.isRecentsViewVisible } /** Adds a callback for the provided activity event */