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

Commit 64c529f2 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Unify Display level of window hierarchy (74/n)"

parents 1bf89ec5 2453d065
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -77,12 +77,14 @@ message ActivityStackSupervisorProto {
message ActivityDisplayProto {
    option (.android.msg_privacy).dest = DEST_AUTOMATIC;

    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1;
    // To be removed soon.
    optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1 [deprecated=true];
    optional int32 id = 2;
    repeated ActivityStackProto stacks = 3;
    optional int32 focused_stack_id = 4;
    optional .com.android.server.wm.IdentifierProto resumed_activity = 5;
    optional bool single_task_instance = 6;
    optional .com.android.server.wm.DisplayContentProto display = 7;
}

message ActivityStackProto {
+180 −402

File changed.

Preview size limit exceeded, changes collapsed.

+2 −4
Original line number Diff line number Diff line
@@ -2237,7 +2237,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            }
        }
        return (getWindowConfiguration().canReceiveKeys() || isAlwaysFocusable())
                && getParent() != null;
                && getDisplay() != null;
    }

    /** Move activity with its stack to front and make the stack focused. */
@@ -2420,7 +2420,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                    final ActivityDisplay display = stack.getDisplay();
                    next = display.topRunningActivity();
                    if (next != null) {
                        display.positionChildAtTop(next.getActivityStack(),
                        display.positionStackAtTop(next.getActivityStack(),
                                false /* includingParents */, "finish-display-top");
                    }
                }
@@ -5688,8 +5688,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    @Override
    boolean isWaitingForTransitionStart() {
        final DisplayContent dc = getDisplayContent();
        // TODO(display-unify): Test for null can be removed once unification is done.
        if (dc == null) return false;
        return dc.mAppTransition.isTransitionSet()
                && (dc.mOpeningApps.contains(this)
                || dc.mClosingApps.contains(this)
+13 −20
Original line number Diff line number Diff line
@@ -750,7 +750,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
        // stacks on a wrong display.
        mDisplayId = display.mDisplayId;
        setActivityType(activityType);
        display.addChild(this, onTop ? POSITION_TOP : POSITION_BOTTOM);
        display.addStack(this, onTop ? POSITION_TOP : POSITION_BOTTOM);
        setWindowingMode(windowingMode, false /* animate */, false /* showRecents */,
                false /* enteringSplitScreenMode */, false /* deferEnsuringVisibility */,
                true /* creating */);
@@ -879,7 +879,6 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
                        newBounds /* outStackBounds */, mTmpRect2 /* outTempTaskBounds */);
                hasNewOverrideBounds = true;
            }
            display.onStackWindowingModeChanged(this);
        }
        if (hasNewOverrideBounds) {
            if (inSplitScreenPrimaryWindowingMode()) {
@@ -896,7 +895,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
            // Since always on top is only on when the stack is freeform or pinned, the state
            // can be toggled when the windowing mode changes. We must make sure the stack is
            // placed properly when always on top state changes.
            display.positionChildAtTop(this, false /* includingParents */);
            display.positionStackAtTop(this, false /* includingParents */);
        }
    }

@@ -1337,7 +1336,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
        }

        final boolean movingTask = task != null;
        display.positionChildAtTop(this, !movingTask /* includingParents */, reason);
        display.positionStackAtTop(this, !movingTask /* includingParents */, reason);
        if (movingTask) {
            // This also moves the entire hierarchy branch to top, including parents
            positionChildAtTop(task);
@@ -1353,7 +1352,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
            return;
        }

        getDisplay().positionChildAtBottom(this, reason);
        getDisplay().positionStackAtBottom(this, reason);
        if (task != null) {
            positionChildAtBottom(task);
        }
@@ -1848,8 +1847,8 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
        boolean shouldBeVisible = true;
        final int windowingMode = getWindowingMode();
        final boolean isAssistantType = isActivityTypeAssistant();
        for (int i = display.getChildCount() - 1; i >= 0; --i) {
            final ActivityStack other = display.getChildAt(i);
        for (int i = display.getStackCount() - 1; i >= 0; --i) {
            final ActivityStack other = display.getStackAt(i);
            final boolean hasRunningActivities = other.topRunningActivityLocked() != null;
            if (other == this) {
                // Should be visible if there is no other stack occluding it, unless it doesn't
@@ -3010,7 +3009,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
        if (index == 0) {
            return false;
        }
        final ActivityStack stackBehind = display.getChildAt(index - 1);
        final ActivityStack stackBehind = display.getStackAt(index - 1);
        return stackBehind.isActivityTypeStandard();
    }

@@ -3887,7 +3886,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
        // always on top windows. Since the position the stack should be inserted into is calculated
        // properly in {@link ActivityDisplay#getTopInsertPosition()} in both cases, we can just
        // request that the stack is put at top here.
        display.positionChildAtTop(this, false /* includingParents */);
        display.positionStackAtTop(this, false /* includingParents */);
    }

    /** NOTE: Should only be called from {@link Task#reparent}. */
@@ -4019,7 +4018,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
            final Task task = mChildren.get(0);
            setWindowingMode(WINDOWING_MODE_UNDEFINED);

            getDisplay().positionChildAtTop(this, false /* includingParents */);
            getDisplay().positionStackAtTop(this, false /* includingParents */);

            mStackSupervisor.scheduleUpdatePictureInPictureModeIfNeeded(task, this);
            MetricsLoggerWrapper.logPictureInPictureFullScreen(mService.mContext,
@@ -4456,20 +4455,14 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
        }
    }

    // TODO(display-unify): Remove after display unification.
    protected void onParentChanged(ActivityDisplay newParent, ActivityDisplay oldParent) {
        onParentChanged(
                newParent != null ? newParent.mDisplayContent : null,
                oldParent != null ? oldParent.mDisplayContent : null);
    }

    @Override
    protected void onParentChanged(
            ConfigurationContainer newParent, ConfigurationContainer oldParent) {
        // TODO(display-merge): Remove cast
        final ActivityDisplay display = newParent != null
                ? ((WindowContainer) newParent).getDisplayContent().mActivityDisplay : null;
                ? (ActivityDisplay) ((WindowContainer) newParent).getDisplayContent() : null;
        final ActivityDisplay oldDisplay = oldParent != null
                ? ((WindowContainer) oldParent).getDisplayContent().mActivityDisplay : null;
                ? (ActivityDisplay) ((WindowContainer) oldParent).getDisplayContent() : null;

        mDisplayId = (display != null) ? display.mDisplayId : INVALID_DISPLAY;
        mPrevDisplayId = (oldDisplay != null) ? oldDisplay.mDisplayId : INVALID_DISPLAY;
+5 −7
Original line number Diff line number Diff line
@@ -1500,13 +1500,11 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
                    mRootActivityContainer.getActivityDisplay(toDisplayId);

            if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
                // Tell the display we are exiting split-screen mode.
                toDisplay.onExitingSplitScreenMode();
                // We are moving all tasks from the docked stack to the fullscreen stack,
                // which is dismissing the docked stack, so resize all other stacks to
                // fullscreen here already so we don't end up with resize trashing.
                for (int i = toDisplay.getChildCount() - 1; i >= 0; --i) {
                    final ActivityStack otherStack = toDisplay.getChildAt(i);
                for (int i = toDisplay.getStackCount() - 1; i >= 0; --i) {
                    final ActivityStack otherStack = toDisplay.getStackAt(i);
                    if (!otherStack.inSplitScreenSecondaryWindowingMode()) {
                        continue;
                    }
@@ -1654,8 +1652,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
                // screen controls and is also the same for all stacks.
                final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
                final Rect otherTaskRect = new Rect();
                for (int i = display.getChildCount() - 1; i >= 0; --i) {
                    final ActivityStack current = display.getChildAt(i);
                for (int i = display.getStackCount() - 1; i >= 0; --i) {
                    final ActivityStack current = display.getStackAt(i);
                    if (!current.inSplitScreenSecondaryWindowingMode()) {
                        continue;
                    }
@@ -1740,7 +1738,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
             * to the fullscreen stack.  This is to guarantee that when we are removing a stack,
             * that the client receives onStop() before it is reparented.  We do this by detaching
             * the stack from the display so that it will be considered invisible when
             * ensureActivitiesVisible() is called, and all of its activitys will be marked
             * ensureActivitiesVisible() is called, and all of its activities will be marked
             * invisible as well and added to the stopping list.  After which we process the
             * stopping list by handling the idle.
             */
Loading