blob: 10253c570f3ff901906b9fc7b4a040bdc9d84451 [file] [log] [blame]
Bryce Leeaf691c02017-03-20 14:20:22 -07001/*
2 * Copyright (C) 2017 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
14 * limitations under the License
15 */
16
17package com.android.server.am;
18
Bryce Lee18d51592017-10-25 10:22:19 -070019import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
20import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
Wale Ogunwale04a05ac2017-09-17 21:35:02 -070021import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
Bryce Leef3c6a472017-11-14 14:53:06 -080022import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
Wale Ogunwale9dcf9462017-09-19 15:13:01 -070023import static android.view.Display.DEFAULT_DISPLAY;
Bryce Leeaf691c02017-03-20 14:20:22 -070024import static org.mockito.Mockito.mock;
Bryce Lee2a3cc462017-10-27 10:57:35 -070025import static org.mockito.Mockito.doNothing;
Bryce Lee04ab3462017-04-10 15:06:33 -070026import static org.mockito.Mockito.doReturn;
27import static org.mockito.Mockito.any;
Bryce Lee2a3cc462017-10-27 10:57:35 -070028import static org.mockito.Mockito.anyBoolean;
29import static org.mockito.Mockito.anyInt;
Bryce Lee04ab3462017-04-10 15:06:33 -070030import static org.mockito.Mockito.doAnswer;
Bryce Lee4e4a3ec2017-09-27 08:25:03 -070031import static org.mockito.Mockito.spy;
Bryce Lee04ab3462017-04-10 15:06:33 -070032
Winson Chung59a47ded2018-01-25 17:46:06 +000033import com.android.server.wm.DisplayWindowController;
Bryce Lee04ab3462017-04-10 15:06:33 -070034import org.mockito.invocation.InvocationOnMock;
Bryce Leeaf691c02017-03-20 14:20:22 -070035
Bryce Lee0bd8d422018-01-09 09:45:57 -080036import android.app.IApplicationThread;
Bryce Leeaf691c02017-03-20 14:20:22 -070037import android.content.ComponentName;
38import android.content.Context;
39import android.content.Intent;
40import android.content.pm.ActivityInfo;
41import android.content.pm.ApplicationInfo;
Bryce Leeba8f4422017-11-20 12:35:57 -080042import android.content.pm.IPackageManager;
Bryce Leeaf691c02017-03-20 14:20:22 -070043import android.content.res.Configuration;
44import android.graphics.Rect;
Wale Ogunwale9dcf9462017-09-19 15:13:01 -070045import android.hardware.display.DisplayManager;
Bryce Lee3115bdf2017-04-05 08:39:40 -070046import android.os.HandlerThread;
Bryce Leeaf691c02017-03-20 14:20:22 -070047import android.os.Looper;
Bryce Lee93e7f792017-10-25 15:54:55 -070048import android.service.voice.IVoiceInteractionSession;
Bryce Leeaf691c02017-03-20 14:20:22 -070049import android.support.test.InstrumentationRegistry;
50import com.android.server.AttributeCache;
51import com.android.server.wm.AppWindowContainerController;
Bryce Lee4e4a3ec2017-09-27 08:25:03 -070052import com.android.server.wm.PinnedStackWindowController;
Bryce Leeaf691c02017-03-20 14:20:22 -070053import com.android.server.wm.StackWindowController;
Bryce Lee04ab3462017-04-10 15:06:33 -070054import com.android.server.wm.TaskWindowContainerController;
Bryce Leeaf691c02017-03-20 14:20:22 -070055import com.android.server.wm.WindowManagerService;
56import com.android.server.wm.WindowTestUtils;
Bryce Lee3115bdf2017-04-05 08:39:40 -070057import org.junit.After;
Bryce Leeaf691c02017-03-20 14:20:22 -070058import org.junit.Before;
59import org.mockito.MockitoAnnotations;
60
61/**
62 * A base class to handle common operations in activity related unit tests.
63 */
64public class ActivityTestsBase {
Bryce Lee939a9a32017-10-23 10:01:21 -070065 private static boolean sOneTimeSetupDone = false;
66
Bryce Leeaf691c02017-03-20 14:20:22 -070067 private final Context mContext = InstrumentationRegistry.getContext();
Bryce Lee3115bdf2017-04-05 08:39:40 -070068 private HandlerThread mHandlerThread;
Bryce Leeaf691c02017-03-20 14:20:22 -070069
Bryce Leeaf691c02017-03-20 14:20:22 -070070 @Before
71 public void setUp() throws Exception {
Bryce Lee939a9a32017-10-23 10:01:21 -070072 if (!sOneTimeSetupDone) {
73 sOneTimeSetupDone = true;
74
75 // Allows to mock package local classes and methods
76 System.setProperty("dexmaker.share_classloader", "true");
77 MockitoAnnotations.initMocks(this);
78 }
Bryce Lee3115bdf2017-04-05 08:39:40 -070079 mHandlerThread = new HandlerThread("ActivityTestsBaseThread");
80 mHandlerThread.start();
81 }
Bryce Leeaf691c02017-03-20 14:20:22 -070082
Bryce Lee3115bdf2017-04-05 08:39:40 -070083 @After
84 public void tearDown() {
85 mHandlerThread.quitSafely();
Bryce Leeaf691c02017-03-20 14:20:22 -070086 }
87
88 protected ActivityManagerService createActivityManagerService() {
Bryce Lee93e7f792017-10-25 15:54:55 -070089 final ActivityManagerService service =
90 setupActivityManagerService(new TestActivityManagerService(mContext));
91 AttributeCache.init(mContext);
92 return service;
Winson Chung3f0e59a2017-10-25 10:19:05 -070093 }
94
95 protected ActivityManagerService setupActivityManagerService(ActivityManagerService service) {
96 service = spy(service);
Bryce Leeba8f4422017-11-20 12:35:57 -080097 doReturn(mock(IPackageManager.class)).when(service).getPackageManager();
Bryce Lee4e4a3ec2017-09-27 08:25:03 -070098 service.mWindowManager = prepareMockWindowManager();
Bryce Lee840c5662017-04-13 10:02:51 -070099 return service;
Bryce Leeaf691c02017-03-20 14:20:22 -0700100 }
101
Bryce Lee18d51592017-10-25 10:22:19 -0700102 /**
103 * Builder for creating new activities.
104 */
105 protected static class ActivityBuilder {
106 // An id appended to the end of the component name to make it unique
107 private static int sCurrentActivityId = 0;
Bryce Lee9f6affd2017-09-01 09:18:35 -0700108
Bryce Lee18d51592017-10-25 10:22:19 -0700109 // Default package name
Bryce Lee93e7f792017-10-25 15:54:55 -0700110 static final String DEFAULT_PACKAGE = "com.foo";
Bryce Leeaf691c02017-03-20 14:20:22 -0700111
Bryce Lee18d51592017-10-25 10:22:19 -0700112 // Default base activity name
113 private static final String DEFAULT_BASE_ACTIVITY_NAME = ".BarActivity";
114
115 private final ActivityManagerService mService;
116
117 private ComponentName mComponent;
118 private TaskRecord mTaskRecord;
119 private int mUid;
120 private boolean mCreateTask;
121 private ActivityStack mStack;
122
123 ActivityBuilder(ActivityManagerService service) {
124 mService = service;
Bryce Leeaf691c02017-03-20 14:20:22 -0700125 }
126
Bryce Lee18d51592017-10-25 10:22:19 -0700127 ActivityBuilder setComponent(ComponentName component) {
128 mComponent = component;
129 return this;
130 }
131
132 ActivityBuilder setTask(TaskRecord task) {
133 mTaskRecord = task;
134 return this;
135 }
136
137 ActivityBuilder setStack(ActivityStack stack) {
138 mStack = stack;
139 return this;
140 }
141
142 ActivityBuilder setCreateTask(boolean createTask) {
143 mCreateTask = createTask;
144 return this;
145 }
146
147 ActivityBuilder setUid(int uid) {
148 mUid = uid;
149 return this;
150 }
151
152 ActivityRecord build() {
153 if (mComponent == null) {
154 final int id = sCurrentActivityId++;
155 mComponent = ComponentName.createRelative(DEFAULT_PACKAGE,
156 DEFAULT_BASE_ACTIVITY_NAME + id);
157 }
158
159 if (mCreateTask) {
160 mTaskRecord = new TaskBuilder(mService.mStackSupervisor)
161 .setComponent(mComponent)
162 .setStack(mStack).build();
163 }
164
165 Intent intent = new Intent();
166 intent.setComponent(mComponent);
167 final ActivityInfo aInfo = new ActivityInfo();
168 aInfo.applicationInfo = new ApplicationInfo();
169 aInfo.applicationInfo.packageName = mComponent.getPackageName();
170 aInfo.applicationInfo.uid = mUid;
Bryce Lee18d51592017-10-25 10:22:19 -0700171 final ActivityRecord activity = new ActivityRecord(mService, null /* caller */,
172 0 /* launchedFromPid */, 0, null, intent, null,
173 aInfo /*aInfo*/, new Configuration(), null /* resultTo */, null /* resultWho */,
174 0 /* reqCode */, false /*componentSpecified*/, false /* rootVoiceInteraction */,
175 mService.mStackSupervisor, null /* options */, null /* sourceRecord */);
176 activity.mWindowContainerController = mock(AppWindowContainerController.class);
177
178 if (mTaskRecord != null) {
179 mTaskRecord.addActivityToTop(activity);
180 }
181
Bryce Lee0bd8d422018-01-09 09:45:57 -0800182 activity.setProcess(new ProcessRecord(null, mService.mContext.getApplicationInfo(),
183 "name", 12345));
184 activity.app.thread = mock(IApplicationThread.class);
185
Bryce Lee18d51592017-10-25 10:22:19 -0700186 return activity;
187 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700188 }
189
Bryce Lee18d51592017-10-25 10:22:19 -0700190 /**
191 * Builder for creating new tasks.
192 */
193 protected static class TaskBuilder {
194 private final ActivityStackSupervisor mSupervisor;
Winson Chung1dbc8112017-09-28 18:05:31 -0700195
Bryce Lee18d51592017-10-25 10:22:19 -0700196 private ComponentName mComponent;
197 private String mPackage;
198 private int mFlags = 0;
199 private int mTaskId = 0;
Winson Chung0ec2a352017-10-26 11:38:30 -0700200 private int mUserId = 0;
Bryce Lee93e7f792017-10-25 15:54:55 -0700201 private IVoiceInteractionSession mVoiceSession;
Bryce Leeaf691c02017-03-20 14:20:22 -0700202
Bryce Lee18d51592017-10-25 10:22:19 -0700203 private ActivityStack mStack;
Bryce Leeaf691c02017-03-20 14:20:22 -0700204
Bryce Lee18d51592017-10-25 10:22:19 -0700205 TaskBuilder(ActivityStackSupervisor supervisor) {
206 mSupervisor = supervisor;
207 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700208
Bryce Lee18d51592017-10-25 10:22:19 -0700209 TaskBuilder setComponent(ComponentName component) {
210 mComponent = component;
211 return this;
212 }
213
214 TaskBuilder setPackage(String packageName) {
215 mPackage = packageName;
216 return this;
217 }
218
Bryce Lee93e7f792017-10-25 15:54:55 -0700219 TaskBuilder setVoiceSession(IVoiceInteractionSession session) {
220 mVoiceSession = session;
221 return this;
222 }
223
Bryce Lee18d51592017-10-25 10:22:19 -0700224 TaskBuilder setFlags(int flags) {
225 mFlags = flags;
226 return this;
227 }
228
229 TaskBuilder setTaskId(int taskId) {
230 mTaskId = taskId;
231 return this;
232 }
233
Winson Chung0ec2a352017-10-26 11:38:30 -0700234 TaskBuilder setUserId(int userId) {
235 mUserId = userId;
236 return this;
237 }
238
Bryce Lee18d51592017-10-25 10:22:19 -0700239 TaskBuilder setStack(ActivityStack stack) {
240 mStack = stack;
241 return this;
242 }
243
244 TaskRecord build() {
245 if (mStack == null) {
246 mStack = mSupervisor.getDefaultDisplay().createStack(
247 WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
248 }
249
250 final ActivityInfo aInfo = new ActivityInfo();
251 aInfo.applicationInfo = new ApplicationInfo();
252 aInfo.applicationInfo.packageName = mPackage;
253
254 Intent intent = new Intent();
255 intent.setComponent(mComponent);
256 intent.setFlags(mFlags);
257
258 final TaskRecord task = new TaskRecord(mSupervisor.mService, mTaskId, aInfo,
Bryce Lee93e7f792017-10-25 15:54:55 -0700259 intent /*intent*/, mVoiceSession, null /*_voiceInteractor*/);
Winson Chung0ec2a352017-10-26 11:38:30 -0700260 task.userId = mUserId;
Bryce Lee18d51592017-10-25 10:22:19 -0700261 mSupervisor.setFocusStackUnchecked("test", mStack);
262 mStack.addTask(task, true, "creating test task");
263 task.setStack(mStack);
264 task.setWindowContainerController(mock(TaskWindowContainerController.class));
Winson Chung0ec2a352017-10-26 11:38:30 -0700265 task.touchActiveTime();
Bryce Lee18d51592017-10-25 10:22:19 -0700266
267 return task;
268 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700269 }
270
271 /**
272 * An {@link ActivityManagerService} subclass which provides a test
273 * {@link ActivityStackSupervisor}.
274 */
275 protected static class TestActivityManagerService extends ActivityManagerService {
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700276 TestActivityManagerService(Context context) {
Bryce Leeaf691c02017-03-20 14:20:22 -0700277 super(context);
Bryce Lee04ab3462017-04-10 15:06:33 -0700278 mSupportsMultiWindow = true;
279 mSupportsMultiDisplay = true;
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700280 mSupportsSplitScreenMultiWindow = true;
281 mSupportsFreeformWindowManagement = true;
282 mSupportsPictureInPicture = true;
Bryce Lee6a0754a2017-10-10 17:53:50 -0700283 mWindowManager = WindowTestUtils.getMockWindowManagerService();
Bryce Leeaf691c02017-03-20 14:20:22 -0700284 }
285
286 @Override
Bryce Lee2a3cc462017-10-27 10:57:35 -0700287 final protected ActivityStackSupervisor createStackSupervisor() {
288 final ActivityStackSupervisor supervisor = spy(createTestSupervisor());
289
290 // No home stack is set.
291 doNothing().when(supervisor).moveHomeStackToFront(any());
292 doReturn(true).when(supervisor).moveHomeStackTaskToTop(any());
293 // Invoked during {@link ActivityStack} creation.
294 doNothing().when(supervisor).updateUIDsPresentOnDisplay();
295 // Always keep things awake.
296 doReturn(true).when(supervisor).hasAwakeDisplay();
297 // Called when moving activity to pinned stack.
298 doNothing().when(supervisor).ensureActivitiesVisibleLocked(any(), anyInt(), anyBoolean());
299 // Do not schedule idle timeouts
300 doNothing().when(supervisor).scheduleIdleTimeoutLocked(any());
301
302 supervisor.initialize();
303
304 return supervisor;
305 }
306
307 protected ActivityStackSupervisor createTestSupervisor() {
Bryce Lee3115bdf2017-04-05 08:39:40 -0700308 return new TestActivityStackSupervisor(this, mHandlerThread.getLooper());
Bryce Leeaf691c02017-03-20 14:20:22 -0700309 }
Bryce Lee29a649d2017-08-18 13:52:31 -0700310
311 @Override
312 void updateUsageStats(ActivityRecord component, boolean resumed) {
313 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700314 }
315
316 /**
317 * An {@link ActivityStackSupervisor} which stubs out certain methods that depend on
318 * setup not available in the test environment. Also specifies an injector for
319 */
320 protected static class TestActivityStackSupervisor extends ActivityStackSupervisor {
Bryce Lee2a3cc462017-10-27 10:57:35 -0700321 private ActivityDisplay mDisplay;
Bryce Lee943ebe72017-05-04 10:19:07 -0700322
Bryce Leeaf691c02017-03-20 14:20:22 -0700323 public TestActivityStackSupervisor(ActivityManagerService service, Looper looper) {
324 super(service, looper);
Wale Ogunwale9dcf9462017-09-19 15:13:01 -0700325 mDisplayManager =
326 (DisplayManager) mService.mContext.getSystemService(Context.DISPLAY_SERVICE);
Bryce Lee04ab3462017-04-10 15:06:33 -0700327 mWindowManager = prepareMockWindowManager();
Bryce Lee2a3cc462017-10-27 10:57:35 -0700328 }
329
330 @Override
331 public void initialize() {
332 super.initialize();
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700333 mDisplay = new TestActivityDisplay(this, DEFAULT_DISPLAY);
Wale Ogunwale9dcf9462017-09-19 15:13:01 -0700334 attachDisplay(mDisplay);
Bryce Lee04ab3462017-04-10 15:06:33 -0700335 }
336
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700337 @Override
338 ActivityDisplay getDefaultDisplay() {
339 return mDisplay;
340 }
341
Bryce Lee2a3cc462017-10-27 10:57:35 -0700342 // Just return the current front task. This is called internally so we cannot use spy to mock this out.
Bryce Lee04ab3462017-04-10 15:06:33 -0700343 @Override
344 ActivityStack getNextFocusableStackLocked(ActivityStack currentFocus) {
345 return mFocusedStack;
346 }
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700347 }
348
Winson Chung59a47ded2018-01-25 17:46:06 +0000349 protected static class TestActivityDisplay extends ActivityDisplay {
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700350
351 private final ActivityStackSupervisor mSupervisor;
352 TestActivityDisplay(ActivityStackSupervisor supervisor, int displayId) {
353 super(supervisor, displayId);
354 mSupervisor = supervisor;
Andrii Kulianb1cdb102017-07-13 15:33:06 -0700355 }
356
357 @Override
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700358 <T extends ActivityStack> T createStackUnchecked(int windowingMode, int activityType,
359 int stackId, boolean onTop) {
360 if (windowingMode == WINDOWING_MODE_PINNED) {
361 return (T) new PinnedActivityStack(this, stackId, mSupervisor, onTop) {
Andrii Kulianb1cdb102017-07-13 15:33:06 -0700362 @Override
363 Rect getDefaultPictureInPictureBounds(float aspectRatio) {
364 return new Rect(50, 50, 100, 100);
365 }
Bryce Lee4e4a3ec2017-09-27 08:25:03 -0700366
367 @Override
368 PinnedStackWindowController createStackWindowController(int displayId,
369 boolean onTop, Rect outBounds) {
370 return mock(PinnedStackWindowController.class);
371 }
Andrii Kulianb1cdb102017-07-13 15:33:06 -0700372 };
373 } else {
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700374 return (T) new TestActivityStack(
375 this, stackId, mSupervisor, windowingMode, activityType, onTop);
Andrii Kulianb1cdb102017-07-13 15:33:06 -0700376 }
Bryce Lee04ab3462017-04-10 15:06:33 -0700377 }
Winson Chung59a47ded2018-01-25 17:46:06 +0000378
379 @Override
380 protected DisplayWindowController createWindowContainerController() {
381 return mock(DisplayWindowController.class);
382 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700383 }
384
Bryce Lee04ab3462017-04-10 15:06:33 -0700385 private static WindowManagerService prepareMockWindowManager() {
Bryce Lee4e4a3ec2017-09-27 08:25:03 -0700386 final WindowManagerService service = WindowTestUtils.getMockWindowManagerService();
Bryce Lee04ab3462017-04-10 15:06:33 -0700387
388 doAnswer((InvocationOnMock invocationOnMock) -> {
389 final Runnable runnable = invocationOnMock.<Runnable>getArgument(0);
390 if (runnable != null) {
391 runnable.run();
392 }
393 return null;
394 }).when(service).inSurfaceTransaction(any());
395
396 return service;
397 }
398
Bryce Leeaf691c02017-03-20 14:20:22 -0700399 /**
Bryce Lee4e4a3ec2017-09-27 08:25:03 -0700400 * Overrided of {@link ActivityStack} that tracks test metrics, such as the number of times a
Bryce Leeaf691c02017-03-20 14:20:22 -0700401 * method is called. Note that its functionality depends on the implementations of the
402 * construction arguments.
403 */
404 protected static class TestActivityStack<T extends StackWindowController>
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700405 extends ActivityStack<T> {
Bryce Leeaf691c02017-03-20 14:20:22 -0700406 private int mOnActivityRemovedFromStackCount = 0;
407 private T mContainerController;
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700408
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700409 static final int IS_TRANSLUCENT_UNSET = 0;
410 static final int IS_TRANSLUCENT_FALSE = 1;
411 static final int IS_TRANSLUCENT_TRUE = 2;
412 private int mIsTranslucent = IS_TRANSLUCENT_UNSET;
413
Wale Ogunwale30e441d2017-11-09 08:28:45 -0800414 static final int SUPPORTS_SPLIT_SCREEN_UNSET = 0;
415 static final int SUPPORTS_SPLIT_SCREEN_FALSE = 1;
416 static final int SUPPORTS_SPLIT_SCREEN_TRUE = 2;
417 private int mSupportsSplitScreen = SUPPORTS_SPLIT_SCREEN_UNSET;
418
Wale Ogunwale9dcf9462017-09-19 15:13:01 -0700419 TestActivityStack(ActivityDisplay display, int stackId, ActivityStackSupervisor supervisor,
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700420 int windowingMode, int activityType, boolean onTop) {
421 super(display, stackId, supervisor, windowingMode, activityType, onTop);
Bryce Leeaf691c02017-03-20 14:20:22 -0700422 }
423
424 @Override
425 void onActivityRemovedFromStack(ActivityRecord r) {
426 mOnActivityRemovedFromStackCount++;
427 super.onActivityRemovedFromStack(r);
428 }
429
430 // Returns the number of times {@link #onActivityRemovedFromStack} has been called
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700431 int onActivityRemovedFromStackInvocationCount() {
Bryce Leeaf691c02017-03-20 14:20:22 -0700432 return mOnActivityRemovedFromStackCount;
433 }
434
435 @Override
Wale Ogunwale034a8ec2017-09-02 17:14:40 -0700436 protected T createStackWindowController(int displayId, boolean onTop, Rect outBounds) {
Bryce Leeaf691c02017-03-20 14:20:22 -0700437 mContainerController = (T) WindowTestUtils.createMockStackWindowContainerController();
Bryce Leef3c6a472017-11-14 14:53:06 -0800438
439 // Primary pinned stacks require a non-empty out bounds to be set or else all tasks
440 // will be moved to the full screen stack.
441 if (getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
442 outBounds.set(0, 0, 100, 100);
443 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700444 return mContainerController;
445 }
446
447 @Override
448 T getWindowContainerController() {
449 return mContainerController;
450 }
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700451
452 void setIsTranslucent(boolean isTranslucent) {
453 mIsTranslucent = isTranslucent ? IS_TRANSLUCENT_TRUE : IS_TRANSLUCENT_FALSE;
454 }
455
456 @Override
Wale Ogunwale66e16852017-10-19 13:35:52 -0700457 boolean isStackTranslucent(ActivityRecord starting) {
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700458 switch (mIsTranslucent) {
459 case IS_TRANSLUCENT_TRUE:
460 return true;
461 case IS_TRANSLUCENT_FALSE:
462 return false;
463 case IS_TRANSLUCENT_UNSET:
464 default:
Wale Ogunwale66e16852017-10-19 13:35:52 -0700465 return super.isStackTranslucent(starting);
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700466 }
467 }
Wale Ogunwale30e441d2017-11-09 08:28:45 -0800468
469 void setSupportsSplitScreen(boolean supportsSplitScreen) {
470 mSupportsSplitScreen = supportsSplitScreen
471 ? SUPPORTS_SPLIT_SCREEN_TRUE : SUPPORTS_SPLIT_SCREEN_FALSE;
472 }
473
474 @Override
475 public boolean supportsSplitScreenWindowingMode() {
476 switch (mSupportsSplitScreen) {
477 case SUPPORTS_SPLIT_SCREEN_TRUE:
478 return true;
479 case SUPPORTS_SPLIT_SCREEN_FALSE:
480 return false;
481 case SUPPORTS_SPLIT_SCREEN_UNSET:
482 default:
483 return super.supportsSplitScreenWindowingMode();
484 }
485 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700486 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700487}