[DO NOT MERGE] ActivityEmbedding: hide embedded TaskFragment between

adjacent TFs

An old secondary TaskFragment can be in middle of the primary and new
secondary TaskFragments. We don't want to show it even if it has a
different bounds from the new secondary.

Fix: 215467839
Test: atest SplitActivityLifecycleTest
Change-Id: I85dccdc4a931eda7d53c91d288ad19b6ef865dc9
This commit is contained in:
Chris Li
2022-02-09 15:35:10 +08:00
parent 5cbb4d7d27
commit 906689084a

View File

@@ -822,11 +822,17 @@ class TaskFragment extends WindowContainer<WindowContainer> {
if (!adjacentTaskFragments.isEmpty() && !gotTranslucentAdjacent) {
// The z-order of this TaskFragment is in middle of two adjacent TaskFragments
// and it cannot be visible if the TaskFragment on top is not translucent and
// is fully occluding this one.
// is occluding this one.
mTmpRect.set(getBounds());
for (int j = adjacentTaskFragments.size() - 1; j >= 0; --j) {
final TaskFragment taskFragment = adjacentTaskFragments.get(j);
if (!taskFragment.isTranslucent(starting)
&& taskFragment.getBounds().contains(this.getBounds())) {
final TaskFragment adjacentTaskFragment =
taskFragment.mAdjacentTaskFragment;
if (adjacentTaskFragment == this) {
continue;
}
if (mTmpRect.intersect(taskFragment.getBounds())
|| mTmpRect.intersect(adjacentTaskFragment.getBounds())) {
return TASK_FRAGMENT_VISIBILITY_INVISIBLE;
}
}