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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user