Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
Tadashi G. Takaoka | b6e148c | 2018-11-03 02:59:06 -0700 | [diff] [blame] | 14 | * limitations under the License. |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | package com.android.server.wm; |
| 18 | |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 19 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; |
| 20 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM; |
| 21 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; |
| 22 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 23 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 24 | import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; |
| 25 | import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; |
| 26 | import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; |
Wale Ogunwale | 6827856 | 2017-09-23 17:13:55 -0700 | [diff] [blame] | 27 | import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 28 | import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; |
| 29 | import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; |
| 30 | import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; |
Darryl L Johnson | b7dea9b | 2020-06-22 19:52:31 -0700 | [diff] [blame] | 31 | import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE; |
Brett Chabot | a26eda9 | 2018-07-23 13:08:30 -0700 | [diff] [blame] | 32 | |
lumark | d0b5c8f | 2019-09-29 11:30:37 +0800 | [diff] [blame] | 33 | import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; |
| 34 | import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; |
Darryl L Johnson | b7dea9b | 2020-06-22 19:52:31 -0700 | [diff] [blame] | 35 | import static com.android.server.wm.ActivityStack.ActivityState.RESUMED; |
lumark | d0b5c8f | 2019-09-29 11:30:37 +0800 | [diff] [blame] | 36 | |
Tadashi G. Takaoka | c98f682 | 2018-10-11 17:11:49 +0900 | [diff] [blame] | 37 | import static com.google.common.truth.Truth.assertThat; |
| 38 | |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 39 | import static org.junit.Assert.assertEquals; |
| 40 | import static org.junit.Assert.assertFalse; |
Darryl L Johnson | b7dea9b | 2020-06-22 19:52:31 -0700 | [diff] [blame] | 41 | import static org.junit.Assert.assertNotNull; |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 42 | import static org.junit.Assert.assertTrue; |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 43 | import static org.mockito.ArgumentMatchers.any; |
| 44 | import static org.mockito.ArgumentMatchers.anyBoolean; |
| 45 | import static org.mockito.ArgumentMatchers.anyInt; |
Chris Li | ae1617f | 2020-05-20 16:21:42 -0700 | [diff] [blame] | 46 | import static org.mockito.ArgumentMatchers.eq; |
| 47 | import static org.mockito.Mockito.never; |
| 48 | import static org.mockito.Mockito.verify; |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 49 | |
Brett Chabot | a26eda9 | 2018-07-23 13:08:30 -0700 | [diff] [blame] | 50 | import android.platform.test.annotations.Presubmit; |
| 51 | |
Tadashi G. Takaoka | b6e148c | 2018-11-03 02:59:06 -0700 | [diff] [blame] | 52 | import androidx.test.filters.SmallTest; |
| 53 | |
Brett Chabot | a26eda9 | 2018-07-23 13:08:30 -0700 | [diff] [blame] | 54 | import org.junit.After; |
| 55 | import org.junit.Before; |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 56 | import org.junit.Test; |
Riddle Hsu | 73f5357 | 2019-09-23 23:13:01 +0800 | [diff] [blame] | 57 | import org.junit.runner.RunWith; |
Tadashi G. Takaoka | c8f2c14 | 2018-10-11 16:30:28 +0900 | [diff] [blame] | 58 | |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 59 | /** |
Andrii Kulian | 44b3c56 | 2020-04-01 12:49:56 -0700 | [diff] [blame] | 60 | * Tests for the {@link TaskDisplayArea} container. |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 61 | * |
| 62 | * Build/Install/Run: |
Andrii Kulian | 44b3c56 | 2020-04-01 12:49:56 -0700 | [diff] [blame] | 63 | * atest WmTests:TaskDisplayAreaTests |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 64 | */ |
| 65 | @SmallTest |
| 66 | @Presubmit |
Riddle Hsu | 73f5357 | 2019-09-23 23:13:01 +0800 | [diff] [blame] | 67 | @RunWith(WindowTestRunner.class) |
Andrii Kulian | 86d676c | 2020-03-27 19:34:54 -0700 | [diff] [blame] | 68 | public class TaskDisplayAreaTests extends WindowTestsBase { |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 69 | |
Wale Ogunwale | bebd8cd | 2019-10-28 15:53:31 -0700 | [diff] [blame] | 70 | private ActivityStack mPinnedStack; |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 71 | |
| 72 | @Before |
| 73 | public void setUp() throws Exception { |
Yunfan Chen | 279f558 | 2018-12-12 15:24:50 -0800 | [diff] [blame] | 74 | mPinnedStack = createTaskStackOnDisplay( |
| 75 | WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD, mDisplayContent); |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 76 | // Stack should contain visible app window to be considered visible. |
| 77 | final Task pinnedTask = createTaskInStack(mPinnedStack, 0 /* userId */); |
| 78 | assertFalse(mPinnedStack.isVisible()); |
Wale Ogunwale | 3198da4 | 2019-10-10 14:45:03 +0200 | [diff] [blame] | 79 | final ActivityRecord pinnedApp = |
Garfield Tan | e8d84ab | 2019-10-11 09:49:40 -0700 | [diff] [blame] | 80 | WindowTestUtils.createTestActivityRecord(mDisplayContent); |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 81 | pinnedTask.addChild(pinnedApp, 0 /* addPos */); |
| 82 | assertTrue(mPinnedStack.isVisible()); |
| 83 | } |
| 84 | |
| 85 | @After |
| 86 | public void tearDown() throws Exception { |
| 87 | mPinnedStack.removeImmediately(); |
| 88 | } |
| 89 | |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 90 | @Test |
Chris Li | ae1617f | 2020-05-20 16:21:42 -0700 | [diff] [blame] | 91 | public void testActivityWithZBoost_taskDisplayAreaDoesNotMoveUp() { |
| 92 | final ActivityStack stack = createTaskStackOnDisplay( |
| 93 | WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, mDisplayContent); |
| 94 | final Task task = createTaskInStack(stack, 0 /* userId */); |
| 95 | final ActivityRecord activity = WindowTestUtils.createTestActivityRecord(mDisplayContent); |
| 96 | task.addChild(activity, 0 /* addPos */); |
| 97 | final TaskDisplayArea taskDisplayArea = activity.getDisplayArea(); |
| 98 | activity.mNeedsAnimationBoundsLayer = true; |
| 99 | activity.mNeedsZBoost = true; |
| 100 | spyOn(taskDisplayArea.mSurfaceAnimator); |
| 101 | |
| 102 | mDisplayContent.assignChildLayers(mTransaction); |
| 103 | |
| 104 | assertThat(activity.needsZBoost()).isTrue(); |
| 105 | assertThat(taskDisplayArea.needsZBoost()).isFalse(); |
| 106 | verify(taskDisplayArea.mSurfaceAnimator, never()).setLayer(eq(mTransaction), anyInt()); |
| 107 | } |
| 108 | |
| 109 | @Test |
Tadashi G. Takaoka | c98f682 | 2018-10-11 17:11:49 +0900 | [diff] [blame] | 110 | public void testStackPositionChildAt() { |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 111 | // Test that always-on-top stack can't be moved to position other than top. |
Louis Chang | dc07727 | 2019-11-12 16:52:56 +0800 | [diff] [blame] | 112 | final ActivityStack stack1 = createTaskStackOnDisplay(mDisplayContent); |
| 113 | final ActivityStack stack2 = createTaskStackOnDisplay(mDisplayContent); |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 114 | |
| 115 | final WindowContainer taskStackContainer = stack1.getParent(); |
| 116 | |
| 117 | final int stack1Pos = taskStackContainer.mChildren.indexOf(stack1); |
| 118 | final int stack2Pos = taskStackContainer.mChildren.indexOf(stack2); |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 119 | final int pinnedStackPos = taskStackContainer.mChildren.indexOf(mPinnedStack); |
Tadashi G. Takaoka | c98f682 | 2018-10-11 17:11:49 +0900 | [diff] [blame] | 120 | assertThat(pinnedStackPos).isGreaterThan(stack2Pos); |
| 121 | assertThat(stack2Pos).isGreaterThan(stack1Pos); |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 122 | |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 123 | taskStackContainer.positionChildAt(WindowContainer.POSITION_BOTTOM, mPinnedStack, false); |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 124 | assertEquals(taskStackContainer.mChildren.get(stack1Pos), stack1); |
| 125 | assertEquals(taskStackContainer.mChildren.get(stack2Pos), stack2); |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 126 | assertEquals(taskStackContainer.mChildren.get(pinnedStackPos), mPinnedStack); |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 127 | |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 128 | taskStackContainer.positionChildAt(1, mPinnedStack, false); |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 129 | assertEquals(taskStackContainer.mChildren.get(stack1Pos), stack1); |
| 130 | assertEquals(taskStackContainer.mChildren.get(stack2Pos), stack2); |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 131 | assertEquals(taskStackContainer.mChildren.get(pinnedStackPos), mPinnedStack); |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 132 | } |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 133 | |
Andrii Kulian | cd5dcb8b | 2017-01-03 17:09:45 -0800 | [diff] [blame] | 134 | @Test |
Tadashi G. Takaoka | c98f682 | 2018-10-11 17:11:49 +0900 | [diff] [blame] | 135 | public void testStackPositionBelowPinnedStack() { |
Andrii Kulian | cd5dcb8b | 2017-01-03 17:09:45 -0800 | [diff] [blame] | 136 | // Test that no stack can be above pinned stack. |
Louis Chang | dc07727 | 2019-11-12 16:52:56 +0800 | [diff] [blame] | 137 | final ActivityStack stack1 = createTaskStackOnDisplay(mDisplayContent); |
Andrii Kulian | cd5dcb8b | 2017-01-03 17:09:45 -0800 | [diff] [blame] | 138 | |
| 139 | final WindowContainer taskStackContainer = stack1.getParent(); |
| 140 | |
| 141 | final int stackPos = taskStackContainer.mChildren.indexOf(stack1); |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 142 | final int pinnedStackPos = taskStackContainer.mChildren.indexOf(mPinnedStack); |
Tadashi G. Takaoka | c98f682 | 2018-10-11 17:11:49 +0900 | [diff] [blame] | 143 | assertThat(pinnedStackPos).isGreaterThan(stackPos); |
Andrii Kulian | cd5dcb8b | 2017-01-03 17:09:45 -0800 | [diff] [blame] | 144 | |
| 145 | taskStackContainer.positionChildAt(WindowContainer.POSITION_TOP, stack1, false); |
| 146 | assertEquals(taskStackContainer.mChildren.get(stackPos), stack1); |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 147 | assertEquals(taskStackContainer.mChildren.get(pinnedStackPos), mPinnedStack); |
Andrii Kulian | cd5dcb8b | 2017-01-03 17:09:45 -0800 | [diff] [blame] | 148 | |
| 149 | taskStackContainer.positionChildAt(taskStackContainer.mChildren.size() - 1, stack1, false); |
| 150 | assertEquals(taskStackContainer.mChildren.get(stackPos), stack1); |
Wale Ogunwale | 1666e31 | 2016-12-16 11:27:18 -0800 | [diff] [blame] | 151 | assertEquals(taskStackContainer.mChildren.get(pinnedStackPos), mPinnedStack); |
Andrii Kulian | cd5dcb8b | 2017-01-03 17:09:45 -0800 | [diff] [blame] | 152 | } |
Riddle Hsu | 2f6e174 | 2018-08-23 22:44:36 +0800 | [diff] [blame] | 153 | |
| 154 | @Test |
| 155 | public void testDisplayPositionWithPinnedStack() { |
Charles Chen | b28fb72 | 2020-05-21 17:19:32 +0800 | [diff] [blame] | 156 | // Make sure the display is trusted display which capable to move the stack to top. |
lumark | d0b5c8f | 2019-09-29 11:30:37 +0800 | [diff] [blame] | 157 | spyOn(mDisplayContent); |
Charles Chen | b28fb72 | 2020-05-21 17:19:32 +0800 | [diff] [blame] | 158 | doReturn(true).when(mDisplayContent).isTrusted(); |
lumark | d0b5c8f | 2019-09-29 11:30:37 +0800 | [diff] [blame] | 159 | |
Riddle Hsu | 2f6e174 | 2018-08-23 22:44:36 +0800 | [diff] [blame] | 160 | // The display contains pinned stack that was added in {@link #setUp}. |
Wale Ogunwale | bebd8cd | 2019-10-28 15:53:31 -0700 | [diff] [blame] | 161 | final ActivityStack stack = createTaskStackOnDisplay(mDisplayContent); |
Riddle Hsu | 2f6e174 | 2018-08-23 22:44:36 +0800 | [diff] [blame] | 162 | final Task task = createTaskInStack(stack, 0 /* userId */); |
| 163 | |
| 164 | // Add another display at top. |
Tadashi G. Takaoka | b6e148c | 2018-11-03 02:59:06 -0700 | [diff] [blame] | 165 | mWm.mRoot.positionChildAt(WindowContainer.POSITION_TOP, createNewDisplay(), |
Riddle Hsu | 2f6e174 | 2018-08-23 22:44:36 +0800 | [diff] [blame] | 166 | false /* includingParents */); |
| 167 | |
| 168 | // Move the task of {@code mDisplayContent} to top. |
Louis Chang | cdec080 | 2019-11-11 11:45:07 +0800 | [diff] [blame] | 169 | stack.positionChildAt(WindowContainer.POSITION_TOP, task, true /* includingParents */); |
Tadashi G. Takaoka | b6e148c | 2018-11-03 02:59:06 -0700 | [diff] [blame] | 170 | final int indexOfDisplayWithPinnedStack = mWm.mRoot.mChildren.indexOf(mDisplayContent); |
Riddle Hsu | 2f6e174 | 2018-08-23 22:44:36 +0800 | [diff] [blame] | 171 | |
| 172 | assertEquals("The testing DisplayContent should be moved to top with task", |
Tadashi G. Takaoka | b6e148c | 2018-11-03 02:59:06 -0700 | [diff] [blame] | 173 | mWm.mRoot.getChildCount() - 1, indexOfDisplayWithPinnedStack); |
Riddle Hsu | 2f6e174 | 2018-08-23 22:44:36 +0800 | [diff] [blame] | 174 | } |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 175 | |
| 176 | @Test |
| 177 | public void testReuseTaskAsStack() { |
| 178 | final Task candidateTask = createTaskStackOnDisplay(WINDOWING_MODE_FULLSCREEN, |
| 179 | ACTIVITY_TYPE_STANDARD, mDisplayContent); |
| 180 | final Task newStack = createTaskStackOnDisplay(WINDOWING_MODE_FULLSCREEN, |
| 181 | ACTIVITY_TYPE_STANDARD, mDisplayContent); |
Andrii Kulian | 44b3c56 | 2020-04-01 12:49:56 -0700 | [diff] [blame] | 182 | final TaskDisplayArea taskDisplayArea = candidateTask.getDisplayArea(); |
| 183 | doReturn(newStack).when(taskDisplayArea).createStack(anyInt(), anyInt(), anyBoolean(), |
| 184 | any(), any(), anyBoolean()); |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 185 | |
| 186 | final int type = ACTIVITY_TYPE_STANDARD; |
| 187 | assertGetOrCreateStack(WINDOWING_MODE_FULLSCREEN, type, candidateTask, |
| 188 | true /* reuseCandidate */); |
| 189 | assertGetOrCreateStack(WINDOWING_MODE_UNDEFINED, type, candidateTask, |
| 190 | true /* reuseCandidate */); |
| 191 | assertGetOrCreateStack(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY, type, candidateTask, |
| 192 | true /* reuseCandidate */); |
| 193 | assertGetOrCreateStack(WINDOWING_MODE_FREEFORM, type, candidateTask, |
| 194 | true /* reuseCandidate */); |
| 195 | assertGetOrCreateStack(WINDOWING_MODE_MULTI_WINDOW, type, candidateTask, |
| 196 | true /* reuseCandidate */); |
| 197 | assertGetOrCreateStack(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, type, candidateTask, |
| 198 | false /* reuseCandidate */); |
| 199 | assertGetOrCreateStack(WINDOWING_MODE_PINNED, type, candidateTask, |
Evan Rosky | 688c838 | 2020-04-03 17:27:08 -0700 | [diff] [blame] | 200 | true /* reuseCandidate */); |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 201 | |
| 202 | final int windowingMode = WINDOWING_MODE_FULLSCREEN; |
| 203 | assertGetOrCreateStack(windowingMode, ACTIVITY_TYPE_HOME, candidateTask, |
| 204 | false /* reuseCandidate */); |
| 205 | assertGetOrCreateStack(windowingMode, ACTIVITY_TYPE_RECENTS, candidateTask, |
| 206 | false /* reuseCandidate */); |
| 207 | assertGetOrCreateStack(windowingMode, ACTIVITY_TYPE_ASSISTANT, candidateTask, |
| 208 | false /* reuseCandidate */); |
| 209 | assertGetOrCreateStack(windowingMode, ACTIVITY_TYPE_DREAM, candidateTask, |
| 210 | false /* reuseCandidate */); |
| 211 | } |
| 212 | |
Darryl L Johnson | b7dea9b | 2020-06-22 19:52:31 -0700 | [diff] [blame] | 213 | @Test |
| 214 | public void testGetOrientation_nonResizableHomeStackWithHomeActivityPendingVisibilityChange() { |
| 215 | final RootWindowContainer rootWindowContainer = mWm.mAtmService.mRootWindowContainer; |
| 216 | final TaskDisplayArea defaultTaskDisplayArea = |
| 217 | rootWindowContainer.getDefaultTaskDisplayArea(); |
| 218 | |
| 219 | final ActivityStack rootHomeTask = defaultTaskDisplayArea.getRootHomeTask(); |
| 220 | rootHomeTask.mResizeMode = RESIZE_MODE_UNRESIZEABLE; |
| 221 | |
| 222 | final ActivityStack primarySplitTask = |
| 223 | new ActivityTestsBase.StackBuilder(rootWindowContainer) |
| 224 | .setTaskDisplayArea(defaultTaskDisplayArea) |
| 225 | .setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) |
| 226 | .setActivityType(ACTIVITY_TYPE_STANDARD) |
| 227 | .setOnTop(true) |
| 228 | .setCreateActivity(true) |
| 229 | .build(); |
| 230 | ActivityRecord primarySplitActivity = primarySplitTask.getTopNonFinishingActivity(); |
| 231 | assertNotNull(primarySplitActivity); |
| 232 | primarySplitActivity.setState(RESUMED, |
| 233 | "testGetOrientation_nonResizableHomeStackWithHomeActivityPendingVisibilityChange"); |
| 234 | |
| 235 | ActivityRecord homeActivity = rootHomeTask.getTopNonFinishingActivity(); |
| 236 | if (homeActivity == null) { |
| 237 | homeActivity = new ActivityTestsBase.ActivityBuilder(mWm.mAtmService) |
| 238 | .setStack(rootHomeTask).setCreateTask(true).build(); |
| 239 | } |
| 240 | homeActivity.setVisible(false); |
| 241 | homeActivity.mVisibleRequested = true; |
| 242 | assertFalse(rootHomeTask.isVisible()); |
| 243 | |
| 244 | assertEquals(rootWindowContainer.getOrientation(), rootHomeTask.getOrientation()); |
| 245 | } |
| 246 | |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 247 | private void assertGetOrCreateStack(int windowingMode, int activityType, Task candidateTask, |
| 248 | boolean reuseCandidate) { |
Andrii Kulian | 44b3c56 | 2020-04-01 12:49:56 -0700 | [diff] [blame] | 249 | final TaskDisplayArea taskDisplayArea = candidateTask.getDisplayArea(); |
Louis Chang | 6c5d725 | 2020-03-30 15:42:01 +0800 | [diff] [blame] | 250 | final ActivityStack stack = taskDisplayArea.getOrCreateStack(windowingMode, activityType, |
| 251 | false /* onTop */, null /* intent */, candidateTask /* candidateTask */); |
| 252 | assertEquals(reuseCandidate, stack == candidateTask); |
| 253 | } |
Andrii Kulian | d276563 | 2016-12-12 22:26:34 -0800 | [diff] [blame] | 254 | } |