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

Commit e853883b authored by Louis Chang's avatar Louis Chang
Browse files

Respect the override bounds of the leaf tasks

- #updateOverrideConfigurationFromLaunchBounds ensures the leaf task
  inherits the Task bounds from its organized parent Task, but it is
  called only when a Task (or an Activity) is initially added to the
  WM hierarchy. This is not making sense from policy pov because the
  leaf Task bound can still be updated after the Task is added to the
  hierarchy.
- The design was originally added in commit 06107a36, which was to
  fix a split-screen divider issue back in the day. The split-screen
  design has changed a lot since then and the split-screen still
  works fine after this clean-up.
- We’re seeing more multitasking features toward having an organized
  root task design, and have encountered similar issues that the
  requested launching bounds are not respected.

Bug: 410745462
Test: atest RootTaskTests#testGetVisibility_MultiLevel
Test: atest
MultiWindowTests#testVisibilityWithTranslucentAndTopFinishingActivity
Test: atest
ActivityLifecycleTopResumedStateTests#testTopPositionSwitchOnTap
Test: atest ActivityLifecycleLegacySplitScreenTests
Test: drag divider in split
Flag: com.android.window.flags.respect_leaf_task_bounds

Change-Id: I6462ca0460aa36d6d8d160ba8b8fecf8259d1b1f
parent b83c5a99
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();