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 */