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

Commit 05bba389 authored by Chilun's avatar Chilun
Browse files

Attach the nav bar for stage split

Update the code to support attaching the nav bar for stage split.
Also clean up the legacy split screen related code.

Bug: 178449492
Bug: 199236198
Test: atest RecentsAnimationControllerTest
Change-Id: I5ed1bd1f066430760e74e6e89ec8ca185990362a
parent e4297308
Loading
Loading
Loading
Loading
+11 −23
Original line number Diff line number Diff line
@@ -18,8 +18,7 @@ package com.android.server.wm;

import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static android.view.RemoteAnimationTarget.MODE_CLOSING;
@@ -129,7 +128,6 @@ public class RecentsAnimationController implements DeathRecipient {
    private ActivityRecord mTargetActivityRecord;
    private DisplayContent mDisplayContent;
    private int mTargetActivityType;
    private Rect mMinimizedHomeBounds = new Rect();

    // We start the RecentsAnimationController in a pending-start state since we need to wait for
    // the wallpaper/activity to draw before we can give control to the handler to start animating
@@ -480,11 +478,6 @@ public class RecentsAnimationController implements DeathRecipient {
            mDisplayContent.setLayoutNeeded();
        }

        // Save the minimized home height
        final Task rootHomeTask =
                mDisplayContent.getDefaultTaskDisplayArea().getRootHomeTask();
        mMinimizedHomeBounds = rootHomeTask != null ? rootHomeTask.getBounds() : null;

        mService.mWindowPlacerLocked.performSurfacePlacement();

        mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(targetActivity);
@@ -502,9 +495,7 @@ public class RecentsAnimationController implements DeathRecipient {
     */
    private boolean skipAnimation(Task task) {
        final WindowConfiguration config = task.getWindowConfiguration();
        return task.isAlwaysOnTop()
                || config.tasksAreFloating()
                || config.getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
        return task.isAlwaysOnTop() || config.tasksAreFloating();
    }

    @VisibleForTesting
@@ -568,10 +559,6 @@ public class RecentsAnimationController implements DeathRecipient {
            // insets for the target app window after a rotation
            mDisplayContent.performLayout(false /* initial */, false /* updateInputWindows */);

            final Rect minimizedHomeBounds = mTargetActivityRecord != null
                    && mTargetActivityRecord.inSplitScreenSecondaryWindowingMode()
                            ? mMinimizedHomeBounds
                            : null;
            final Rect contentInsets;
            final WindowState targetAppMainWindow = getTargetAppMainWindow();
            if (targetAppMainWindow != null) {
@@ -585,7 +572,7 @@ public class RecentsAnimationController implements DeathRecipient {
                contentInsets = mTmpRect;
            }
            mRunner.onAnimationStart(mController, appTargets, wallpaperTargets, contentInsets,
                    minimizedHomeBounds);
                    null);
            ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS,
                    "startAnimation(): Notify animation start: %s",
                    mPendingAnimations.stream()
@@ -623,16 +610,17 @@ public class RecentsAnimationController implements DeathRecipient {
        for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
            final TaskAnimationAdapter adapter = mPendingAnimations.get(i);
            final Task task = adapter.mTask;
            final boolean isSplitScreenSecondary =
                    task.getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
            final TaskFragment adjacentTask = task.getRootTask().getAdjacentTaskFragment();
            final boolean inSplitScreen = task.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW
                    && adjacentTask != null;
            if (task.isHomeOrRecentsRootTask()
                    // TODO(b/178449492): Will need to update for the new split screen mode once
                    // it's ready.
                    // Skip if the task is the secondary split screen and in landscape.
                    || (isSplitScreenSecondary && isDisplayLandscape)) {
                    // Skip if the task is in split screen and in landscape.
                    || (inSplitScreen && isDisplayLandscape)
                    // Skip if the task is the top task in split screen.
                    || (inSplitScreen && task.getBounds().top < adjacentTask.getBounds().top)) {
                continue;
            }
            shouldTranslateNavBar = isSplitScreenSecondary;
            shouldTranslateNavBar = inSplitScreen;
            mNavBarAttachedApp = task.getTopVisibleActivity();
            break;
        }
+5 −7
Original line number Diff line number Diff line
@@ -16,9 +16,6 @@

package com.android.server.wm;

import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
@@ -632,10 +629,11 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
    @Test
    public void testAttachNavBarInSplitScreenMode() {
        setupForShouldAttachNavBarDuringTransition();
        final ActivityRecord primary = createActivityRecordWithParentTask(mDefaultDisplay,
                WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD);
        final ActivityRecord secondary = createActivityRecordWithParentTask(mDefaultDisplay,
                WINDOWING_MODE_SPLIT_SCREEN_SECONDARY, ACTIVITY_TYPE_STANDARD);
        TestSplitOrganizer organizer = new TestSplitOrganizer(mAtm);
        final ActivityRecord primary = createActivityRecordWithParentTask(
                organizer.createTaskToPrimary(true));
        final ActivityRecord secondary = createActivityRecordWithParentTask(
                organizer.createTaskToSecondary(true));
        final ActivityRecord homeActivity = createHomeActivity();
        homeActivity.setVisibility(true);
        initializeRecentsAnimationController(mController, homeActivity);
+6 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static android.os.Process.SYSTEM_UID;
import static android.view.View.VISIBLE;
import static android.view.WindowManager.DISPLAY_IME_POLICY_FALLBACK_DISPLAY;
@@ -1531,7 +1532,11 @@ class WindowTestsBase extends SystemServiceTestsBase {

            final Rect primaryBounds = new Rect();
            final Rect secondaryBounds = new Rect();
            if (display.getConfiguration().orientation == ORIENTATION_LANDSCAPE) {
                display.getBounds().splitVertically(primaryBounds, secondaryBounds);
            } else {
                display.getBounds().splitHorizontally(primaryBounds, secondaryBounds);
            }
            mPrimary.setBounds(primaryBounds);
            mSecondary.setBounds(secondaryBounds);
        }