Prevent ZBoost of TaskDisplayArea

Before, when an activity needs z boost, the whole TDA is moved above
other windows of ABOVE_TASKS. Now, we don't move TDA anymore.

Fix: 149651594
Test: manual: open app and expand notification before app fully start,
the app no longer moves above notification.
Test: atest WmTests:TaskDisplayAreaTests#testActivityWithZBoost_TaskDisplayAreaDoesNotMovedUp

Change-Id: Ie1eae7a5566fc8988cd3ca9f4a56332743facf52
This commit is contained in:
Chris Li
2020-05-20 16:21:42 -07:00
parent f13d436c2e
commit ae1617f9fc
2 changed files with 28 additions and 0 deletions

View File

@@ -106,6 +106,12 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
}
}
@Override
boolean needsZBoost() {
// Z Boost should only happen at or below the ActivityStack level.
return false;
}
@Override
boolean fillsParent() {
return true;

View File

@@ -40,6 +40,9 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import android.platform.test.annotations.Presubmit;
@@ -81,6 +84,25 @@ public class TaskDisplayAreaTests extends WindowTestsBase {
mPinnedStack.removeImmediately();
}
@Test
public void testActivityWithZBoost_taskDisplayAreaDoesNotMoveUp() {
final ActivityStack stack = createTaskStackOnDisplay(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, mDisplayContent);
final Task task = createTaskInStack(stack, 0 /* userId */);
final ActivityRecord activity = WindowTestUtils.createTestActivityRecord(mDisplayContent);
task.addChild(activity, 0 /* addPos */);
final TaskDisplayArea taskDisplayArea = activity.getDisplayArea();
activity.mNeedsAnimationBoundsLayer = true;
activity.mNeedsZBoost = true;
spyOn(taskDisplayArea.mSurfaceAnimator);
mDisplayContent.assignChildLayers(mTransaction);
assertThat(activity.needsZBoost()).isTrue();
assertThat(taskDisplayArea.needsZBoost()).isFalse();
verify(taskDisplayArea.mSurfaceAnimator, never()).setLayer(eq(mTransaction), anyInt());
}
@Test
public void testStackPositionChildAt() {
// Test that always-on-top stack can't be moved to position other than top.