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

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

Updates containers if the updates skipped when Task was invisible

The activity in the secondary container was removed and the
primary container was not updated because the the Task was
invisible. The next time the Task was brought to front, the
primary container still not being updated, e.g. expands the
primary container or starts placeholder on the secondary
container, because the Task was not resized (commit 1c8fcaa8).

Bug: 344721335
Test: wm presubmit
Test: repo steps on the bug
Flag: com.android.window.flags.fix_no_container_update_without_resize
Change-Id: I0165df4ef65bd08e6f53b4323816dc8dcfa4e75a
parent c92aa737
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -191,3 +191,14 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "windowing_sdk"
    name: "fix_no_container_update_without_resize"
    description: "Fix the containers not being updated when the Task is brought to front and has the same configuration"
    bug: "344721335"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+10 −1
Original line number Diff line number Diff line
@@ -899,14 +899,23 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
    @GuardedBy("mLock")
    void updateContainersInTaskIfVisible(@NonNull WindowContainerTransaction wct, int taskId) {
        final TaskContainer taskContainer = getTaskContainer(taskId);
        if (taskContainer != null && taskContainer.isVisible()) {
        if (taskContainer == null) {
            return;
        }

        if (taskContainer.isVisible()) {
            updateContainersInTask(wct, taskContainer);
        } else if (Flags.fixNoContainerUpdateWithoutResize()) {
            // the TaskFragmentContainers need to be updated when the task becomes visible
            taskContainer.mTaskFragmentContainersNeedsUpdate = true;
        }
    }

    @GuardedBy("mLock")
    private void updateContainersInTask(@NonNull WindowContainerTransaction wct,
            @NonNull TaskContainer taskContainer) {
        taskContainer.mTaskFragmentContainersNeedsUpdate = false;

        // Update all TaskFragments in the Task. Make a copy of the list since some may be
        // removed on updating.
        final List<TaskFragmentContainer> containers = taskContainer.getTaskFragmentContainers();
+8 −1
Original line number Diff line number Diff line
@@ -107,6 +107,12 @@ class TaskContainer {
     */
    private boolean mPlaceholderRuleSuppressed;

    /**
     * {@code true} if the TaskFragments in this Task needs to be updated next time the Task
     * becomes visible. See {@link #shouldUpdateContainer(TaskFragmentParentInfo)}
     */
    boolean mTaskFragmentContainersNeedsUpdate;

    /**
     * The {@link TaskContainer} constructor
     *
@@ -185,7 +191,8 @@ class TaskContainer {

        // If the task properties equals regardless of starting position, don't
        // need to update the container.
        return mInfo.getConfiguration().diffPublicOnly(configuration) != 0
        return mTaskFragmentContainersNeedsUpdate
                || mInfo.getConfiguration().diffPublicOnly(configuration) != 0
                || mInfo.getDisplayId() != info.getDisplayId();
    }