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

Commit ce44271a authored by Graciela Putri's avatar Graciela Putri
Browse files

Update leaf freeform task description

Task#convertActivityTo/FromTranslucent() will traverse parent to update
task description, so update direct parent task of activity to ensure
caption bar gets updated task description.

Flag: EXEMPT bug fix
Fix: 441125980
Test: atest ActivityTaskSupervisorTests
Change-Id: I266abd5f0b6d83f9facd179f9af7d774461ff28a
parent 5230bd5d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3065,9 +3065,9 @@ final class ActivityRecord extends WindowToken {

        if (changed && task != null) {
            if (!occludesParent) {
                getRootTask().convertActivityToTranslucent(this);
                task.convertActivityToTranslucent(this);
            } else {
                getRootTask().convertActivityFromTranslucent(this);
                task.convertActivityFromTranslucent(this);
            }
        }
        // Always ensure visibility if this activity doesn't occlude parent, so the
+19 −0
Original line number Diff line number Diff line
@@ -652,6 +652,25 @@ public class ActivityTaskSupervisorTests extends WindowTestsBase {
        assertThat(mSupervisor.mOpaqueContainerHelper.isOpaque(nonLeafTask)).isFalse();
    }

    @Test
    public void testOpaque_leafTaskUpdated() {
        final Task rootTask = new TaskBuilder(mSupervisor).setCreatedByOrganizer(true).build();
        final TaskFragment opaqueTask = createChildTaskFragment(rootTask,
                WINDOWING_MODE_FREEFORM, /* opaque */ true, /* filling */ true);
        final Task childTask = new TaskBuilder(mSupervisor).setParentTask(rootTask).build();
        final ActivityRecord directChildActivity = new ActivityBuilder(mAtm).setTask(childTask)
                .build();

        directChildActivity.setOccludesParent(false);

        assertThat(mSupervisor.mOpaqueContainerHelper.isOpaque(childTask)).isFalse();
        assertThat(mSupervisor.mOpaqueContainerHelper.isOpaque(opaqueTask)).isTrue();

        directChildActivity.setOccludesParent(true);

        assertThat(mSupervisor.mOpaqueContainerHelper.isOpaque(childTask)).isTrue();
    }

    @NonNull
    private TaskFragment createChildTaskFragment(@NonNull Task parent,
            @WindowConfiguration.WindowingMode int windowingMode,