Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cbb8504 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Set 90% task to be focused afer divider swap" into main

parents f348a8c4 fca6665d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -217,6 +217,19 @@ public class SplitScreenConstants {
        };
    }

    /**
     * Convenience method to convert between the IntDef's to avoid some errors
     * @return {@code -1} if splitScreenState does not have a valid/corresponding
     *         PersistentSnapPosition
     */
    @PersistentSnapPosition
    public static int splitStateToSnapPosition(@SplitScreenState int splitScreenState) {
        return switch (splitScreenState) {
            case NOT_IN_SPLIT, SNAP_TO_NONE, ANIMATING_OFFSCREEN_TAP -> -1;
            default -> splitScreenState;
        };
    }

    /**
     * Checks if the snapPosition in question is a {@link PersistentSnapPosition}.
     */
+9 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSIT
import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;
import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED;
import static com.android.wm.shell.shared.split.SplitScreenConstants.splitPositionToString;
import static com.android.wm.shell.shared.split.SplitScreenConstants.splitStateToSnapPosition;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_A;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_B;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_MAIN;
@@ -1437,6 +1438,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                        mSplitLayout.populateTouchZones();
                        notifySplitAnimationStatus(false /*animationRunning*/);

                        if (enableFlexibleTwoAppSplit() &&
                                mSplitState.currentStateHasOffscreenApps()) {
                            // Stages have changed positions, but layout hasn't so update
                            // focus on the same layout type as before. NOTE: this needs to happen
                            // AFTER we make the window's focusable, otherwise it's a no-op
                            grantFocusForSnapPosition(splitStateToSnapPosition(mSplitState.get()));
                        }

                        // updateSurfaceBounds(), above, officially puts the two apps in their new
                        // stages. Starting on the next frame, all calculations are made using the
                        // new layouts/insets. So any follow-up animations on the same leashes below