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

Commit cd504bbe authored by Evan Rosky's avatar Evan Rosky Committed by Android (Google) Code Review
Browse files

Merge "Move policy handling into ATM hierarchy [3/n]"

parents 6f4ac928 dfe3da7a
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>

    @Override
    public void onInitializeOverrideConfiguration(Configuration config) {
        getOverrideConfiguration().updateFrom(config);
        getRequestedOverrideConfiguration().updateFrom(config);
    }

    void addChild(ActivityStack stack, int position) {
@@ -953,15 +953,16 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>
    }

    @Override
    public void onOverrideConfigurationChanged(Configuration overrideConfiguration) {
        final int currRotation = getOverrideConfiguration().windowConfiguration.getRotation();
    public void onRequestedOverrideConfigurationChanged(Configuration overrideConfiguration) {
        final int currRotation =
                getRequestedOverrideConfiguration().windowConfiguration.getRotation();
        if (currRotation != ROTATION_UNDEFINED
                && currRotation != overrideConfiguration.windowConfiguration.getRotation()
                && getWindowContainerController() != null) {
            getWindowContainerController().applyRotation(currRotation,
                    overrideConfiguration.windowConfiguration.getRotation());
        }
        super.onOverrideConfigurationChanged(overrideConfiguration);
        super.onRequestedOverrideConfigurationChanged(overrideConfiguration);
    }

    @Override
+15 −10
Original line number Diff line number Diff line
@@ -441,8 +441,13 @@ final class ActivityRecord extends ConfigurationContainer {
        mLastReportedConfiguration.dump(pw, prefix + " ");

        pw.print(prefix); pw.print("CurrentConfiguration="); pw.println(getConfiguration());
        if (!getOverrideConfiguration().equals(EMPTY)) {
            pw.println(prefix + "OverrideConfiguration=" + getOverrideConfiguration());
        if (!getRequestedOverrideConfiguration().equals(EMPTY)) {
            pw.println(prefix + "RequestedOverrideConfiguration="
                    + getRequestedOverrideConfiguration());
        }
        if (!getResolvedOverrideConfiguration().equals(getRequestedOverrideConfiguration())) {
            pw.println(prefix + "ResolvedOverrideConfiguration="
                    + getResolvedOverrideConfiguration());
        }
        if (!matchParentBounds()) {
            pw.println(prefix + "bounds=" + getBounds());
@@ -2531,13 +2536,13 @@ final class ActivityRecord extends ConfigurationContainer {
        mTmpConfig.unset();
        computeBounds(mTmpBounds);

        if (mTmpBounds.equals(getOverrideBounds())) {
        if (mTmpBounds.equals(getRequestedOverrideBounds())) {
            return;
        }

        setBounds(mTmpBounds);

        final Rect updatedBounds = getOverrideBounds();
        final Rect updatedBounds = getRequestedOverrideBounds();

        // Bounds changed...update configuration to match.
        if (!matchParentBounds()) {
@@ -2545,7 +2550,7 @@ final class ActivityRecord extends ConfigurationContainer {
                    false /* overrideWidth */, false /* overrideHeight */);
        }

        onOverrideConfigurationChanged(mTmpConfig);
        onRequestedOverrideConfigurationChanged(mTmpConfig);
    }

    /** Returns true if the configuration is compatible with this activity. */
@@ -2602,11 +2607,11 @@ final class ActivityRecord extends ConfigurationContainer {
        if (containingAppWidth <= maxActivityWidth && containingAppHeight <= maxActivityHeight) {
            // The display matches or is less than the activity aspect ratio, so nothing else to do.
            // Return the existing bounds. If this method is running for the first time,
            // {@link #getOverrideBounds()} will be empty (representing no override). If the method has run
            // before, then effect of {@link #getOverrideBounds()} will already have been applied to the
            // value returned from {@link getConfiguration}. Refer to
            // {@link TaskRecord#computeOverrideConfiguration}.
            outBounds.set(getOverrideBounds());
            // {@link #getRequestedOverrideBounds()} will be empty (representing no override). If
            // the method has run before, then effect of {@link #getRequestedOverrideBounds()} will
            // already have been applied to the value returned from {@link getConfiguration}. Refer
            // to {@link TaskRecord#computeOverrideConfiguration}.
            outBounds.set(getRequestedOverrideBounds());
            return;
        }

+18 −17
Original line number Diff line number Diff line
@@ -264,8 +264,8 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            // If we created a docked stack we want to resize it so it resizes all other stacks
            // in the system.
            getStackDockedModeBounds(null, null, mTmpRect2, mTmpRect3);
            mStackSupervisor.resizeDockedStackLocked(
                    getOverrideBounds(), mTmpRect2, mTmpRect2, null, null, PRESERVE_WINDOWS);
            mStackSupervisor.resizeDockedStackLocked(getRequestedOverrideBounds(), mTmpRect2,
                    mTmpRect2, null, null, PRESERVE_WINDOWS);
        }
        mRootActivityContainer.updateUIDsPresentOnDisplay();
    }
@@ -562,7 +562,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        // Update bounds if applicable
        boolean hasNewOverrideBounds = false;
        // Use override windowing mode to prevent extra bounds changes if inheriting the mode.
        if (getOverrideWindowingMode() == WINDOWING_MODE_PINNED) {
        if (getRequestedOverrideWindowingMode() == WINDOWING_MODE_PINNED) {
            // Pinned calculation already includes rotation
            mTmpRect2.set(mTmpRect);
            hasNewOverrideBounds = getWindowContainerController().mContainer
@@ -589,8 +589,8 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                        || prevScreenH != getConfiguration().screenHeightDp) {
                    // Use override windowing mode to prevent extra bounds changes if inheriting
                    // the mode.
                    if (getOverrideWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
                            || getOverrideWindowingMode()
                    if (getRequestedOverrideWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
                            || getRequestedOverrideWindowingMode()
                            == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
                        mTmpRect2.set(mTmpRect);
                        getWindowContainerController().mContainer
@@ -602,11 +602,12 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        }
        if (getWindowingMode() != prevWindowingMode) {
            // Use override windowing mode to prevent extra bounds changes if inheriting the mode.
            if (getOverrideWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
            if (getRequestedOverrideWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
                getStackDockedModeBounds(null, null, mTmpRect2, mTmpRect3);
                // immediately resize so docked bounds are available in onSplitScreenModeActivated
                resize(mTmpRect2, null /* tempTaskBounds */, null /* tempTaskInsetBounds */);
            } else if (getOverrideWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
            } else if (
                    getRequestedOverrideWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
                Rect dockedBounds = display.getSplitScreenPrimaryStack().getBounds();
                final boolean isMinimizedDock = getDisplay().getWindowContainerController()
                        .mContainer.getDockedDividerController().isMinimizedDock();
@@ -672,7 +673,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
    void setWindowingMode(int preferredWindowingMode, boolean animate, boolean showRecents,
            boolean enteringSplitScreenMode, boolean deferEnsuringVisibility, boolean creating) {
        final int currentMode = getWindowingMode();
        final int currentOverrideMode = getOverrideWindowingMode();
        final int currentOverrideMode = getRequestedOverrideWindowingMode();
        final ActivityDisplay display = getDisplay();
        final TaskRecord topTask = topTask();
        final ActivityStack splitScreenStack = display.getSplitScreenPrimaryStack();
@@ -725,7 +726,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            // You are already in the window mode, so we can skip most of the work below. However,
            // it's possible that we have inherited the current windowing mode from a parent. So,
            // fulfill this method's contract by setting the override mode directly.
            getOverrideConfiguration().windowConfiguration.setWindowingMode(windowingMode);
            getRequestedOverrideConfiguration().windowConfiguration.setWindowingMode(windowingMode);
            return;
        }

@@ -791,7 +792,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                mWindowContainerController.getRawBounds(mTmpRect2);
            }

            if (!Objects.equals(getOverrideBounds(), mTmpRect2)) {
            if (!Objects.equals(getRequestedOverrideBounds(), mTmpRect2)) {
                resize(mTmpRect2, null /* tempTaskBounds */, null /* tempTaskInsetBounds */);
            }
        } finally {
@@ -4934,8 +4935,8 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                    // For freeform stack we don't adjust the size of the tasks to match that
                    // of the stack, but we do try to make sure the tasks are still contained
                    // with the bounds of the stack.
                    if (task.getOverrideBounds() != null) {
                        mTmpRect2.set(task.getOverrideBounds());
                    if (task.getRequestedOverrideBounds() != null) {
                        mTmpRect2.set(task.getRequestedOverrideBounds());
                        fitWithinBounds(mTmpRect2, bounds);
                        task.updateOverrideConfiguration(mTmpRect2);
                    }
@@ -4946,9 +4947,9 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai

            if (task.hasDisplayedBounds()) {
                mTmpBounds.put(task.taskId, task.getDisplayedBounds());
                mTmpInsetBounds.put(task.taskId, task.getOverrideBounds());
                mTmpInsetBounds.put(task.taskId, task.getRequestedOverrideBounds());
            } else {
                mTmpBounds.put(task.taskId, task.getOverrideBounds());
                mTmpBounds.put(task.taskId, task.getRequestedOverrideBounds());
                mTmpInsetBounds.put(task.taskId, null);
            }
        }
@@ -5191,7 +5192,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                pw.println("");
            }
            pw.println(prefix + "Task id #" + task.taskId);
            pw.println(prefix + "mBounds=" + task.getOverrideBounds());
            pw.println(prefix + "mBounds=" + task.getRequestedOverrideBounds());
            pw.println(prefix + "mMinWidth=" + task.mMinWidth);
            pw.println(prefix + "mMinHeight=" + task.mMinHeight);
            pw.println(prefix + "mLastNonFullscreenBounds=" + task.mLastNonFullscreenBounds);
@@ -5349,7 +5350,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        if (!mStackSupervisor.getLaunchParamsController()
                .layoutTask(task, info.windowLayout, activity, source, options)
                && !matchParentBounds() && task.isResizeable() && !isLockscreenShown) {
            task.updateOverrideConfiguration(getOverrideBounds());
            task.updateOverrideConfiguration(getRequestedOverrideBounds());
        }
        task.createWindowContainer(toTop, (info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0);
        return task;
@@ -5541,7 +5542,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        }
        proto.write(DISPLAY_ID, mDisplayId);
        if (!matchParentBounds()) {
            final Rect bounds = getOverrideBounds();
            final Rect bounds = getRequestedOverrideBounds();
            bounds.writeToProto(proto, BOUNDS);
        }

+1 −1
Original line number Diff line number Diff line
@@ -2410,7 +2410,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
            return;
        }

        scheduleUpdatePictureInPictureModeIfNeeded(task, stack.getOverrideBounds());
        scheduleUpdatePictureInPictureModeIfNeeded(task, stack.getRequestedOverrideBounds());
    }

    void scheduleUpdatePictureInPictureModeIfNeeded(TaskRecord task, Rect targetStackBounds) {
+96 −62

File changed.

Preview size limit exceeded, changes collapsed.

Loading