Merge "Prevent ZBoost of TaskDisplayArea" into rvc-dev

This commit is contained in:
Chris Li
2020-05-21 18:20:20 +00:00
committed by Android (Google) Code Review
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.