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
This commit is contained in:
Schneider Victor-Tulias
2025-05-07 15:12:28 -04:00
parent b6a3b5d624
commit 0f5f5b4fc9
2 changed files with 9 additions and 8 deletions
@@ -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
@@ -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<RecentsWindowContext>.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 */