Moving RecentsWindowManager away from taskstackchangelistener
Test: Built and ran locally, tested against various cases, verified with
logs
Flag: com.android.launcher3.enable_fallback_overview_in_window
com.android.launcher3.enable_launcher_overview_in_window
Bug: 292269949
Change-Id: If90b1f98ad18286fa0c9b9625077237823197967
This commit is contained in:
@@ -865,10 +865,11 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
|
||||
if (overviewCommandHelper != null) {
|
||||
overviewCommandHelper.clearPendingCommands();
|
||||
}
|
||||
|
||||
PerDisplayRepository<RecentsWindowManager> recentsWindowManagerRepository =
|
||||
RecentsWindowManager.REPOSITORY_INSTANCE.get(this);
|
||||
recentsWindowManagerRepository.forEach(/* createIfAbsent= */ true, recentsWindowManager -> {
|
||||
recentsWindowManager.onNewIntent();
|
||||
recentsWindowManager.cleanupRecentsWindow();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ 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
|
||||
import com.android.launcher3.LauncherState.NORMAL
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat
|
||||
import com.android.launcher3.dagger.DisplayContext
|
||||
@@ -59,6 +59,7 @@ import com.android.launcher3.util.SystemUiController
|
||||
import com.android.launcher3.util.WallpaperColorHints
|
||||
import com.android.launcher3.views.BaseDragLayer
|
||||
import com.android.launcher3.views.ScrimView
|
||||
import com.android.quickstep.HomeVisibilityState
|
||||
import com.android.quickstep.OverviewComponentObserver
|
||||
import com.android.quickstep.RecentsAnimationCallbacks
|
||||
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener
|
||||
@@ -194,10 +195,11 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
|
||||
TestLogging.recordEvent(SEQUENCE_MAIN, "onBackInvoked")
|
||||
}
|
||||
|
||||
private val taskStackChangeListener =
|
||||
object : TaskStackChangeListener {
|
||||
override fun onTaskMovedToFront(taskId: Int) {
|
||||
if ((isShowing() && isInState(DEFAULT))) {
|
||||
private val homeVisibilityState = SystemUiProxy.INSTANCE.get(this).homeVisibilityState
|
||||
private val homeVisibilityListener =
|
||||
object : HomeVisibilityState.VisibilityChangeListener {
|
||||
override fun onHomeVisibilityChanged(isVisible: Boolean) {
|
||||
if (isShowing() && !isVisible && isInState(DEFAULT)) {
|
||||
// handling state where we end recents animation by swiping livetile away
|
||||
// TODO: animate this switch.
|
||||
cleanupRecentsWindow()
|
||||
@@ -217,7 +219,7 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
|
||||
}
|
||||
|
||||
init {
|
||||
TaskStackChangeListeners.getInstance().registerTaskStackListener(taskStackChangeListener)
|
||||
homeVisibilityState.addListener(homeVisibilityListener)
|
||||
}
|
||||
|
||||
override fun handleConfigurationChanged(configuration: Configuration?) {
|
||||
@@ -234,8 +236,8 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
|
||||
super.destroy()
|
||||
Executors.MAIN_EXECUTOR.execute { onViewDestroyed() }
|
||||
cleanupRecentsWindow()
|
||||
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(taskStackChangeListener)
|
||||
callbacks?.removeListener(recentsAnimationListener)
|
||||
homeVisibilityState.removeListener(homeVisibilityListener)
|
||||
recentsWindowTracker.onContextDestroyed(this)
|
||||
recentsView?.destroy()
|
||||
}
|
||||
@@ -325,11 +327,7 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
|
||||
stateManager.moveToRestState()
|
||||
}
|
||||
|
||||
fun onNewIntent() {
|
||||
cleanupRecentsWindow()
|
||||
}
|
||||
|
||||
private fun cleanupRecentsWindow() {
|
||||
fun cleanupRecentsWindow() {
|
||||
RecentsWindowProtoLogProxy.logCleanup(isShowing())
|
||||
if (isShowing()) {
|
||||
windowManager.removeViewImmediate(windowView)
|
||||
@@ -389,7 +387,7 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
|
||||
override fun onStateSetEnd(state: RecentsState) {
|
||||
super.onStateSetEnd(state)
|
||||
RecentsWindowProtoLogProxy.logOnStateSetEnd(state.toString())
|
||||
if (state.toLauncherState() == LauncherState.NORMAL) {
|
||||
if (state.toLauncherState() == NORMAL) {
|
||||
cleanupRecentsWindow()
|
||||
}
|
||||
AccessibilityManagerCompat.sendStateEventToTest(baseContext, state.toLauncherStateOrdinal())
|
||||
|
||||
Reference in New Issue
Block a user