blob: d74d994844ef8e5c94b01e6491cc96eec3894bde [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
33import org.mockito.invocation.InvocationOnMock;
Bryce Leeaf691c02017-03-20 14:20:22 -070034
35import android.content.ComponentName;
36import android.content.Context;
37import android.content.Intent;
38import android.content.pm.ActivityInfo;
39import android.content.pm.ApplicationInfo;
Bryce Leeba8f4422017-11-20 12:35:57 -080040import android.content.pm.IPackageManager;
Bryce Leeaf691c02017-03-20 14:20:22 -070041import android.content.res.Configuration;
42import android.graphics.Rect;
Wale Ogunwale9dcf9462017-09-19 15:13:01 -070043import android.hardware.display.DisplayManager;
Bryce Lee3115bdf2017-04-05 08:39:40 -070044import android.os.HandlerThread;
Bryce Leeaf691c02017-03-20 14:20:22 -070045import android.os.Looper;
Bryce Lee93e7f792017-10-25 15:54:55 -070046import android.service.voice.IVoiceInteractionSession;
Bryce Leeaf691c02017-03-20 14:20:22 -070047import android.support.test.InstrumentationRegistry;
48import com.android.server.AttributeCache;
49import com.android.server.wm.AppWindowContainerController;
Bryce Lee4e4a3ec2017-09-27 08:25:03 -070050import com.android.server.wm.PinnedStackWindowController;
Bryce Leeaf691c02017-03-20 14:20:22 -070051import com.android.server.wm.StackWindowController;
Bryce Lee04ab3462017-04-10 15:06:33 -070052import com.android.server.wm.TaskWindowContainerController;
Bryce Leeaf691c02017-03-20 14:20:22 -070053import com.android.server.wm.WindowManagerService;
54import com.android.server.wm.WindowTestUtils;
Bryce Lee3115bdf2017-04-05 08:39:40 -070055import org.junit.After;
Bryce Leeaf691c02017-03-20 14:20:22 -070056import org.junit.Before;
57import org.mockito.MockitoAnnotations;
58
59/**
60 * A base class to handle common operations in activity related unit tests.
61 */
62public class ActivityTestsBase {
Bryce Lee939a9a32017-10-23 10:01:21 -070063 private static boolean sOneTimeSetupDone = false;
64
Bryce Leeaf691c02017-03-20 14:20:22 -070065 private final Context mContext = InstrumentationRegistry.getContext();
Bryce Lee3115bdf2017-04-05 08:39:40 -070066 private HandlerThread mHandlerThread;
Bryce Leeaf691c02017-03-20 14:20:22 -070067
Bryce Leeaf691c02017-03-20 14:20:22 -070068 @Before
69 public void setUp() throws Exception {
Bryce Lee939a9a32017-10-23 10:01:21 -070070 if (!sOneTimeSetupDone) {
71 sOneTimeSetupDone = true;
72
73 // Allows to mock package local classes and methods
74 System.setProperty("dexmaker.share_classloader", "true");
75 MockitoAnnotations.initMocks(this);
76 }
Bryce Lee3115bdf2017-04-05 08:39:40 -070077 mHandlerThread = new HandlerThread("ActivityTestsBaseThread");
78 mHandlerThread.start();
79 }
Bryce Leeaf691c02017-03-20 14:20:22 -070080
Bryce Lee3115bdf2017-04-05 08:39:40 -070081 @After
82 public void tearDown() {
83 mHandlerThread.quitSafely();
Bryce Leeaf691c02017-03-20 14:20:22 -070084 }
85
86 protected ActivityManagerService createActivityManagerService() {
Bryce Lee93e7f792017-10-25 15:54:55 -070087 final ActivityManagerService service =
88 setupActivityManagerService(new TestActivityManagerService(mContext));
89 AttributeCache.init(mContext);
90 return service;
Winson Chung3f0e59a2017-10-25 10:19:05 -070091 }
92
93 protected ActivityManagerService setupActivityManagerService(ActivityManagerService service) {
94 service = spy(service);
Bryce Leeba8f4422017-11-20 12:35:57 -080095 doReturn(mock(IPackageManager.class)).when(service).getPackageManager();
Bryce Lee4e4a3ec2017-09-27 08:25:03 -070096 service.mWindowManager = prepareMockWindowManager();
Bryce Lee840c5662017-04-13 10:02:51 -070097 return service;
Bryce Leeaf691c02017-03-20 14:20:22 -070098 }
99
Bryce Lee18d51592017-10-25 10:22:19 -0700100 /**
101 * Builder for creating new activities.
102 */
103 protected static class ActivityBuilder {
104 // An id appended to the end of the component name to make it unique
105 private static int sCurrentActivityId = 0;
Bryce Lee9f6affd2017-09-01 09:18:35 -0700106
Bryce Lee18d51592017-10-25 10:22:19 -0700107 // Default package name
Bryce Lee93e7f792017-10-25 15:54:55 -0700108 static final String DEFAULT_PACKAGE = "com.foo";
Bryce Leeaf691c02017-03-20 14:20:22 -0700109
Bryce Lee18d51592017-10-25 10:22:19 -0700110 // Default base activity name
111 private static final String DEFAULT_BASE_ACTIVITY_NAME = ".BarActivity";
112
113 private final ActivityManagerService mService;
114
115 private ComponentName mComponent;
116 private TaskRecord mTaskRecord;
117 private int mUid;
118 private boolean mCreateTask;
119 private ActivityStack mStack;
120
121 ActivityBuilder(ActivityManagerService service) {
122 mService = service;
Bryce Leeaf691c02017-03-20 14:20:22 -0700123 }
124
Bryce Lee18d51592017-10-25 10:22:19 -0700125 ActivityBuilder setComponent(ComponentName component) {
126 mComponent = component;
127 return this;
128 }
129
130 ActivityBuilder setTask(TaskRecord task) {
131 mTaskRecord = task;
132 return this;
133 }
134
135 ActivityBuilder setStack(ActivityStack stack) {
136 mStack = stack;
137 return this;
138 }
139
140 ActivityBuilder setCreateTask(boolean createTask) {
141 mCreateTask = createTask;
142 return this;
143 }
144
145 ActivityBuilder setUid(int uid) {
146 mUid = uid;
147 return this;
148 }
149
150 ActivityRecord build() {
151 if (mComponent == null) {
152 final int id = sCurrentActivityId++;
153 mComponent = ComponentName.createRelative(DEFAULT_PACKAGE,
154 DEFAULT_BASE_ACTIVITY_NAME + id);
155 }
156
157 if (mCreateTask) {
158 mTaskRecord = new TaskBuilder(mService.mStackSupervisor)
159 .setComponent(mComponent)
160 .setStack(mStack).build();
161 }
162
163 Intent intent = new Intent();
164 intent.setComponent(mComponent);
165 final ActivityInfo aInfo = new ActivityInfo();
166 aInfo.applicationInfo = new ApplicationInfo();
167 aInfo.applicationInfo.packageName = mComponent.getPackageName();
168 aInfo.applicationInfo.uid = mUid;
Bryce Lee18d51592017-10-25 10:22:19 -0700169 final ActivityRecord activity = new ActivityRecord(mService, null /* caller */,
170 0 /* launchedFromPid */, 0, null, intent, null,
171 aInfo /*aInfo*/, new Configuration(), null /* resultTo */, null /* resultWho */,
172 0 /* reqCode */, false /*componentSpecified*/, false /* rootVoiceInteraction */,
173 mService.mStackSupervisor, null /* options */, null /* sourceRecord */);
174 activity.mWindowContainerController = mock(AppWindowContainerController.class);
175
176 if (mTaskRecord != null) {
177 mTaskRecord.addActivityToTop(activity);
178 }
179
180 return activity;
181 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700182 }
183
Bryce Lee18d51592017-10-25 10:22:19 -0700184 /**
185 * Builder for creating new tasks.
186 */
187 protected static class TaskBuilder {
188 private final ActivityStackSupervisor mSupervisor;
Winson Chung1dbc8112017-09-28 18:05:31 -0700189
Bryce Lee18d51592017-10-25 10:22:19 -0700190 private ComponentName mComponent;
191 private String mPackage;
192 private int mFlags = 0;
193 private int mTaskId = 0;
Winson Chung0ec2a352017-10-26 11:38:30 -0700194 private int mUserId = 0;
Bryce Lee93e7f792017-10-25 15:54:55 -0700195 private IVoiceInteractionSession mVoiceSession;
Bryce Leeaf691c02017-03-20 14:20:22 -0700196
Bryce Lee18d51592017-10-25 10:22:19 -0700197 private ActivityStack mStack;
Bryce Leeaf691c02017-03-20 14:20:22 -0700198
Bryce Lee18d51592017-10-25 10:22:19 -0700199 TaskBuilder(ActivityStackSupervisor supervisor) {
200 mSupervisor = supervisor;
201 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700202
Bryce Lee18d51592017-10-25 10:22:19 -0700203 TaskBuilder setComponent(ComponentName component) {
204 mComponent = component;
205 return this;
206 }
207
208 TaskBuilder setPackage(String packageName) {
209 mPackage = packageName;
210 return this;
211 }
212
Bryce Lee93e7f792017-10-25 15:54:55 -0700213 TaskBuilder setVoiceSession(IVoiceInteractionSession session) {
214 mVoiceSession = session;
215 return this;
216 }
217
Bryce Lee18d51592017-10-25 10:22:19 -0700218 TaskBuilder setFlags(int flags) {
219 mFlags = flags;
220 return this;
221 }
222
223 TaskBuilder setTaskId(int taskId) {
224 mTaskId = taskId;
225 return this;
226 }
227
Winson Chung0ec2a352017-10-26 11:38:30 -0700228 TaskBuilder setUserId(int userId) {
229 mUserId = userId;
230 return this;
231 }
232
Bryce Lee18d51592017-10-25 10:22:19 -0700233 TaskBuilder setStack(ActivityStack stack) {
234 mStack = stack;
235 return this;
236 }
237
238 TaskRecord build() {
239 if (mStack == null) {
240 mStack = mSupervisor.getDefaultDisplay().createStack(
241 WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */);
242 }
243
244 final ActivityInfo aInfo = new ActivityInfo();
245 aInfo.applicationInfo = new ApplicationInfo();
246 aInfo.applicationInfo.packageName = mPackage;
247
248 Intent intent = new Intent();
249 intent.setComponent(mComponent);
250 intent.setFlags(mFlags);
251
252 final TaskRecord task = new TaskRecord(mSupervisor.mService, mTaskId, aInfo,
Bryce Lee93e7f792017-10-25 15:54:55 -0700253 intent /*intent*/, mVoiceSession, null /*_voiceInteractor*/);
Winson Chung0ec2a352017-10-26 11:38:30 -0700254 task.userId = mUserId;
Bryce Lee18d51592017-10-25 10:22:19 -0700255 mSupervisor.setFocusStackUnchecked("test", mStack);
256 mStack.addTask(task, true, "creating test task");
257 task.setStack(mStack);
258 task.setWindowContainerController(mock(TaskWindowContainerController.class));
Winson Chung0ec2a352017-10-26 11:38:30 -0700259 task.touchActiveTime();
Bryce Lee18d51592017-10-25 10:22:19 -0700260
261 return task;
262 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700263 }
264
265 /**
266 * An {@link ActivityManagerService} subclass which provides a test
267 * {@link ActivityStackSupervisor}.
268 */
269 protected static class TestActivityManagerService extends ActivityManagerService {
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700270 TestActivityManagerService(Context context) {
Bryce Leeaf691c02017-03-20 14:20:22 -0700271 super(context);
Bryce Lee04ab3462017-04-10 15:06:33 -0700272 mSupportsMultiWindow = true;
273 mSupportsMultiDisplay = true;
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700274 mSupportsSplitScreenMultiWindow = true;
275 mSupportsFreeformWindowManagement = true;
276 mSupportsPictureInPicture = true;
Bryce Lee6a0754a2017-10-10 17:53:50 -0700277 mWindowManager = WindowTestUtils.getMockWindowManagerService();
Bryce Leeaf691c02017-03-20 14:20:22 -0700278 }
279
280 @Override
Bryce Lee2a3cc462017-10-27 10:57:35 -0700281 final protected ActivityStackSupervisor createStackSupervisor() {
282 final ActivityStackSupervisor supervisor = spy(createTestSupervisor());
283
284 // No home stack is set.
285 doNothing().when(supervisor).moveHomeStackToFront(any());
286 doReturn(true).when(supervisor).moveHomeStackTaskToTop(any());
287 // Invoked during {@link ActivityStack} creation.
288 doNothing().when(supervisor).updateUIDsPresentOnDisplay();
289 // Always keep things awake.
290 doReturn(true).when(supervisor).hasAwakeDisplay();
291 // Called when moving activity to pinned stack.
292 doNothing().when(supervisor).ensureActivitiesVisibleLocked(any(), anyInt(), anyBoolean());
293 // Do not schedule idle timeouts
294 doNothing().when(supervisor).scheduleIdleTimeoutLocked(any());
295
296 supervisor.initialize();
297
298 return supervisor;
299 }
300
301 protected ActivityStackSupervisor createTestSupervisor() {
Bryce Lee3115bdf2017-04-05 08:39:40 -0700302 return new TestActivityStackSupervisor(this, mHandlerThread.getLooper());
Bryce Leeaf691c02017-03-20 14:20:22 -0700303 }
Bryce Lee29a649d2017-08-18 13:52:31 -0700304
305 @Override
306 void updateUsageStats(ActivityRecord component, boolean resumed) {
307 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700308 }
309
310 /**
311 * An {@link ActivityStackSupervisor} which stubs out certain methods that depend on
312 * setup not available in the test environment. Also specifies an injector for
313 */
314 protected static class TestActivityStackSupervisor extends ActivityStackSupervisor {
Bryce Lee2a3cc462017-10-27 10:57:35 -0700315 private ActivityDisplay mDisplay;
Bryce Lee943ebe72017-05-04 10:19:07 -0700316
Bryce Leeaf691c02017-03-20 14:20:22 -0700317 public TestActivityStackSupervisor(ActivityManagerService service, Looper looper) {
318 super(service, looper);
Wale Ogunwale9dcf9462017-09-19 15:13:01 -0700319 mDisplayManager =
320 (DisplayManager) mService.mContext.getSystemService(Context.DISPLAY_SERVICE);
Bryce Lee04ab3462017-04-10 15:06:33 -0700321 mWindowManager = prepareMockWindowManager();
Bryce Lee2a3cc462017-10-27 10:57:35 -0700322 }
323
324 @Override
325 public void initialize() {
326 super.initialize();
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700327 mDisplay = new TestActivityDisplay(this, DEFAULT_DISPLAY);
Wale Ogunwale9dcf9462017-09-19 15:13:01 -0700328 attachDisplay(mDisplay);
Bryce Lee04ab3462017-04-10 15:06:33 -0700329 }
330
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700331 @Override
332 ActivityDisplay getDefaultDisplay() {
333 return mDisplay;
334 }
335
Bryce Lee2a3cc462017-10-27 10:57:35 -0700336 // 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 -0700337 @Override
338 ActivityStack getNextFocusableStackLocked(ActivityStack currentFocus) {
339 return mFocusedStack;
340 }
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700341 }
342
343 private static class TestActivityDisplay extends ActivityDisplay {
344
345 private final ActivityStackSupervisor mSupervisor;
346 TestActivityDisplay(ActivityStackSupervisor supervisor, int displayId) {
347 super(supervisor, displayId);
348 mSupervisor = supervisor;
Andrii Kulianb1cdb102017-07-13 15:33:06 -0700349 }
350
351 @Override
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700352 <T extends ActivityStack> T createStackUnchecked(int windowingMode, int activityType,
353 int stackId, boolean onTop) {
354 if (windowingMode == WINDOWING_MODE_PINNED) {
355 return (T) new PinnedActivityStack(this, stackId, mSupervisor, onTop) {
Andrii Kulianb1cdb102017-07-13 15:33:06 -0700356 @Override
357 Rect getDefaultPictureInPictureBounds(float aspectRatio) {
358 return new Rect(50, 50, 100, 100);
359 }
Bryce Lee4e4a3ec2017-09-27 08:25:03 -0700360
361 @Override
362 PinnedStackWindowController createStackWindowController(int displayId,
363 boolean onTop, Rect outBounds) {
364 return mock(PinnedStackWindowController.class);
365 }
Andrii Kulianb1cdb102017-07-13 15:33:06 -0700366 };
367 } else {
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700368 return (T) new TestActivityStack(
369 this, stackId, mSupervisor, windowingMode, activityType, onTop);
Andrii Kulianb1cdb102017-07-13 15:33:06 -0700370 }
Bryce Lee04ab3462017-04-10 15:06:33 -0700371 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700372 }
373
Bryce Lee04ab3462017-04-10 15:06:33 -0700374 private static WindowManagerService prepareMockWindowManager() {
Bryce Lee4e4a3ec2017-09-27 08:25:03 -0700375 final WindowManagerService service = WindowTestUtils.getMockWindowManagerService();
Bryce Lee04ab3462017-04-10 15:06:33 -0700376
377 doAnswer((InvocationOnMock invocationOnMock) -> {
378 final Runnable runnable = invocationOnMock.<Runnable>getArgument(0);
379 if (runnable != null) {
380 runnable.run();
381 }
382 return null;
383 }).when(service).inSurfaceTransaction(any());
384
385 return service;
386 }
387
Bryce Leeaf691c02017-03-20 14:20:22 -0700388 /**
Bryce Lee4e4a3ec2017-09-27 08:25:03 -0700389 * Overrided of {@link ActivityStack} that tracks test metrics, such as the number of times a
Bryce Leeaf691c02017-03-20 14:20:22 -0700390 * method is called. Note that its functionality depends on the implementations of the
391 * construction arguments.
392 */
393 protected static class TestActivityStack<T extends StackWindowController>
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700394 extends ActivityStack<T> {
Bryce Leeaf691c02017-03-20 14:20:22 -0700395 private int mOnActivityRemovedFromStackCount = 0;
396 private T mContainerController;
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700397
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700398 static final int IS_TRANSLUCENT_UNSET = 0;
399 static final int IS_TRANSLUCENT_FALSE = 1;
400 static final int IS_TRANSLUCENT_TRUE = 2;
401 private int mIsTranslucent = IS_TRANSLUCENT_UNSET;
402
Wale Ogunwale30e441d2017-11-09 08:28:45 -0800403 static final int SUPPORTS_SPLIT_SCREEN_UNSET = 0;
404 static final int SUPPORTS_SPLIT_SCREEN_FALSE = 1;
405 static final int SUPPORTS_SPLIT_SCREEN_TRUE = 2;
406 private int mSupportsSplitScreen = SUPPORTS_SPLIT_SCREEN_UNSET;
407
Wale Ogunwale9dcf9462017-09-19 15:13:01 -0700408 TestActivityStack(ActivityDisplay display, int stackId, ActivityStackSupervisor supervisor,
Wale Ogunwale04a05ac2017-09-17 21:35:02 -0700409 int windowingMode, int activityType, boolean onTop) {
410 super(display, stackId, supervisor, windowingMode, activityType, onTop);
Bryce Leeaf691c02017-03-20 14:20:22 -0700411 }
412
413 @Override
414 void onActivityRemovedFromStack(ActivityRecord r) {
415 mOnActivityRemovedFromStackCount++;
416 super.onActivityRemovedFromStack(r);
417 }
418
419 // Returns the number of times {@link #onActivityRemovedFromStack} has been called
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700420 int onActivityRemovedFromStackInvocationCount() {
Bryce Leeaf691c02017-03-20 14:20:22 -0700421 return mOnActivityRemovedFromStackCount;
422 }
423
424 @Override
Wale Ogunwale034a8ec2017-09-02 17:14:40 -0700425 protected T createStackWindowController(int displayId, boolean onTop, Rect outBounds) {
Bryce Leeaf691c02017-03-20 14:20:22 -0700426 mContainerController = (T) WindowTestUtils.createMockStackWindowContainerController();
Bryce Leef3c6a472017-11-14 14:53:06 -0800427
428 // Primary pinned stacks require a non-empty out bounds to be set or else all tasks
429 // will be moved to the full screen stack.
430 if (getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
431 outBounds.set(0, 0, 100, 100);
432 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700433 return mContainerController;
434 }
435
436 @Override
437 T getWindowContainerController() {
438 return mContainerController;
439 }
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700440
441 void setIsTranslucent(boolean isTranslucent) {
442 mIsTranslucent = isTranslucent ? IS_TRANSLUCENT_TRUE : IS_TRANSLUCENT_FALSE;
443 }
444
445 @Override
Wale Ogunwale66e16852017-10-19 13:35:52 -0700446 boolean isStackTranslucent(ActivityRecord starting) {
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700447 switch (mIsTranslucent) {
448 case IS_TRANSLUCENT_TRUE:
449 return true;
450 case IS_TRANSLUCENT_FALSE:
451 return false;
452 case IS_TRANSLUCENT_UNSET:
453 default:
Wale Ogunwale66e16852017-10-19 13:35:52 -0700454 return super.isStackTranslucent(starting);
Wale Ogunwale7e1f5f52017-10-18 15:19:59 -0700455 }
456 }
Wale Ogunwale30e441d2017-11-09 08:28:45 -0800457
458 void setSupportsSplitScreen(boolean supportsSplitScreen) {
459 mSupportsSplitScreen = supportsSplitScreen
460 ? SUPPORTS_SPLIT_SCREEN_TRUE : SUPPORTS_SPLIT_SCREEN_FALSE;
461 }
462
463 @Override
464 public boolean supportsSplitScreenWindowingMode() {
465 switch (mSupportsSplitScreen) {
466 case SUPPORTS_SPLIT_SCREEN_TRUE:
467 return true;
468 case SUPPORTS_SPLIT_SCREEN_FALSE:
469 return false;
470 case SUPPORTS_SPLIT_SCREEN_UNSET:
471 default:
472 return super.supportsSplitScreenWindowingMode();
473 }
474 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700475 }
Bryce Leeaf691c02017-03-20 14:20:22 -0700476}