Merge "Fix broken -1 -> home transition with overview in window enabled" into main

This commit is contained in:
Treehugger Robot authored and Android (Google) Code Review committed 2025-04-15 16:29:43 -07:00
commit ef95172183
6 files changed
+35 -15

No files matched your search

@@ -153,6 +153,13 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
public abstract void onExitOverview(Runnable exitRunnable);
/**
* @return {@code true} iff the launcher's -1 page is showing
*/
public boolean isLauncherOverlayShowing() {
return false;
}
/** Called when the animation to home has fully settled. */
public void onSwipeUpToHomeComplete() {}
@@ -30,11 +30,11 @@ import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.util.Log;
import android.view.MotionEvent;
import androidx.annotation.Nullable;
import com.android.launcher3.Launcher;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.statehandlers.DepthController;
@@ -42,6 +42,7 @@ import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.NavigationMode;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.fallback.window.RecentsWindowFlags;
import com.android.quickstep.fallback.window.RecentsWindowManager;
import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.views.RecentsView;
@@ -116,6 +117,16 @@ public abstract class BaseWindowInterface extends
recentsView.switchToScreenshot(thumbnailDatas, runnable);
}
@Override
public boolean isLauncherOverlayShowing() {
if (!RecentsWindowFlags.enableLauncherOverviewInWindow.isTrue()) {
return false;
}
Launcher launcher = Launcher.ACTIVITY_TRACKER.getCreatedContext();
return launcher != null && launcher.getWorkspace().isOverlayShown();
}
/**
* todo: Create an abstract animation factory to handle both activity and window implementations
* todo: move new factory into BaseContainerInterface and cleanup.
@@ -525,11 +525,10 @@ object InputConsumerUtils {
reasonString.append("%skeyguard is not showing occluded", SUBSTRING_PREFIX)
val runningTask = gestureState.runningTask
val container = gestureState.getContainerInterface<S, T>()
// Use overview input consumer for sharesheets on top of home.
val forceOverviewInputConsumer =
gestureState.getContainerInterface<S, T>().isStarted() &&
runningTask != null &&
runningTask.isRootChooseActivity
container.isStarted() && runningTask != null && runningTask.isRootChooseActivity
if (!Flags.enableShellTopTaskTracking()) {
// In the case where we are in an excluded, translucent overlay, ignore it and treat the
@@ -550,18 +549,17 @@ object InputConsumerUtils {
// with shell-transitions, home is resumed during recents animation, so
// explicitly check against recents animation too.
val launcherResumedThroughShellTransition =
(gestureState.getContainerInterface<S, T>().isResumed() &&
!previousGestureState.isRecentsAnimationRunning)
container.isResumed() && !previousGestureState.isRecentsAnimationRunning
// If a task fragment within Launcher is resumed
val launcherChildActivityResumed =
(com.android.launcher3.Flags.useActivityOverlay() &&
runningTask != null &&
runningTask.isHomeTask &&
overviewComponentObserver.isHomeAndOverviewSameActivity &&
!launcherResumedThroughShellTransition &&
!previousGestureState.isRecentsAnimationRunning)
!previousGestureState.isRecentsAnimationRunning &&
overviewComponentObserver.isHomeAndOverviewSame &&
container.isLauncherOverlayShowing)
return if (gestureState.getContainerInterface<S, T>().isInLiveTileMode()) {
return if (container.isInLiveTileMode()) {
createOverviewInputConsumer<S, T>(
userUnlocked,
taskAnimationManager,
@@ -358,4 +358,11 @@ public final class LauncherActivityInterface extends
return NORMAL;
}
}
@Override
public boolean isLauncherOverlayShowing() {
Launcher launcher = Launcher.ACTIVITY_TRACKER.getCreatedContext();
return launcher != null && launcher.getWorkspace().isOverlayShown();
}
}
@@ -301,10 +301,6 @@ public final class OverviewComponentObserver {
return mIsHomeAndOverviewSame;
}
public boolean isHomeAndOverviewSameActivity() {
return isHomeAndOverviewSame() && !enableLauncherOverviewInWindow.isTrue();
}
/**
* Get the current control helper for managing interactions to the overview container for
* the given displayId.
@@ -297,7 +297,8 @@ public class InputConsumerUtilsTest {
@Test
public void testNewBaseConsumer_launcherChildActivityResumed_returnsDefaultInputConsumer() {
when(mRunningTask.isHomeTask()).thenReturn(true);
when(mOverviewComponentObserver.isHomeAndOverviewSameActivity()).thenReturn(true);
when(mOverviewComponentObserver.isHomeAndOverviewSame()).thenReturn(true);
when(mContainerInterface.isLauncherOverlayShowing()).thenReturn(true);
assertEqualsDefaultInputConsumer(this::createBaseInputConsumer);
}