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

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

Merge "Respect the override bounds of the leaf tasks" into main

parents 9dca151a e853883b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -226,3 +226,14 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "windowing_sdk"
    name: "respect_leaf_task_bounds"
    description: "Respect the override bounds of the leaf tasks that are organized by root tasks"
    bug: "410745462"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+1 −3
Original line number Diff line number Diff line
@@ -1521,9 +1521,7 @@ final class ActivityRecord extends WindowToken {
            // First time we are adding the activity to the system.
            mVoiceInteraction = newTask.voiceSession != null;

            // TODO(b/36505427): Maybe this call should be moved inside
            // updateOverrideConfiguration()
            newTask.updateOverrideConfigurationFromLaunchBounds();
            newTask.setInitialBoundsIfNeeded();
            // When an activity is started directly into a split-screen fullscreen root task, we
            // need to update the initial multi-window modes so that the callbacks are scheduled
            // correctly when the user leaves that mode.
+17 −5
Original line number Diff line number Diff line
@@ -1188,10 +1188,7 @@ class Task extends TaskFragment {

        // First time we are adding the task to the system.
        if (oldParent == null && newParent != null) {

            // TODO: Super random place to be doing this, but aligns with what used to be done
            // before we unified Task level. Look into if this can be done in a better place.
            updateOverrideConfigurationFromLaunchBounds();
            setInitialBoundsIfNeeded();
        }

        mRootWindowContainer.updateUIDsPresentOnDisplay();
@@ -2402,7 +2399,22 @@ class Task extends TaskFragment {
        mTaskSupervisor.mLaunchParamsPersister.saveTask(this, display);
    }

    void updateOverrideConfigurationFromLaunchBounds() {
    /**
     * Called when the Task is newly added to the hierarchy. Updates the Task bounds from the
     * persist task bounds if needed.
     */
    void setInitialBoundsIfNeeded() {
        if (!com.android.window.flags.Flags.respectLeafTaskBounds()) {
            updateOverrideConfigurationFromLaunchBounds();
        } else if (persistTaskBounds(getWindowConfiguration())
                && getRequestedOverrideBounds().isEmpty()) {
            // Sets the Task bounds to the non-fullscreen bounds persisted last time if the Task
            // has no override bounds set.
            setBounds(mLastNonFullscreenBounds);
        }
    }

    private void updateOverrideConfigurationFromLaunchBounds() {
        final Task rootTask = getRootTask();
        final boolean hasParentTask = rootTask != this;
        final int windowingMode = getWindowingMode();