Merge ActivityDisplay and DisplayContent into one class (77/n)
Bug: 80414790
Test: Existing tests pass
Change-Id: I1924af0d353406ad950b9758e19384a579ad1426
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
index 5928641..9c17de9 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityDisplayTests.java
@@ -47,7 +47,7 @@
import org.junit.runner.RunWith;
/**
- * Tests for the {@link ActivityDisplay} class.
+ * Tests for the {@link DisplayContent} class.
*
* Build/Install/Run:
* atest WmTests:ActivityDisplayTests
@@ -55,12 +55,13 @@
@SmallTest
@Presubmit
@RunWith(WindowTestRunner.class)
+// TODO(b/144248496): Merge to DisplayContentTests
public class ActivityDisplayTests extends ActivityTestsBase {
@Test
public void testLastFocusedStackIsUpdatedWhenMovingStack() {
// Create a stack at bottom.
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final ActivityStack stack =
new StackBuilder(mRootActivityContainer).setOnTop(!ON_TOP).build();
final ActivityStack prevFocusedStack = display.getFocusedStack();
@@ -103,13 +104,13 @@
}
/**
- * Test {@link ActivityDisplay#mPreferredTopFocusableStack} will be cleared when the stack is
+ * Test {@link DisplayContent#mPreferredTopFocusableStack} will be cleared when the stack is
* removed or moved to back, and the focused stack will be according to z-order.
*/
@Test
public void testStackShouldNotBeFocusedAfterMovingToBackOrRemoving() {
// Create a display which only contains 2 stacks.
- final ActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
+ final DisplayContent display = addNewDisplayContentAt(DisplayContent.POSITION_TOP);
final ActivityStack stack1 = createFullscreenStackWithSimpleActivityAt(display);
final ActivityStack stack2 = createFullscreenStackWithSimpleActivityAt(display);
@@ -128,13 +129,13 @@
}
/**
- * Verifies {@link ActivityDisplay#remove} should not resume home stack on the removing display.
+ * Verifies {@link DisplayContent#remove} should not resume home stack on the removing display.
*/
@Test
public void testNotResumeHomeStackOnRemovingDisplay() {
// Create a display which supports system decoration and allows reparenting stacks to
// another display when the display is removed.
- final ActivityDisplay display = new TestActivityDisplay.Builder(
+ final DisplayContent display = new TestDisplayContent.Builder(
mService, 1000, 1500).setSystemDecorations(true).build();
doReturn(false).when(display).shouldDestroyContentOnRemove();
@@ -154,7 +155,7 @@
verify(homeStack, never()).resumeTopActivityUncheckedLocked(any(), any());
}
- private ActivityStack createFullscreenStackWithSimpleActivityAt(ActivityDisplay display) {
+ private ActivityStack createFullscreenStackWithSimpleActivityAt(DisplayContent display) {
final ActivityStack fullscreenStack = display.createStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, ON_TOP);
final Task fullscreenTask = new TaskBuilder(mService.mStackSupervisor)
@@ -168,7 +169,7 @@
*/
@Test
public void testTopRunningActivity() {
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final KeyguardController keyguard = mSupervisor.getKeyguardController();
final ActivityStack stack = new StackBuilder(mRootActivityContainer).build();
final ActivityRecord activity = stack.getTopNonFinishingActivity();
@@ -208,7 +209,7 @@
assertTopRunningActivity(showWhenLockedActivity, display);
}
- private static void assertTopRunningActivity(ActivityRecord top, ActivityDisplay display) {
+ private static void assertTopRunningActivity(ActivityRecord top, DisplayContent display) {
assertEquals(top, display.topRunningActivity());
assertEquals(top, display.topRunningActivity(true /* considerKeyguardState */));
}
@@ -218,7 +219,7 @@
*/
@Test
public void testAlwaysOnTopStackLocation() {
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final ActivityStack alwaysOnTopStack = display.createStack(WINDOWING_MODE_FREEFORM,
ACTIVITY_TYPE_STANDARD, true /* onTop */);
final ActivityRecord activity = new ActivityBuilder(mService).setCreateTask(true)
@@ -283,7 +284,7 @@
}
private void removeStackTests(Runnable runnable) {
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final ActivityStack stack1 = display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, ON_TOP);
final ActivityStack stack2 = display.createStack(WINDOWING_MODE_FULLSCREEN,
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
index 7a449b3..89723d1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -635,8 +635,8 @@
final ActivityStack stack1 = new StackBuilder(mRootActivityContainer).build();
mStack.moveToFront("test");
// The stack2 is needed here for moving back to simulate the
- // {@link ActivityDisplay#mPreferredTopFocusableStack} is cleared, so
- // {@link ActivityDisplay#getFocusedStack} will rely on the order of focusable-and-visible
+ // {@link DisplayContent#mPreferredTopFocusableStack} is cleared, so
+ // {@link DisplayContent#getFocusedStack} will rely on the order of focusable-and-visible
// stacks. Then when mActivity is finishing, its stack will be invisible (no running
// activities in the stack) that is the key condition to verify.
final ActivityStack stack2 = new StackBuilder(mRootActivityContainer).build();
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java
index 0219539..530adb5 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStackSupervisorTests.java
@@ -112,7 +112,7 @@
@Test
public void testHandleNonResizableTaskOnSecondaryDisplay() {
// Create an unresizable task on secondary display.
- final ActivityDisplay newDisplay = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
+ final DisplayContent newDisplay = addNewDisplayContentAt(DisplayContent.POSITION_TOP);
final ActivityStack stack = new StackBuilder(mRootActivityContainer)
.setDisplay(newDisplay).build();
final ActivityRecord unresizableActivity = stack.getTopNonFinishingActivity();
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
index 47f454e..8a1a10d 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java
@@ -54,7 +54,6 @@
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 android.content.ComponentName;
@@ -78,7 +77,7 @@
@Presubmit
@RunWith(WindowTestRunner.class)
public class ActivityStackTests extends ActivityTestsBase {
- private ActivityDisplay mDefaultDisplay;
+ private DisplayContent mDefaultDisplay;
private ActivityStack mStack;
private Task mTask;
@@ -279,7 +278,7 @@
@Test
public void testMoveStackToBackIncludingParent() {
- final ActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
+ final DisplayContent display = addNewDisplayContentAt(DisplayContent.POSITION_TOP);
final ActivityStack stack1 = createStackForShouldBeVisibleTest(display,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
final ActivityStack stack2 = createStackForShouldBeVisibleTest(display,
@@ -815,7 +814,7 @@
@SuppressWarnings("TypeParameterUnusedInFormals")
private ActivityStack createStackForShouldBeVisibleTest(
- ActivityDisplay display, int windowingMode, int activityType, boolean onTop) {
+ DisplayContent display, int windowingMode, int activityType, boolean onTop) {
final ActivityStack stack;
if (activityType == ACTIVITY_TYPE_HOME) {
// Home stack and activity are created in ActivityTestsBase#setupActivityManagerService
@@ -998,7 +997,7 @@
@Test
public void testFinishCurrentActivity() {
// Create 2 activities on a new display.
- final ActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
+ final DisplayContent display = addNewDisplayContentAt(DisplayContent.POSITION_TOP);
final ActivityStack stack1 = createStackForShouldBeVisibleTest(display,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
final ActivityStack stack2 = createStackForShouldBeVisibleTest(display,
@@ -1065,6 +1064,7 @@
StackOrderChangedListener listener = new StackOrderChangedListener();
mDefaultDisplay.registerStackOrderChangedListener(listener);
try {
+ mStack.mReparenting = true;
mDefaultDisplay.addStack(mStack, 0);
} finally {
mDefaultDisplay.unregisterStackOrderChangedListener(listener);
@@ -1156,10 +1156,10 @@
private void verifyShouldSleepActivities(boolean focusedStack,
boolean keyguardGoingAway, boolean displaySleeping, boolean expected) {
- final ActivityDisplay display = mock(ActivityDisplay.class);
+ final DisplayContent display = mock(DisplayContent.class);
final KeyguardController keyguardController = mSupervisor.getKeyguardController();
- doReturn(display).when(mRootActivityContainer).getActivityDisplay(anyInt());
+ doReturn(display).when(mStack).getDisplay();
doReturn(keyguardGoingAway).when(keyguardController).isKeyguardGoingAway();
doReturn(displaySleeping).when(display).isSleeping();
doReturn(focusedStack).when(mStack).isFocusedStackOnDisplay();
@@ -1168,7 +1168,7 @@
}
private static class StackOrderChangedListener
- implements ActivityDisplay.OnStackOrderChangedListener {
+ implements DisplayContent.OnStackOrderChangedListener {
public boolean mChanged = false;
@Override
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
index 018c10a..7e22dfc 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java
@@ -47,9 +47,9 @@
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
-import static com.android.server.wm.ActivityDisplay.POSITION_BOTTOM;
-import static com.android.server.wm.ActivityDisplay.POSITION_TOP;
import static com.android.server.wm.ActivityTaskManagerService.ANIMATE;
+import static com.android.server.wm.WindowContainer.POSITION_BOTTOM;
+import static com.android.server.wm.WindowContainer.POSITION_TOP;
import static com.google.common.truth.Truth.assertThat;
@@ -502,7 +502,7 @@
*/
@Test
public void testTaskModeViolation() {
- final ActivityDisplay display = mService.mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mService.mRootActivityContainer.getDefaultDisplay();
display.removeAllTasks();
assertNoTasks(display);
@@ -517,7 +517,7 @@
assertNoTasks(display);
}
- private void assertNoTasks(ActivityDisplay display) {
+ private void assertNoTasks(DisplayContent display) {
for (int i = display.getStackCount() - 1; i >= 0; --i) {
final ActivityStack stack = display.getStackAt(i);
assertFalse(stack.hasChild());
@@ -761,8 +761,8 @@
false /* mockGetLaunchStack */);
// Create a secondary display at bottom.
- final TestActivityDisplay secondaryDisplay =
- new TestActivityDisplay.Builder(mService, 1000, 1500)
+ final TestDisplayContent secondaryDisplay =
+ new TestDisplayContent.Builder(mService, 1000, 1500)
.setPosition(POSITION_BOTTOM).build();
final ActivityStack stack = secondaryDisplay.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, true /* onTop */);
@@ -800,8 +800,8 @@
false /* mockGetLaunchStack */);
// Create a secondary display with an activity.
- final TestActivityDisplay secondaryDisplay =
- new TestActivityDisplay.Builder(mService, 1000, 1500).build();
+ final TestDisplayContent secondaryDisplay =
+ new TestDisplayContent.Builder(mService, 1000, 1500).build();
mRootActivityContainer.addChild(secondaryDisplay, POSITION_TOP);
final ActivityRecord singleTaskActivity = createSingleTaskActivityOn(
secondaryDisplay.createStack(WINDOWING_MODE_FULLSCREEN,
@@ -853,7 +853,7 @@
false /* mockGetLaunchStack */);
// Create a secondary display at bottom.
- final TestActivityDisplay secondaryDisplay = addNewActivityDisplayAt(POSITION_BOTTOM);
+ final TestDisplayContent secondaryDisplay = addNewDisplayContentAt(POSITION_BOTTOM);
secondaryDisplay.createStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD,
true /* onTop */);
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
index 07b7cf4..591ed51 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java
@@ -126,7 +126,7 @@
assertEquals(0, removed.size());
added.clear();
// Check adding a display
- ActivityDisplay newDisp1 = new TestActivityDisplay.Builder(mService, 600, 800).build();
+ DisplayContent newDisp1 = new TestDisplayContent.Builder(mService, 600, 800).build();
assertEquals(1, added.size());
assertEquals(0, changed.size());
assertEquals(0, removed.size());
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
index 0021cc5..b72cc94 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
@@ -77,9 +77,9 @@
mRootActivityContainer = mService.mRootActivityContainer;
}
- /** Creates and adds a {@link TestActivityDisplay} to supervisor at the given position. */
- TestActivityDisplay addNewActivityDisplayAt(int position) {
- return new TestActivityDisplay.Builder(mService, 1000, 1500).setPosition(position).build();
+ /** Creates and adds a {@link TestDisplayContent} to supervisor at the given position. */
+ TestDisplayContent addNewDisplayContentAt(int position) {
+ return new TestDisplayContent.Builder(mService, 1000, 1500).setPosition(position).build();
}
/** Sets the default minimum task size to 1 so that tests can use small task sizes */
@@ -381,7 +381,7 @@
static class StackBuilder {
private final RootActivityContainer mRootActivityContainer;
- private ActivityDisplay mDisplay;
+ private DisplayContent mDisplay;
private int mStackId = -1;
private int mWindowingMode = WINDOWING_MODE_UNDEFINED;
private int mActivityType = ACTIVITY_TYPE_STANDARD;
@@ -408,15 +408,8 @@
return this;
}
- // TODO(display-merge): Remove
- StackBuilder setDisplay(ActivityDisplay display) {
- mDisplay = display;
- return this;
- }
-
StackBuilder setDisplay(DisplayContent display) {
- // TODO(display-merge): Remove cast
- mDisplay = (ActivityDisplay) display;
+ mDisplay = display;
return this;
}
@@ -449,7 +442,7 @@
if (mOnTop) {
// We move the task to front again in order to regain focus after activity
// added to the stack.
- // Or {@link ActivityDisplay#mPreferredTopFocusableStack} could be other
+ // Or {@link DisplayContent#mPreferredTopFocusableStack} could be other
// stacks (e.g. home stack).
stack.moveToFront("createActivityStack");
} else {
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
index 6f1e6df..0c7fad4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
@@ -181,7 +181,7 @@
@Test
public void testLandscapeSeascapeRotationByPolicy() {
- // This instance has been spied in {@link TestActivityDisplay}.
+ // This instance has been spied in {@link TestDisplayContent}.
final DisplayRotation displayRotation = mDisplayContent.getDisplayRotation();
final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
index 14c09eb..ccbafd4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
@@ -768,9 +768,8 @@
activity.setRequestedOrientation(newOrientation);
- // TODO(display-merge): Remove cast
- verify((ActivityDisplay) dc, never()).updateDisplayOverrideConfigurationLocked(any(),
- eq(activity), anyBoolean(), same(null));
+ verify(dc, never()).updateDisplayOverrideConfigurationLocked(any(), eq(activity),
+ anyBoolean(), same(null));
assertEquals(dc.getDisplayRotation().getUserRotation(), dc.getRotation());
}
@@ -964,7 +963,7 @@
invocation -> {
continued[0] = true;
return true;
- }).when((ActivityDisplay) dc).updateDisplayOverrideConfigurationLocked();
+ }).when(dc).updateDisplayOverrideConfigurationLocked();
final boolean[] called = new boolean[1];
mWm.mDisplayRotationController =
new IDisplayWindowRotationController.Stub() {
diff --git a/services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java b/services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java
index 9e5d9da..84914bb 100644
--- a/services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/LaunchParamsPersisterTests.java
@@ -80,7 +80,7 @@
private TestPersisterQueue mPersisterQueue;
private File mFolder;
- private ActivityDisplay mTestDisplay;
+ private DisplayContent mTestDisplay;
private String mDisplayUniqueId;
private Task mTestTask;
private Task mTaskWithDifferentUser;
@@ -104,9 +104,9 @@
deleteRecursively(mFolder);
mDisplayUniqueId = "test:" + Integer.toString(sNextUniqueId++);
- mTestDisplay = new TestActivityDisplay.Builder(mService, 1000, 1500)
+ mTestDisplay = new TestDisplayContent.Builder(mService, 1000, 1500)
.setUniqueId(mDisplayUniqueId).build();
- when(mRootActivityContainer.getActivityDisplay(eq(mDisplayUniqueId)))
+ when(mRootActivityContainer.getDisplayContent(eq(mDisplayUniqueId)))
.thenReturn(mTestDisplay);
ActivityStack stack = mTestDisplay.createStack(TEST_WINDOWING_MODE,
@@ -180,7 +180,7 @@
public void testReturnsEmptyDisplayIfDisplayIsNotFound() {
mTarget.saveTask(mTestTask);
- when(mRootActivityContainer.getActivityDisplay(eq(mDisplayUniqueId))).thenReturn(null);
+ when(mRootActivityContainer.getDisplayContent(eq(mDisplayUniqueId))).thenReturn(null);
mTarget.getLaunchParams(mTestTask, null, mResult);
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
index 09d7b54..eaf4aa3 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java
@@ -102,7 +102,7 @@
UserManager.USER_TYPE_PROFILE_MANAGED);
private static final int INVALID_STACK_ID = 999;
- private ActivityDisplay mDisplay;
+ private DisplayContent mDisplay;
private ActivityStack mStack;
private TestTaskPersister mTaskPersister;
private TestRecentTasks mRecentTasks;
@@ -117,7 +117,7 @@
public void setUp() throws Exception {
mTaskPersister = new TestTaskPersister(mContext.getFilesDir());
spyOn(mTaskPersister);
- mDisplay = mRootActivityContainer.getActivityDisplay(DEFAULT_DISPLAY);
+ mDisplay = mRootActivityContainer.getDisplayContent(DEFAULT_DISPLAY);
// Set the recent tasks we should use for testing in this class.
mRecentTasks = new TestRecentTasks(mService, mTaskPersister);
@@ -653,8 +653,8 @@
mRecentTasks.setOnlyTestVisibleRange();
mRecentTasks.setParameters(-1 /* min */, 3 /* max */, -1 /* ms */);
- final ActivityDisplay singleTaskDisplay =
- addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
+ final DisplayContent singleTaskDisplay =
+ addNewDisplayContentAt(DisplayContent.POSITION_TOP);
singleTaskDisplay.setDisplayToSingleTaskInstance();
ActivityStack singleTaskStack = singleTaskDisplay.createStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
@@ -833,7 +833,7 @@
mRecentTasks.setParameters(-1 /* min */, 1 /* max */, -1 /* ms */);
final ActivityStack homeStack = mDisplay.getHomeStack();
- final ActivityDisplay otherDisplay = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
+ final DisplayContent otherDisplay = addNewDisplayContentAt(DisplayContent.POSITION_TOP);
final ActivityStack otherDisplayStack = otherDisplay.createStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
index 2374847..945928d 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
@@ -138,8 +138,7 @@
@Test
public void testIncludedApps_expectTargetAndVisible() {
mWm.setRecentsAnimationController(mController);
- // TODO(display-merge): Remove cast
- final ActivityStack homeStack = ((ActivityDisplay) mDisplayContent).getOrCreateStack(
+ final ActivityStack homeStack = mDisplayContent.getOrCreateStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, ON_TOP);
final ActivityRecord homeActivity =
new ActivityTestsBase.ActivityBuilder(mWm.mAtmService)
@@ -164,8 +163,7 @@
@Test
public void testWallpaperIncluded_expectTarget() throws Exception {
mWm.setRecentsAnimationController(mController);
- // TODO(display-merge): Remove cast
- final ActivityStack homeStack = ((ActivityDisplay) mDisplayContent).getOrCreateStack(
+ final ActivityStack homeStack = mDisplayContent.getOrCreateStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, ON_TOP);
final ActivityRecord homeAppWindow =
new ActivityTestsBase.ActivityBuilder(mWm.mAtmService)
@@ -194,8 +192,7 @@
@Test
public void testWallpaperAnimatorCanceled_expectAnimationKeepsRunning() throws Exception {
mWm.setRecentsAnimationController(mController);
- // TODO(display-merge): Remove cast
- final ActivityStack homeStack = ((ActivityDisplay) mDisplayContent).getOrCreateStack(
+ final ActivityStack homeStack = mDisplayContent.getOrCreateStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, ON_TOP);
final ActivityRecord homeActivity =
new ActivityTestsBase.ActivityBuilder(mWm.mAtmService)
@@ -226,8 +223,7 @@
@Test
public void testFinish_expectTargetAndWallpaperAdaptersRemoved() {
mWm.setRecentsAnimationController(mController);
- // TODO(display-merge): Remove cast
- final ActivityStack homeStack = ((ActivityDisplay) mDisplayContent).getOrCreateStack(
+ final ActivityStack homeStack = mDisplayContent.getOrCreateStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, ON_TOP);
final ActivityRecord homeActivity =
new ActivityTestsBase.ActivityBuilder(mWm.mAtmService)
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
index 8fbb16c..07be3e4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java
@@ -88,7 +88,7 @@
@Test
public void testRecentsActivityVisiblility() {
- ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mRootActivityContainer.getDefaultDisplay();
ActivityStack recentsStack = display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_RECENTS, true /* onTop */);
ActivityRecord recentActivity = new ActivityBuilder(mService)
@@ -116,7 +116,7 @@
@Test
public void testPreloadRecentsActivity() {
- final ActivityDisplay defaultDisplay = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent defaultDisplay = mRootActivityContainer.getDefaultDisplay();
final ActivityStack homeStack =
defaultDisplay.getStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME);
defaultDisplay.positionStackAtTop(homeStack, false /* includingParents */);
@@ -149,7 +149,7 @@
mService.startRecentsActivity(recentsIntent, null /* assistDataReceiver */,
null /* recentsAnimationRunner */);
- ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mRootActivityContainer.getDefaultDisplay();
ActivityStack recentsStack = display.getStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_RECENTS);
assertThat(recentsStack).isNotNull();
@@ -178,7 +178,7 @@
@Test
public void testRestartRecentsActivity() throws Exception {
// Have a recents activity that is not attached to its process (ActivityRecord.app = null).
- ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mRootActivityContainer.getDefaultDisplay();
ActivityStack recentsStack = display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_RECENTS, true /* onTop */);
ActivityRecord recentActivity = new ActivityBuilder(mService).setComponent(
@@ -207,7 +207,7 @@
@Test
public void testSetLaunchTaskBehindOfTargetActivity() {
- ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mRootActivityContainer.getDefaultDisplay();
display.mDisplayContent.mBoundsAnimationController = mock(BoundsAnimationController.class);
ActivityStack homeStack = display.getHomeStack();
// Assume the home activity support recents.
@@ -253,7 +253,7 @@
@Test
public void testCancelAnimationOnVisibleStackOrderChange() {
- ActivityDisplay display = mService.mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mService.mRootActivityContainer.getDefaultDisplay();
display.mDisplayContent.mBoundsAnimationController = mock(BoundsAnimationController.class);
ActivityStack fullscreenStack = display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, true /* onTop */);
@@ -299,7 +299,7 @@
@Test
public void testKeepAnimationOnHiddenStackOrderChange() {
- ActivityDisplay display = mService.mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mService.mRootActivityContainer.getDefaultDisplay();
ActivityStack fullscreenStack = display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, true /* onTop */);
new ActivityBuilder(mService)
@@ -335,7 +335,7 @@
@Test
public void testMultipleUserHomeActivity_findUserHomeTask() {
- ActivityDisplay display = mService.mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mService.mRootActivityContainer.getDefaultDisplay();
ActivityStack homeStack = display.getStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_HOME);
ActivityRecord otherUserHomeActivity = new ActivityBuilder(mService)
.setStack(homeStack)
diff --git a/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java
index 5417ade..2d45a59 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RootActivityContainerTests.java
@@ -128,7 +128,7 @@
mRootActivityContainer.moveActivityToPinnedStack(firstActivity, sourceBounds,
0f /*aspectRatio*/, "initialMove");
- final ActivityDisplay display = mFullscreenStack.getDisplay();
+ final DisplayContent display = mFullscreenStack.getDisplay();
ActivityStack pinnedStack = display.getPinnedStack();
// Ensure a task has moved over.
ensureStackPlacement(pinnedStack, firstActivity);
@@ -166,7 +166,7 @@
@Test
public void testApplySleepTokens() {
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final KeyguardController keyguard = mSupervisor.getKeyguardController();
final ActivityStack stack = new StackBuilder(mRootActivityContainer)
.setCreateActivity(false)
@@ -202,7 +202,7 @@
false /* expectResumeTopActivity */);
}
- private void verifySleepTokenBehavior(ActivityDisplay display, KeyguardController keyguard,
+ private void verifySleepTokenBehavior(DisplayContent display, KeyguardController keyguard,
ActivityStack stack, boolean displaySleeping, boolean displayShouldSleep,
boolean isFocusedStack, boolean keyguardShowing, boolean expectWakeFromSleep,
boolean expectResumeTopActivity) {
@@ -225,7 +225,7 @@
*/
@Test
public void testRemovingStackOnAppCrash() {
- final ActivityDisplay defaultDisplay = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent defaultDisplay = mRootActivityContainer.getDefaultDisplay();
final int originalStackCount = defaultDisplay.getStackCount();
final ActivityStack stack = mRootActivityContainer.getDefaultDisplay().createStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, false /* onTop */);
@@ -336,7 +336,7 @@
@Test
public void testFindTaskToMoveToFrontWhenRecentsOnTop() {
// Create stack/task on default display.
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final ActivityStack targetStack = new StackBuilder(mRootActivityContainer)
.setOnTop(false)
.build();
@@ -360,14 +360,14 @@
@Test
public void testFindTaskToMoveToFrontWhenRecentsOnOtherDisplay() {
// Create stack/task on default display.
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final ActivityStack targetStack = display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, false /* onTop */);
final Task targetTask = new TaskBuilder(mSupervisor).setStack(targetStack).build();
// Create Recents on secondary display.
- final TestActivityDisplay secondDisplay = addNewActivityDisplayAt(
- ActivityDisplay.POSITION_TOP);
+ final TestDisplayContent secondDisplay = addNewDisplayContentAt(
+ DisplayContent.POSITION_TOP);
final ActivityStack stack = secondDisplay.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_RECENTS, true /* onTop */);
final Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
@@ -387,7 +387,7 @@
@Test
public void testResumeActivityWhenNonTopmostStackIsTopFocused() {
// Create a stack at bottom.
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final ActivityStack targetStack = spy(display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, false /* onTop */));
final Task task = new TaskBuilder(mSupervisor).setStack(targetStack).build();
@@ -415,8 +415,9 @@
@Test
public void testResumeFocusedStacksStartsHomeActivity_NoActivities() {
mFullscreenStack.removeIfPossible();
- mService.mRootActivityContainer.getActivityDisplay(DEFAULT_DISPLAY).getHomeStack().removeIfPossible();
- mService.mRootActivityContainer.getActivityDisplay(DEFAULT_DISPLAY)
+ mService.mRootActivityContainer.getDisplayContent(DEFAULT_DISPLAY).getHomeStack()
+ .removeIfPossible();
+ mService.mRootActivityContainer.getDisplayContent(DEFAULT_DISPLAY)
.createStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, ON_TOP);
doReturn(true).when(mRootActivityContainer).resumeHomeActivity(any(), any(), anyInt());
@@ -437,13 +438,14 @@
@Test
public void testResumeFocusedStacksStartsHomeActivity_ActivityOnSecondaryScreen() {
mFullscreenStack.removeIfPossible();
- mService.mRootActivityContainer.getActivityDisplay(DEFAULT_DISPLAY).getHomeStack().removeIfPossible();
- mService.mRootActivityContainer.getActivityDisplay(DEFAULT_DISPLAY)
+ mService.mRootActivityContainer.getDisplayContent(DEFAULT_DISPLAY).getHomeStack()
+ .removeIfPossible();
+ mService.mRootActivityContainer.getDisplayContent(DEFAULT_DISPLAY)
.createStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, ON_TOP);
// Create an activity on secondary display.
- final TestActivityDisplay secondDisplay = addNewActivityDisplayAt(
- ActivityDisplay.POSITION_TOP);
+ final TestDisplayContent secondDisplay = addNewDisplayContentAt(
+ DisplayContent.POSITION_TOP);
final ActivityStack stack = secondDisplay.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, true /* onTop */);
final Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
@@ -467,7 +469,7 @@
@Test
public void testResumeActivityLingeringTransition() {
// Create a stack at top.
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final ActivityStack targetStack = spy(display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, false /* onTop */));
final Task task = new TaskBuilder(mSupervisor).setStack(targetStack).build();
@@ -487,7 +489,7 @@
@Test
public void testResumeActivityLingeringTransition_notExecuted() {
// Create a stack at bottom.
- final ActivityDisplay display = mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mRootActivityContainer.getDefaultDisplay();
final ActivityStack targetStack = spy(display.createStack(WINDOWING_MODE_FULLSCREEN,
ACTIVITY_TYPE_STANDARD, false /* onTop */));
final Task task = new TaskBuilder(mSupervisor).setStack(targetStack).build();
@@ -515,8 +517,8 @@
mockResolveSecondaryHomeActivity();
// Create secondary displays.
- final TestActivityDisplay secondDisplay =
- new TestActivityDisplay.Builder(mService, 1000, 1500)
+ final TestDisplayContent secondDisplay =
+ new TestDisplayContent.Builder(mService, 1000, 1500)
.setSystemDecorations(true).build();
doReturn(true).when(mRootActivityContainer)
@@ -582,8 +584,8 @@
@Test
public void testStartSecondaryHomeOnDisplayWithUserKeyLocked() {
// Create secondary displays.
- final TestActivityDisplay secondDisplay =
- new TestActivityDisplay.Builder(mService, 1000, 1500)
+ final TestDisplayContent secondDisplay =
+ new TestDisplayContent.Builder(mService, 1000, 1500)
.setSystemDecorations(true).build();
// Use invalid user id to let StorageManager.isUserKeyUnlocked() return false.
@@ -608,8 +610,8 @@
@Test
public void testStartSecondaryHomeOnDisplayWithoutSysDecorations() {
// Create secondary displays.
- final TestActivityDisplay secondDisplay =
- new TestActivityDisplay.Builder(mService, 1000, 1500)
+ final TestDisplayContent secondDisplay =
+ new TestDisplayContent.Builder(mService, 1000, 1500)
.setSystemDecorations(false).build();
mRootActivityContainer.startHomeOnDisplay(0 /* userId */, "testStartSecondaryHome",
@@ -831,8 +833,8 @@
@Test
public void testGetLaunchStackWithRealCallerId() {
// Create a non-system owned virtual display.
- final TestActivityDisplay secondaryDisplay =
- new TestActivityDisplay.Builder(mService, 1000, 1500)
+ final TestDisplayContent secondaryDisplay =
+ new TestDisplayContent.Builder(mService, 1000, 1500)
.setType(TYPE_VIRTUAL).setOwnerUid(100).build();
// Create an activity with specify the original launch pid / uid.
diff --git a/services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java b/services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java
index 66f4d2a..b32cb8b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RunningTasksTest.java
@@ -57,9 +57,9 @@
@Test
public void testCollectTasksByLastActiveTime() {
// Create a number of stacks with tasks (of incrementing active time)
- final ArrayList<ActivityDisplay> displays = new ArrayList<>();
- final ActivityDisplay display =
- new TestActivityDisplay.Builder(mService, 1000, 2500).build();
+ final ArrayList<DisplayContent> displays = new ArrayList<>();
+ final DisplayContent display =
+ new TestDisplayContent.Builder(mService, 1000, 2500).build();
displays.add(display);
final int numStacks = 2;
diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
index 46f95ed..be0fd2b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
@@ -67,7 +67,7 @@
private Task mTask;
private ActivityRecord mActivity;
- private void setUpApp(ActivityDisplay display) {
+ private void setUpApp(DisplayContent display) {
mStack = new StackBuilder(mRootActivityContainer).setDisplay(display).build();
mTask = mStack.getBottomMostTask();
mActivity = mTask.getTopNonFinishingActivity();
@@ -79,7 +79,7 @@
@Test
public void testRestartProcessIfVisible() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build());
doNothing().when(mSupervisor).scheduleRestartTimeout(mActivity);
mActivity.mVisibleRequested = true;
mActivity.setSavedState(null /* savedState */);
@@ -99,7 +99,7 @@
public void testKeepBoundsWhenChangingFromFreeformToFullscreen() {
removeGlobalMinSizeRestriction();
// create freeform display and a freeform app
- ActivityDisplay display = new TestActivityDisplay.Builder(mService, 2000, 1000)
+ DisplayContent display = new TestDisplayContent.Builder(mService, 2000, 1000)
.setCanRotate(false)
.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM).build();
setUpApp(display);
@@ -126,7 +126,7 @@
@Test
public void testFixedAspectRatioBoundsWithDecor() {
final int decorHeight = 200; // e.g. The device has cutout.
- setUpApp(new TestActivityDisplay.Builder(mService, 600, 800)
+ setUpApp(new TestDisplayContent.Builder(mService, 600, 800)
.setNotch(decorHeight).build());
mActivity.info.minAspectRatio = mActivity.info.maxAspectRatio = 1;
@@ -152,11 +152,11 @@
@Test
public void testFixedScreenConfigurationWhenMovingToDisplay() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build());
// Make a new less-tall display with lower density
- final ActivityDisplay newDisplay =
- new TestActivityDisplay.Builder(mService, 1000, 2000)
+ final DisplayContent newDisplay =
+ new TestDisplayContent.Builder(mService, 1000, 2000)
.setDensityDpi(200).build();
mActivity = new ActivityBuilder(mService)
@@ -180,7 +180,7 @@
@Test
public void testFixedScreenBoundsWhenDisplaySizeChanged() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build());
prepareUnresizable(-1f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT);
assertFalse(mActivity.inSizeCompatMode());
@@ -203,7 +203,7 @@
@Test
public void testLetterboxFullscreenBounds() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build());
// Fill out required fields on default display since WM-side is mocked out
prepareUnresizable(-1.f /* maxAspect */, SCREEN_ORIENTATION_LANDSCAPE);
@@ -213,10 +213,10 @@
@Test
public void testMoveToDifferentOrientDisplay() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build());
- final ActivityDisplay newDisplay =
- new TestActivityDisplay.Builder(mService, 2000, 1000)
+ final DisplayContent newDisplay =
+ new TestDisplayContent.Builder(mService, 2000, 1000)
.setCanRotate(false).build();
prepareUnresizable(-1.f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT);
@@ -235,7 +235,7 @@
@Test
public void testFixedOrientRotateCutoutDisplay() {
// Create a display with a notch/cutout
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).setNotch(60).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).setNotch(60).build());
prepareUnresizable(1.4f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT);
final Rect origBounds = new Rect(mActivity.getBounds());
@@ -259,7 +259,7 @@
@Test
public void testFixedAspOrientChangeOrient() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build());
prepareUnresizable(1.4f /* maxAspect */, SCREEN_ORIENTATION_LANDSCAPE);
// The display aspect ratio 2.5 > 1.4 (max of activity), so the size is fitted.
@@ -286,7 +286,7 @@
@Test
public void testFixedScreenLayoutSizeBits() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build());
final int fixedScreenLayout = Configuration.SCREENLAYOUT_LONG_NO
| Configuration.SCREENLAYOUT_SIZE_NORMAL
| Configuration.SCREENLAYOUT_COMPAT_NEEDED;
@@ -314,9 +314,9 @@
@Test
public void testResetNonVisibleActivity() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build());
prepareUnresizable(1.5f, SCREEN_ORIENTATION_UNSPECIFIED);
- final ActivityDisplay display = mStack.getDisplay();
+ final DisplayContent display = mStack.getDisplay();
// Resize the display so the activity is in size compatibility mode.
resizeDisplay(display, 900, 1800);
@@ -354,7 +354,7 @@
*/
@Test
public void testHandleActivitySizeCompatMode() {
- setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2000).build());
+ setUpApp(new TestDisplayContent.Builder(mService, 1000, 2000).build());
ActivityRecord activity = mActivity;
activity.setState(ActivityStack.ActivityState.RESUMED, "testHandleActivitySizeCompatMode");
prepareUnresizable(-1.f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT);
@@ -412,7 +412,7 @@
ensureActivityConfiguration();
}
- private void resizeDisplay(ActivityDisplay display, int width, int height) {
+ private void resizeDisplay(DisplayContent display, int width, int height) {
final DisplayContent displayContent = display.mDisplayContent;
displayContent.mBaseDisplayWidth = width;
displayContent.mBaseDisplayHeight = height;
diff --git a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
index a172b65..811f46f 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
@@ -286,13 +286,12 @@
// Mock root, some default display, and home stack.
spyOn(mWmService.mRoot);
- final ActivityDisplay display = mAtmService.mRootActivityContainer.getDefaultDisplay();
+ final DisplayContent display = mAtmService.mRootActivityContainer.getDefaultDisplay();
// Set default display to be in fullscreen mode. Devices with PC feature may start their
// default display in freeform mode but some of tests in WmTests have implicit assumption on
// that the default display is in fullscreen mode.
display.setDisplayWindowingMode(WINDOWING_MODE_FULLSCREEN);
spyOn(display);
- spyOn(display.mDisplayContent);
final ActivityStack homeStack = display.getStack(
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME);
spyOn(homeStack);
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
index 9a91efe..5aa41eb 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
@@ -107,7 +107,7 @@
// =============================
@Test
public void testDefaultToPrimaryDisplay() {
- createNewActivityDisplay(WINDOWING_MODE_FREEFORM);
+ createNewDisplayContent(WINDOWING_MODE_FREEFORM);
assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
mActivity, /* source */ null, /* options */ null, mCurrent, mResult));
@@ -127,8 +127,8 @@
@Test
public void testUsesPreviousDisplayIdIfSet() {
- createNewActivityDisplay(WINDOWING_MODE_FREEFORM);
- final TestActivityDisplay display = createNewActivityDisplay(WINDOWING_MODE_FULLSCREEN);
+ createNewDisplayContent(WINDOWING_MODE_FREEFORM);
+ final TestDisplayContent display = createNewDisplayContent(WINDOWING_MODE_FULLSCREEN);
mCurrent.mPreferredDisplayId = display.mDisplayId;
@@ -140,9 +140,9 @@
@Test
public void testUsesSourcesDisplayIdIfSet() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
- final TestActivityDisplay fullscreenDisplay = createNewActivityDisplay(
+ final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
WINDOWING_MODE_FULLSCREEN);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -157,9 +157,9 @@
@Test
public void testUsesOptionsDisplayIdIfSet() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
- final TestActivityDisplay fullscreenDisplay = createNewActivityDisplay(
+ final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
WINDOWING_MODE_FULLSCREEN);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -176,9 +176,9 @@
@Test
public void testUsesTasksDisplayIdPriorToSourceIfSet() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
- final TestActivityDisplay fullscreenDisplay = createNewActivityDisplay(
+ final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
WINDOWING_MODE_FULLSCREEN);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -193,7 +193,7 @@
@Test
public void testUsesTaskDisplayIdIfSet() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
ActivityRecord source = createSourceActivity(freeformDisplay);
@@ -205,9 +205,9 @@
@Test
public void testUsesNoDisplaySourceHandoverDisplayIdIfSet() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
- final TestActivityDisplay fullscreenDisplay = createNewActivityDisplay(
+ final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
WINDOWING_MODE_FULLSCREEN);
mCurrent.mPreferredDisplayId = fullscreenDisplay.mDisplayId;
@@ -227,7 +227,7 @@
// =====================================
@Test
public void testBoundsInOptionsInfersFreeformOnFreeformDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -258,7 +258,7 @@
@Test
public void testInheritsFreeformModeFromSourceOnFullscreenDisplay() {
- final TestActivityDisplay fullscreenDisplay = createNewActivityDisplay(
+ final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
WINDOWING_MODE_FULLSCREEN);
final ActivityRecord source = createSourceActivity(fullscreenDisplay);
source.setWindowingMode(WINDOWING_MODE_FREEFORM);
@@ -272,7 +272,7 @@
@Test
public void testKeepsPictureInPictureLaunchModeInOptions() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -289,7 +289,7 @@
@Test
public void testKeepsPictureInPictureLaunchModeWithBoundsInOptions() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -321,7 +321,7 @@
@Test
public void testNonEmptyLayoutInfersFreeformOnFreeformDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -338,7 +338,7 @@
@Test
public void testNonEmptyLayoutInfersFreeformWithEmptySize() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -382,7 +382,7 @@
@Test
public void testRespectsFullyResolvedCurrentParam_Fullscreen() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -397,7 +397,7 @@
@Test
public void testRespectsModeFromFullyResolvedCurrentParam_NonEmptyBounds() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -414,7 +414,7 @@
@Test
public void testForceMaximizesUnresizeableApp() {
mService.mSizeCompatFreeform = false;
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -437,7 +437,7 @@
@Test
public void testLaunchesAppInWindowOnFreeformDisplay() {
mService.mSizeCompatFreeform = true;
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
Rect expectedLaunchBounds = new Rect(0, 0, 200, 100);
@@ -494,7 +494,7 @@
@Test
public void testUsesFullscreenWhenRequestedOnFreeformDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -510,7 +510,7 @@
@Test
public void testUsesFreeformByDefaultForPostNApp() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -525,7 +525,7 @@
@Test
public void testUsesFreeformByDefaultForPreNResizeableAppWithoutOrientationRequest() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -559,7 +559,7 @@
// ===============================
@Test
public void testKeepsBoundsWithPictureInPictureLaunchModeInOptions() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -578,7 +578,7 @@
@Test
public void testRespectsLaunchBoundsWithFreeformSourceOnFullscreenDisplay() {
- final TestActivityDisplay fullscreenDisplay = createNewActivityDisplay(
+ final TestDisplayContent fullscreenDisplay = createNewDisplayContent(
WINDOWING_MODE_FULLSCREEN);
final ActivityRecord source = createSourceActivity(fullscreenDisplay);
source.setWindowingMode(WINDOWING_MODE_FREEFORM);
@@ -595,7 +595,7 @@
@Test
public void testNonEmptyLayoutBoundsRespectsGravityWithEmptySize_LeftGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -611,7 +611,7 @@
@Test
public void testNonEmptyLayoutBoundsRespectsGravityWithEmptySize_TopGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -627,7 +627,7 @@
@Test
public void testNonEmptyLayoutBoundsRespectsGravityWithEmptySize_TopLeftGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -644,7 +644,7 @@
@Test
public void testNonEmptyLayoutBoundsRespectsGravityWithEmptySize_RightGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -660,7 +660,7 @@
@Test
public void testNonEmptyLayoutBoundsRespectsGravityWithEmptySize_BottomGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -676,7 +676,7 @@
@Test
public void testNonEmptyLayoutBoundsRespectsGravityWithEmptySize_BottomRightGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -693,7 +693,7 @@
@Test
public void testNonEmptyLayoutBoundsOnFreeformDisplay_CenterToDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -709,7 +709,7 @@
@Test
public void testNonEmptyLayoutBoundsOnFreeformDisplay_LeftGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -725,7 +725,7 @@
@Test
public void testNonEmptyLayoutBoundsOnFreeformDisplay_TopGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -741,7 +741,7 @@
@Test
public void testNonEmptyLayoutBoundsOnFreeformDisplay_TopLeftGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -757,7 +757,7 @@
@Test
public void testNonEmptyLayoutBoundsOnFreeformDisplay_RightGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -773,7 +773,7 @@
@Test
public void testNonEmptyLayoutBoundsOnFreeformDisplay_BottomGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -789,7 +789,7 @@
@Test
public void testNonEmptyLayoutBoundsOnFreeformDisplay_RightBottomGravity() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -805,7 +805,7 @@
@Test
public void testNonEmptyLayoutFractionBoundsOnFreeformDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -821,7 +821,7 @@
@Test
public void testRespectBoundsFromFullyResolvedCurrentParam_NonEmptyBounds() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -836,7 +836,7 @@
@Test
public void testReturnBoundsForFullscreenWindowingMode() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = freeformDisplay.mDisplayId;
@@ -851,7 +851,7 @@
@Test
public void testUsesDisplayOrientationForNoSensorOrientation() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -875,7 +875,7 @@
@Test
public void testRespectsAppRequestedOrientation_Landscape() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -892,7 +892,7 @@
@Test
public void testRespectsAppRequestedOrientation_Portrait() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -909,7 +909,7 @@
@Test
public void testDefaultSizeSmallerThanBigScreen() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -933,7 +933,7 @@
@Test
public void testDefaultFreeformSizeCenteredToDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -954,7 +954,7 @@
@Test
public void testCascadesToSourceSizeForFreeform() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -981,7 +981,7 @@
@Test
public void testAdjustBoundsToFitDisplay_TopLeftOutOfDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -1003,7 +1003,7 @@
@Test
public void testAdjustBoundsToFitDisplay_BottomRightOutOfDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -1025,7 +1025,7 @@
@Test
public void testAdjustBoundsToFitNewDisplay_LargerThanDisplay() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -1052,7 +1052,7 @@
overrideConfig.setLayoutDirection(new Locale("ar", "EG"));
mRootActivityContainer.onRequestedOverrideConfigurationChanged(overrideConfig);
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -1073,7 +1073,7 @@
@Test
public void testRespectsLayoutMinDimensions() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
// This test case requires a relatively big app bounds to ensure the default size calculated
@@ -1098,7 +1098,7 @@
@Test
public void testRotatesInPlaceInitialBoundsMismatchOrientation() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
final ActivityOptions options = ActivityOptions.makeBasic();
@@ -1115,7 +1115,7 @@
@Test
public void testShiftsToRightForCloseToLeftBoundsWhenConflict() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
addFreeformTaskTo(freeformDisplay, new Rect(50, 50, 100, 150));
@@ -1132,7 +1132,7 @@
@Test
public void testShiftsToLeftForCloseToRightBoundsWhenConflict() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
addFreeformTaskTo(freeformDisplay, new Rect(1720, 50, 1830, 150));
@@ -1149,7 +1149,7 @@
@Test
public void testShiftsToRightFirstForHorizontallyCenteredAndCloseToTopWhenConflict() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
addFreeformTaskTo(freeformDisplay, new Rect(0, 0, 100, 300));
@@ -1166,7 +1166,7 @@
@Test
public void testShiftsToLeftNoSpaceOnRightForHorizontallyCenteredAndCloseToTopWhenConflict() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
addFreeformTaskTo(freeformDisplay, new Rect(120, 0, 240, 300));
@@ -1183,7 +1183,7 @@
@Test
public void testShiftsToBottomRightFirstForCenteredBoundsWhenConflict() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
addFreeformTaskTo(freeformDisplay, new Rect(120, 0, 240, 100));
@@ -1200,7 +1200,7 @@
@Test
public void testShiftsToTopLeftIfNoSpaceOnBottomRightForCenteredBoundsWhenConflict() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
addFreeformTaskTo(freeformDisplay, new Rect(120, 67, 240, 100));
@@ -1230,7 +1230,7 @@
@Test
public void testAdjustsBoundsToFitInDisplayFullyResolvedBounds() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
mCurrent.mPreferredDisplayId = Display.INVALID_DISPLAY;
@@ -1248,7 +1248,7 @@
@Test
public void testAdjustsBoundsToAvoidConflictFullyResolvedBounds() {
- final TestActivityDisplay freeformDisplay = createNewActivityDisplay(
+ final TestDisplayContent freeformDisplay = createNewDisplayContent(
WINDOWING_MODE_FREEFORM);
addFreeformTaskTo(freeformDisplay, new Rect(0, 0, 200, 100));
@@ -1283,7 +1283,7 @@
@Test
public void testNoMultiDisplaySupports() {
final boolean orgValue = mService.mSupportsMultiDisplay;
- final TestActivityDisplay display = createNewActivityDisplay(WINDOWING_MODE_FULLSCREEN);
+ final TestDisplayContent display = createNewDisplayContent(WINDOWING_MODE_FULLSCREEN);
mCurrent.mPreferredDisplayId = display.mDisplayId;
try {
@@ -1296,8 +1296,8 @@
}
}
- private TestActivityDisplay createNewActivityDisplay(int windowingMode) {
- final TestActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
+ private TestDisplayContent createNewDisplayContent(int windowingMode) {
+ final TestDisplayContent display = addNewDisplayContentAt(DisplayContent.POSITION_TOP);
display.setWindowingMode(windowingMode);
display.setBounds(DISPLAY_BOUNDS);
display.getConfiguration().densityDpi = DENSITY_DEFAULT;
@@ -1311,13 +1311,13 @@
return display;
}
- private ActivityRecord createSourceActivity(TestActivityDisplay display) {
+ private ActivityRecord createSourceActivity(TestDisplayContent display) {
final ActivityStack stack = display.createStack(display.getWindowingMode(),
ACTIVITY_TYPE_STANDARD, true);
return new ActivityBuilder(mService).setStack(stack).setCreateTask(true).build();
}
- private void addFreeformTaskTo(TestActivityDisplay display, Rect bounds) {
+ private void addFreeformTaskTo(TestDisplayContent display, Rect bounds) {
final ActivityStack stack = display.createStack(display.getWindowingMode(),
ACTIVITY_TYPE_STANDARD, true);
stack.setWindowingMode(WINDOWING_MODE_FREEFORM);
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
index 39e7885..1a18df5 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskRecordTests.java
@@ -193,7 +193,7 @@
@FlakyTest(bugId = 137879065)
public void testFitWithinBounds() {
final Rect parentBounds = new Rect(10, 10, 200, 200);
- ActivityDisplay display = mService.mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mService.mRootActivityContainer.getDefaultDisplay();
ActivityStack stack = display.createStack(WINDOWING_MODE_FREEFORM, ACTIVITY_TYPE_STANDARD,
true /* onTop */);
Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
@@ -232,7 +232,7 @@
@Test
@FlakyTest(bugId = 137879065)
public void testBoundsOnModeChangeFreeformToFullscreen() {
- ActivityDisplay display = mService.mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mService.mRootActivityContainer.getDefaultDisplay();
ActivityStack stack = new StackBuilder(mRootActivityContainer).setDisplay(display)
.setWindowingMode(WINDOWING_MODE_FREEFORM).build();
Task task = stack.getBottomMostTask();
@@ -265,9 +265,9 @@
public void testFullscreenBoundsForcedOrientation() {
final Rect fullScreenBounds = new Rect(0, 0, 1920, 1080);
final Rect fullScreenBoundsPort = new Rect(0, 0, 1080, 1920);
- ActivityDisplay display = new TestActivityDisplay.Builder(
+ DisplayContent display = new TestDisplayContent.Builder(
mService, fullScreenBounds.width(), fullScreenBounds.height()).build();
- assertTrue(mRootActivityContainer.getActivityDisplay(display.mDisplayId) != null);
+ assertTrue(mRootActivityContainer.getDisplayContent(display.mDisplayId) != null);
// Fix the display orientation to landscape which is the natural rotation (0) for the test
// display.
final DisplayRotation dr = display.mDisplayContent.getDisplayRotation();
@@ -328,7 +328,7 @@
@Test
public void testIgnoresForcedOrientationWhenParentHandles() {
final Rect fullScreenBounds = new Rect(0, 0, 1920, 1080);
- ActivityDisplay display = new TestActivityDisplay.Builder(
+ DisplayContent display = new TestDisplayContent.Builder(
mService, fullScreenBounds.width(), fullScreenBounds.height()).build();
display.getRequestedOverrideConfiguration().orientation =
@@ -809,7 +809,7 @@
private void testStackBoundsConfiguration(int windowingMode, Rect parentBounds, Rect bounds,
Rect expectedConfigBounds) {
- ActivityDisplay display = mService.mRootActivityContainer.getDefaultDisplay();
+ DisplayContent display = mService.mRootActivityContainer.getDefaultDisplay();
ActivityStack stack = display.createStack(windowingMode, ACTIVITY_TYPE_STANDARD,
true /* onTop */);
Task task = new TaskBuilder(mSupervisor).setStack(stack).build();
diff --git a/services/tests/wmtests/src/com/android/server/wm/TestActivityDisplay.java b/services/tests/wmtests/src/com/android/server/wm/TestDisplayContent.java
similarity index 94%
rename from services/tests/wmtests/src/com/android/server/wm/TestActivityDisplay.java
rename to services/tests/wmtests/src/com/android/server/wm/TestDisplayContent.java
index 247cd87..325cea7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TestActivityDisplay.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TestDisplayContent.java
@@ -35,11 +35,11 @@
import android.view.DisplayCutout;
import android.view.DisplayInfo;
-class TestActivityDisplay extends ActivityDisplay {
+class TestDisplayContent extends DisplayContent {
private final ActivityStackSupervisor mSupervisor;
- private TestActivityDisplay(ActivityStackSupervisor supervisor, Display display) {
- super(supervisor.mService.mRootActivityContainer, display);
+ private TestDisplayContent(ActivityStackSupervisor supervisor, Display display) {
+ super(display, supervisor.mService.mRootActivityContainer);
// Normally this comes from display-properties as exposed by WM. Without that, just
// hard-code to FULLSCREEN for tests.
setWindowingMode(WINDOWING_MODE_FULLSCREEN);
@@ -140,13 +140,13 @@
mInfo.logicalDensityDpi = dpi;
return this;
}
- TestActivityDisplay build() {
+ TestDisplayContent build() {
final int displayId = SystemServicesTestRule.sNextDisplayId++;
final Display display = new Display(DisplayManagerGlobal.getInstance(), displayId,
mInfo, DEFAULT_DISPLAY_ADJUSTMENTS);
- final TestActivityDisplay newDisplay;
+ final TestDisplayContent newDisplay;
synchronized (mService.mGlobalLock) {
- newDisplay = new TestActivityDisplay(mService.mStackSupervisor, display);
+ newDisplay = new TestDisplayContent(mService.mStackSupervisor, display);
mService.mRootActivityContainer.addChild(newDisplay, mPosition);
}
// disable the normal system decorations
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowProcessControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowProcessControllerTests.java
index 4d25a83..6108db3 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowProcessControllerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowProcessControllerTests.java
@@ -61,33 +61,33 @@
assertEquals(INVALID_DISPLAY, mWpc.getDisplayId());
// Register to display 1 as a listener.
- TestActivityDisplay testActivityDisplay1 = createTestActivityDisplayInContainer();
- mWpc.registerDisplayConfigurationListenerLocked(testActivityDisplay1);
- assertTrue(testActivityDisplay1.containsListener(mWpc));
- assertEquals(testActivityDisplay1.mDisplayId, mWpc.getDisplayId());
+ TestDisplayContent testDisplayContent1 = createTestDisplayContentInContainer();
+ mWpc.registerDisplayConfigurationListenerLocked(testDisplayContent1);
+ assertTrue(testDisplayContent1.containsListener(mWpc));
+ assertEquals(testDisplayContent1.mDisplayId, mWpc.getDisplayId());
// Move to display 2.
- TestActivityDisplay testActivityDisplay2 = createTestActivityDisplayInContainer();
- mWpc.registerDisplayConfigurationListenerLocked(testActivityDisplay2);
- assertFalse(testActivityDisplay1.containsListener(mWpc));
- assertTrue(testActivityDisplay2.containsListener(mWpc));
- assertEquals(testActivityDisplay2.mDisplayId, mWpc.getDisplayId());
+ TestDisplayContent testDisplayContent2 = createTestDisplayContentInContainer();
+ mWpc.registerDisplayConfigurationListenerLocked(testDisplayContent2);
+ assertFalse(testDisplayContent1.containsListener(mWpc));
+ assertTrue(testDisplayContent2.containsListener(mWpc));
+ assertEquals(testDisplayContent2.mDisplayId, mWpc.getDisplayId());
- // Null ActivityDisplay will not change anything.
+ // Null DisplayContent will not change anything.
mWpc.registerDisplayConfigurationListenerLocked(null);
- assertTrue(testActivityDisplay2.containsListener(mWpc));
- assertEquals(testActivityDisplay2.mDisplayId, mWpc.getDisplayId());
+ assertTrue(testDisplayContent2.containsListener(mWpc));
+ assertEquals(testDisplayContent2.mDisplayId, mWpc.getDisplayId());
// Unregister listener will remove the wpc from registered displays.
mWpc.unregisterDisplayConfigurationListenerLocked();
- assertFalse(testActivityDisplay1.containsListener(mWpc));
- assertFalse(testActivityDisplay2.containsListener(mWpc));
+ assertFalse(testDisplayContent1.containsListener(mWpc));
+ assertFalse(testDisplayContent2.containsListener(mWpc));
assertEquals(INVALID_DISPLAY, mWpc.getDisplayId());
// Unregistration still work even if the display was removed.
- mWpc.registerDisplayConfigurationListenerLocked(testActivityDisplay1);
- assertEquals(testActivityDisplay1.mDisplayId, mWpc.getDisplayId());
- mRootActivityContainer.removeChild(testActivityDisplay1);
+ mWpc.registerDisplayConfigurationListenerLocked(testDisplayContent1);
+ assertEquals(testDisplayContent1.mDisplayId, mWpc.getDisplayId());
+ mRootActivityContainer.removeChild(testDisplayContent1);
mWpc.unregisterDisplayConfigurationListenerLocked();
assertEquals(INVALID_DISPLAY, mWpc.getDisplayId());
}
@@ -129,7 +129,7 @@
orderVerifier.verifyNoMoreInteractions();
}
- private TestActivityDisplay createTestActivityDisplayInContainer() {
- return new TestActivityDisplay.Builder(mService, 1000, 1500).build();
+ private TestDisplayContent createTestDisplayContentInContainer() {
+ return new TestDisplayContent.Builder(mService, 1000, 1500).build();
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index 22ba90b..6f53428 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -340,8 +340,8 @@
/** Creates a {@link DisplayContent} and adds it to the system. */
DisplayContent createNewDisplay(DisplayInfo info) {
- final ActivityDisplay display =
- new TestActivityDisplay.Builder(mWm.mAtmService, info).build();
+ final DisplayContent display =
+ new TestDisplayContent.Builder(mWm.mAtmService, info).build();
return display.mDisplayContent;
}