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

Commit 54e6fcde authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Iae56bcd2,I5b2e37c3

* changes:
  Fixed logic issue with WC.supportsSplitScreenWindowingMode()
  Don't move home task forward in some cases.
parents 1b0e42a7 2b07da80
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -500,15 +500,12 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
     * @hide
     */
    public boolean supportSplitScreenWindowingMode() {
        return supportSplitScreenWindowingMode(mWindowingMode, mActivityType);
        return supportSplitScreenWindowingMode(mActivityType);
    }

    /** @hide */
    public static boolean supportSplitScreenWindowingMode(int windowingMode, int activityType) {
        if (activityType == ACTIVITY_TYPE_ASSISTANT) {
            return false;
        }
        return windowingMode != WINDOWING_MODE_FREEFORM && windowingMode != WINDOWING_MODE_PINNED;
    public static boolean supportSplitScreenWindowingMode(int activityType) {
        return activityType != ACTIVITY_TYPE_ASSISTANT;
    }

    /** @hide */
+2 −2
Original line number Diff line number Diff line
@@ -404,8 +404,8 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {

        if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
                || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
            return supportsSplitScreen && WindowConfiguration.supportSplitScreenWindowingMode(
                    windowingMode, activityType);
            return supportsSplitScreen
                    && WindowConfiguration.supportSplitScreenWindowingMode(activityType);
        }

        if (!supportsFreeform && windowingMode == WINDOWING_MODE_FREEFORM) {
+10 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
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_UNDEFINED;
@@ -1778,6 +1779,15 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        return inPinnedWindowingMode();
    }

    /** @return True if the resizing of the primary-split-screen stack affects this stack size. */
    boolean affectedBySplitScreenResize() {
        if (!supportsSplitScreenWindowingMode()) {
            return false;
        }
        final int windowingMode = getWindowingMode();
        return windowingMode != WINDOWING_MODE_FREEFORM && windowingMode != WINDOWING_MODE_PINNED;
    }

    /**
     * @return the top most visible activity that wants to dismiss Keyguard
     */
+24 −23
Original line number Diff line number Diff line
@@ -2441,7 +2441,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeStack_" + stack.mStackId);
        mWindowManager.deferSurfaceLayout();
        try {
            if (stack.supportsSplitScreenWindowingMode()) {
            if (stack.affectedBySplitScreenResize()) {
                if (bounds == null && stack.inSplitScreenWindowingMode()) {
                    // null bounds = fullscreen windowing mode...at least for now.
                    stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
@@ -2541,8 +2541,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                                null, mTmpOptions, task, task.getActivityType(), onTop);

                    if (onTop) {
                        final int returnToType =
                                toDisplay.getTopVisibleStackActivityType(WINDOWING_MODE_PINNED);
                        final boolean isTopTask = i == (size - 1);
                        // Defer resume until all the tasks have been moved to the fullscreen stack
                        task.reparent(toStack, ON_TOP, REPARENT_MOVE_STACK_TO_FRONT,
@@ -2631,7 +2629,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                    if (current.getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
                        continue;
                    }
                    if (!current.supportsSplitScreenWindowingMode()) {
                    if (!current.affectedBySplitScreenResize()) {
                        continue;
                    }
                    // Need to set windowing mode here before we try to get the dock bounds.
@@ -4177,8 +4175,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        }

        // Handle incorrect launch/move to secondary display if needed.
        final boolean launchOnSecondaryDisplayFailed;
        if (isSecondaryDisplayPreferred) {
            final boolean launchOnSecondaryDisplayFailed;
            final int actualDisplayId = task.getStack().mDisplayId;
            if (!task.canBeLaunchedOnDisplay(actualDisplayId)) {
                // The task landed on an inappropriate display somehow, move it to the default
@@ -4193,33 +4191,33 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                        || (preferredDisplayId != INVALID_DISPLAY
                            && preferredDisplayId != actualDisplayId);
            }
        } else {
            // The task wasn't requested to be on a secondary display.
            launchOnSecondaryDisplayFailed = false;
        }

        final ActivityRecord topActivity = task.getTopActivity();
        if (launchOnSecondaryDisplayFailed
                || !task.supportsSplitScreenWindowingMode() || forceNonResizable) {
            if (launchOnSecondaryDisplayFailed) {
                // Display a warning toast that we tried to put a non-resizeable task on a secondary
                // display with config different from global config.
                mService.mTaskChangeNotificationController
                        .notifyActivityLaunchOnSecondaryDisplayFailed();
            } else {
                return;
            }
        }

        final ActivityRecord topActivity = task.getTopActivity();
        if (!task.supportsSplitScreenWindowingMode() || forceNonResizable) {
            // Display a warning toast that we tried to put a non-dockable task in the docked
            // stack.
            mService.mTaskChangeNotificationController.notifyActivityDismissingDockedStack();
            }

            // Dismiss docked stack. If task appeared to be in docked stack but is not resizable -
            // we need to move it to top of fullscreen stack, otherwise it will be covered.

            final ActivityStack dockedStack = task.getStack().getDisplay().getSplitScreenPrimaryStack();
            final ActivityStack dockedStack =
                    task.getStack().getDisplay().getSplitScreenPrimaryStack();
            if (dockedStack != null) {
                moveTasksToFullscreenStackLocked(dockedStack, actualStack == dockedStack);
            }
        } else if (topActivity != null && topActivity.isNonResizableOrForcedResizable()
            return;
        }

        if (topActivity != null && topActivity.isNonResizableOrForcedResizable()
            && !topActivity.noDisplay) {
            final String packageName = topActivity.appInfo.packageName;
            final int reason = isSecondaryDisplayPreferred
@@ -4489,9 +4487,12 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                        "startActivityFromRecents: Task " + taskId + " not found.");
            }

            // We always want to return to the home activity instead of the recents activity from
            // whatever is started from the recents activity, so move the home stack forward.
            if (windowingMode != WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
                // We always want to return to the home activity instead of the recents activity
                // from whatever is started from the recents activity, so move the home stack
                // forward.
                moveHomeStackToFront("startActivityFromRecents");
            }

            // If the user must confirm credentials (e.g. when first launching a work app and the
            // Work Challenge is present) let startActivityInPackage handle the intercepting.