diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java index 5ae45b91fa..88dbbe13a5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityInterface.java @@ -215,7 +215,7 @@ public final class FallbackActivityInterface implements } @Override - public boolean shouldMinimizeSplitScreen() { + public boolean allowMinimizeSplitScreen() { // TODO: Remove this once b/77875376 is fixed return false; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java index 1b2979bff8..217f61faba 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackSwipeHandler.java @@ -250,8 +250,11 @@ public class FallbackSwipeHandler extends BaseSwipeUpHandler 1 - UPDATE_SYSUI_FLAGS_THRESHOLD)); + boolean swipeUpThresholdPassed = mCurrentShift.value > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD; + mRecentsAnimationController.setUseLauncherSystemBarFlags(mInQuickSwitchMode + || swipeUpThresholdPassed); + mRecentsAnimationController.setSplitScreenMinimized(!mInQuickSwitchMode + && swipeUpThresholdPassed); } if (!mInQuickSwitchMode && !mDeviceState.isFullyGesturalNavMode()) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java index 726322b0c5..4c2bd1bdfd 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java @@ -408,7 +408,7 @@ public final class LauncherActivityInterface implements BaseActivityInterface * @param windowProgress 0 == app, 1 == overview */ private void updateSysUiFlags(float windowProgress) { - if (mRecentsView != null) { + if (mRecentsAnimationController != null && mRecentsView != null) { + TaskView runningTask = mRecentsView.getRunningTaskView(); TaskView centermostTask = mRecentsView.getTaskViewNearestToCenterOfScreen(); int centermostTaskFlags = centermostTask == null ? 0 : centermostTask.getThumbnail().getSysUiStatusNavFlags(); - boolean useHomeScreenFlags = windowProgress > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD; + boolean swipeUpThresholdPassed = windowProgress > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD; + boolean quickswitchThresholdPassed = centermostTask != runningTask; + // We will handle the sysui flags based on the centermost task view. - if (mRecentsAnimationController != null) { - mRecentsAnimationController.setWindowThresholdCrossed(centermostTaskFlags != 0 - && useHomeScreenFlags); - } - int sysuiFlags = useHomeScreenFlags ? 0 : centermostTaskFlags; + mRecentsAnimationController.setUseLauncherSystemBarFlags( + (swipeUpThresholdPassed || quickswitchThresholdPassed) + && centermostTaskFlags != 0); + mRecentsAnimationController.setSplitScreenMinimized(swipeUpThresholdPassed); + + int sysuiFlags = swipeUpThresholdPassed ? 0 : centermostTaskFlags; mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, sysuiFlags); } } diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index a7a03e50c0..d51d6df489 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -105,7 +105,7 @@ public interface BaseActivityInterface { Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target); - boolean shouldMinimizeSplitScreen(); + boolean allowMinimizeSplitScreen(); default boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) { return true; diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java index 7d568a42ce..103ea4ea23 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java @@ -19,13 +19,11 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import android.graphics.Rect; import android.util.ArraySet; -import android.util.Log; import androidx.annotation.BinderThread; import androidx.annotation.UiThread; import com.android.launcher3.Utilities; -import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.Preconditions; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; @@ -41,15 +39,15 @@ public class RecentsAnimationCallbacks implements com.android.systemui.shared.system.RecentsAnimationListener { private final Set mListeners = new ArraySet<>(); - private final boolean mShouldMinimizeSplitScreen; + private final boolean mAllowMinimizeSplitScreen; // TODO(141886704): Remove these references when they are no longer needed private RecentsAnimationController mController; private boolean mCancelled; - public RecentsAnimationCallbacks(boolean shouldMinimizeSplitScreen) { - mShouldMinimizeSplitScreen = shouldMinimizeSplitScreen; + public RecentsAnimationCallbacks(boolean allowMinimizeSplitScreen) { + mAllowMinimizeSplitScreen = allowMinimizeSplitScreen; } @UiThread @@ -94,7 +92,7 @@ public class RecentsAnimationCallbacks implements RecentsAnimationTargets targets = new RecentsAnimationTargets(appTargets, wallpaperTargets, homeContentInsets, minimizedHomeBounds); mController = new RecentsAnimationController(animationController, - mShouldMinimizeSplitScreen, this::onAnimationFinished); + mAllowMinimizeSplitScreen, this::onAnimationFinished); if (mCancelled) { Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationController.java b/quickstep/src/com/android/quickstep/RecentsAnimationController.java index 5ece2d78e8..76a81ebad0 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationController.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationController.java @@ -49,21 +49,22 @@ public class RecentsAnimationController { private final RecentsAnimationControllerCompat mController; private final Consumer mOnFinishedListener; - private final boolean mShouldMinimizeSplitScreen; + private final boolean mAllowMinimizeSplitScreen; private InputConsumerController mInputConsumerController; private Supplier mInputProxySupplier; private InputConsumer mInputConsumer; - private boolean mWindowThresholdCrossed = false; + private boolean mUseLauncherSysBarFlags = false; + private boolean mSplitScreenMinimized = false; private boolean mTouchInProgress; private boolean mFinishPending; public RecentsAnimationController(RecentsAnimationControllerCompat controller, - boolean shouldMinimizeSplitScreen, + boolean allowMinimizeSplitScreen, Consumer onFinishedListener) { mController = controller; mOnFinishedListener = onFinishedListener; - mShouldMinimizeSplitScreen = shouldMinimizeSplitScreen; + mAllowMinimizeSplitScreen = allowMinimizeSplitScreen; } /** @@ -76,16 +77,31 @@ public class RecentsAnimationController { /** * Indicates that the gesture has crossed the window boundary threshold and system UI can be - * update the represent the window behind + * update the system bar flags accordingly. */ - public void setWindowThresholdCrossed(boolean windowThresholdCrossed) { - if (mWindowThresholdCrossed != windowThresholdCrossed) { - mWindowThresholdCrossed = windowThresholdCrossed; + public void setUseLauncherSystemBarFlags(boolean useLauncherSysBarFlags) { + if (mUseLauncherSysBarFlags != useLauncherSysBarFlags) { + mUseLauncherSysBarFlags = useLauncherSysBarFlags; + UI_HELPER_EXECUTOR.execute(() -> { + mController.setAnimationTargetsBehindSystemBars(!useLauncherSysBarFlags); + }); + } + } + + /** + * Indicates that the gesture has crossed the window boundary threshold and we should minimize + * if we are in splitscreen. + */ + public void setSplitScreenMinimized(boolean splitScreenMinimized) { + if (!mAllowMinimizeSplitScreen) { + return; + } + if (mSplitScreenMinimized != splitScreenMinimized) { + mSplitScreenMinimized = splitScreenMinimized; UI_HELPER_EXECUTOR.execute(() -> { - mController.setAnimationTargetsBehindSystemBars(!windowThresholdCrossed); SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate(); - if (p != null && mShouldMinimizeSplitScreen) { - p.setSplitScreenMinimized(windowThresholdCrossed); + if (p != null) { + p.setSplitScreenMinimized(splitScreenMinimized); } }); } diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index bbca568472..f5088e7e5a 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -26,7 +26,6 @@ import androidx.annotation.UiThread; import com.android.launcher3.Utilities; import com.android.launcher3.config.FeatureFlags; -import com.android.launcher3.testing.TestProtocol; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -67,7 +66,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn final BaseActivityInterface activityInterface = gestureState.getActivityInterface(); mLastGestureState = gestureState; - mCallbacks = new RecentsAnimationCallbacks(activityInterface.shouldMinimizeSplitScreen()); + mCallbacks = new RecentsAnimationCallbacks(activityInterface.allowMinimizeSplitScreen()); mCallbacks.addListener(new RecentsAnimationCallbacks.RecentsAnimationListener() { @Override public void onRecentsAnimationStart(RecentsAnimationController controller,