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

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

Fixing activity visibility when occluded by translucent TaskFragment

An activity should remain visible while behind a translucent
TaskFragment even the TaskFragment has the same bounds
as the parent container.

Bug: 223723911
Test: atest TaskFragmentTest
Change-Id: Ie19a0c524429d8c1e8e477e653752ba1e3800891
parent 9675d3b8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -108,8 +108,11 @@ class EnsureActivitiesVisibleHelper {
                    && childTaskFragment.getTopNonFinishingActivity() != null) {
                childTaskFragment.updateActivityVisibilities(starting, configChanges,
                        preserveWindows, notifyClients);
                // The TaskFragment should fully occlude the activities below if the bounds
                // equals to its parent task, unless it is translucent.
                mBehindFullyOccludedContainer |=
                        childTaskFragment.getBounds().equals(mTaskFragment.getBounds());
                        (childTaskFragment.getBounds().equals(mTaskFragment.getBounds())
                                && !childTaskFragment.isTranslucent(starting));
                if (mAboveTop && mTop.getTaskFragment() == childTaskFragment) {
                    mAboveTop = false;
                }
+21 −0
Original line number Diff line number Diff line
@@ -149,4 +149,25 @@ public class TaskFragmentTest extends WindowTestsBase {
        assertEquals(false, info.isEmpty());
        assertEquals(activity.token, info.getActivities().get(0));
    }

    @Test
    public void testActivityVisibilityBehindTranslucentTaskFragment() {
        // Having an activity covered by a translucent TaskFragment:
        // Task
        //   - TaskFragment
        //      - Activity (Translucent)
        //   - Activity
        ActivityRecord translucentActivity = new ActivityBuilder(mAtm)
                .setUid(DEFAULT_TASK_FRAGMENT_ORGANIZER_UID).build();
        mTaskFragment.addChild(translucentActivity);
        doReturn(true).when(mTaskFragment).isTranslucent(any());

        ActivityRecord activityBelow = new ActivityBuilder(mAtm).build();
        mTaskFragment.getTask().addChild(activityBelow, 0);

        // Ensure the activity below is visible
        mTaskFragment.getTask().ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
                false /* preserveWindows */);
        assertEquals(true, activityBelow.isVisibleRequested());
    }
}