Loading services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +5 −0 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ class ActivityTestsBase extends SystemServiceTestsBase { } ActivityRecord build() { SystemServicesTestRule.checkHoldsLock(mService.mGlobalLock); try { mService.deferWindowLayout(); return buildInner(); Loading Loading @@ -394,6 +395,8 @@ class ActivityTestsBase extends SystemServiceTestsBase { } Task build() { SystemServicesTestRule.checkHoldsLock(mSupervisor.mService.mGlobalLock); if (mStack == null && mCreateStack) { TaskDisplayArea displayArea = mTaskDisplayArea != null ? mTaskDisplayArea : mSupervisor.mRootWindowContainer.getDefaultTaskDisplayArea(); Loading Loading @@ -501,6 +504,8 @@ class ActivityTestsBase extends SystemServiceTestsBase { } ActivityStack build() { SystemServicesTestRule.checkHoldsLock(mRootWindowContainer.mWmService.mGlobalLock); final int stackId = mStackId >= 0 ? mStackId : mTaskDisplayArea.getNextStackId(); final ActivityStack stack = mTaskDisplayArea.createStackUnchecked( mWindowingMode, mActivityType, stackId, mOnTop, mInfo, mIntent, Loading services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java +13 −14 Original line number Diff line number Diff line Loading @@ -100,7 +100,6 @@ public class SystemServicesTestRule implements TestRule { static int sNextDisplayId = DEFAULT_DISPLAY + 100; static int sNextTaskId = 100; private final AtomicBoolean mCurrentMessagesProcessed = new AtomicBoolean(false); private static final int[] TEST_USER_PROFILE_IDS = {}; private Context mContext; Loading Loading @@ -419,20 +418,20 @@ public class SystemServicesTestRule implements TestRule { if (wm == null) { return; } synchronized (mCurrentMessagesProcessed) { // Add a message to the handler queue and make sure it is fully processed before we move // on. This makes sure all previous messages in the handler are fully processed vs. just // popping them from the message queue. mCurrentMessagesProcessed.set(false); // Add a message to the handler queue and make sure it is fully processed before we move on. // This makes sure all previous messages in the handler are fully processed vs. just popping // them from the message queue. final AtomicBoolean currentMessagesProcessed = new AtomicBoolean(false); wm.mAnimator.getChoreographer().postFrameCallback(time -> { synchronized (mCurrentMessagesProcessed) { mCurrentMessagesProcessed.set(true); mCurrentMessagesProcessed.notifyAll(); synchronized (currentMessagesProcessed) { currentMessagesProcessed.set(true); currentMessagesProcessed.notifyAll(); } }); while (!mCurrentMessagesProcessed.get()) { while (!currentMessagesProcessed.get()) { synchronized (currentMessagesProcessed) { try { mCurrentMessagesProcessed.wait(); currentMessagesProcessed.wait(); } catch (InterruptedException e) { } } Loading services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java +17 −25 Original line number Diff line number Diff line Loading @@ -34,15 +34,12 @@ class WindowTestUtils { /** Creates a {@link Task} and adds it to the specified {@link ActivityStack}. */ static Task createTaskInStack(WindowManagerService service, ActivityStack stack, int userId) { synchronized (service.mGlobalLock) { final Task task = new ActivityTestsBase.TaskBuilder( stack.mStackSupervisor) final Task task = new ActivityTestsBase.TaskBuilder(stack.mStackSupervisor) .setUserId(userId) .setStack(stack) .build(); return task; } } /** Creates an {@link ActivityRecord} and adds it to the specified {@link Task}. */ static ActivityRecord createActivityRecordInTask(DisplayContent dc, Task task) { Loading @@ -52,24 +49,19 @@ class WindowTestUtils { } static ActivityRecord createTestActivityRecord(ActivityStack stack) { synchronized (stack.mAtmService.mGlobalLock) { final ActivityRecord activity = new ActivityTestsBase.ActivityBuilder( stack.mAtmService) final ActivityRecord activity = new ActivityTestsBase.ActivityBuilder(stack.mAtmService) .setStack(stack) .setCreateTask(true) .build(); postCreateActivitySetup(activity, stack.getDisplayContent()); return activity; } } static ActivityRecord createTestActivityRecord(DisplayContent dc) { synchronized (dc.mWmService.mGlobalLock) { final ActivityRecord activity = new ActivityBuilder(dc.mWmService.mAtmService).build(); postCreateActivitySetup(activity, dc); return activity; } } private static void postCreateActivitySetup(ActivityRecord activity, DisplayContent dc) { activity.onDisplayChanged(dc); Loading @@ -84,10 +76,10 @@ class WindowTestUtils { static TestWindowToken createTestWindowToken(int type, DisplayContent dc, boolean persistOnEmpty) { synchronized (dc.mWmService.mGlobalLock) { SystemServicesTestRule.checkHoldsLock(dc.mWmService.mGlobalLock); return new TestWindowToken(type, dc, persistOnEmpty); } } /* Used so we can gain access to some protected members of the {@link WindowToken} class */ static class TestWindowToken extends WindowToken { Loading services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java +92 −127 Original line number Diff line number Diff line Loading @@ -55,11 +55,7 @@ import com.android.server.AttributeCache; import org.junit.Before; import org.junit.BeforeClass; /** * Common base class for window manager unit test classes. * * Make sure any requests to WM hold the WM lock if needed b/73966377 */ /** Common base class for window manager unit test classes. */ class WindowTestsBase extends SystemServiceTestsBase { private static final String TAG = WindowTestsBase.class.getSimpleName(); Loading Loading @@ -94,23 +90,21 @@ class WindowTestsBase extends SystemServiceTestsBase { @Before public void setUpBase() { mWm = mSystemServicesTestRule.getWindowManagerService(); SystemServicesTestRule.checkHoldsLock(mWm.mGlobalLock); mTransaction = mSystemServicesTestRule.mTransaction; mMockSession = mock(Session.class); final Context context = getInstrumentation().getTargetContext(); // If @Before throws an exception, the error isn't logged. This will make sure any failures // in the set up are clear. This can be removed when b/37850063 is fixed. try { mMockSession = mock(Session.class); final Context context = getInstrumentation().getTargetContext(); mWm = mSystemServicesTestRule.getWindowManagerService(); mTransaction = mSystemServicesTestRule.mTransaction; beforeCreateDisplay(); context.getDisplay().getDisplayInfo(mDisplayInfo); mDisplayContent = createNewDisplay(true /* supportIme */); // Set-up some common windows. synchronized (mWm.mGlobalLock) { mWallpaperWindow = createCommonWindow(null, TYPE_WALLPAPER, "wallpaperWindow"); mImeWindow = createCommonWindow(null, TYPE_INPUT_METHOD, "mImeWindow"); mDisplayContent.mInputMethodWindow = mImeWindow; Loading @@ -130,7 +124,6 @@ class WindowTestsBase extends SystemServiceTestsBase { TYPE_APPLICATION_MEDIA_OVERLAY, "mChildAppWindowBelow"); mDisplayContent.getDisplayPolicy().setForceShowSystemBars(false); } // Adding a display will cause freezing the display. Make sure to wait until it's // unfrozen to not run into race conditions with the tests. Loading @@ -146,24 +139,20 @@ class WindowTestsBase extends SystemServiceTestsBase { } private WindowState createCommonWindow(WindowState parent, int type, String name) { synchronized (mWm.mGlobalLock) { final WindowState win = createWindow(parent, type, name); // Prevent common windows from been IMe targets // Prevent common windows from been IME targets. win.mAttrs.flags |= FLAG_NOT_FOCUSABLE; return win; } } private WindowToken createWindowToken( DisplayContent dc, int windowingMode, int activityType, int type) { synchronized (mWm.mGlobalLock) { if (type < FIRST_APPLICATION_WINDOW || type > LAST_APPLICATION_WINDOW) { return WindowTestUtils.createTestWindowToken(type, dc); } return createActivityRecord(dc, windowingMode, activityType); } } ActivityRecord createActivityRecord(DisplayContent dc, int windowingMode, int activityType) { return createTestActivityRecord(dc, windowingMode, activityType); Loading @@ -176,79 +165,61 @@ class WindowTestsBase extends SystemServiceTestsBase { } WindowState createWindow(WindowState parent, int type, String name) { synchronized (mWm.mGlobalLock) { return (parent == null) ? createWindow(parent, type, mDisplayContent, name) : createWindow(parent, type, parent.mToken, name); } } WindowState createWindow(WindowState parent, int type, String name, int ownerId) { synchronized (mWm.mGlobalLock) { return (parent == null) ? createWindow(parent, type, mDisplayContent, name, ownerId) : createWindow(parent, type, parent.mToken, name, ownerId); } } WindowState createWindowOnStack(WindowState parent, int windowingMode, int activityType, int type, DisplayContent dc, String name) { synchronized (mWm.mGlobalLock) { final WindowToken token = createWindowToken(dc, windowingMode, activityType, type); return createWindow(parent, type, token, name); } } WindowState createAppWindow(Task task, int type, String name) { synchronized (mWm.mGlobalLock) { final ActivityRecord activity = WindowTestUtils.createTestActivityRecord(task.getDisplayContent()); task.addChild(activity, 0); return createWindow(null, type, activity, name); } } WindowState createWindow(WindowState parent, int type, DisplayContent dc, String name) { synchronized (mWm.mGlobalLock) { final WindowToken token = createWindowToken( dc, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, type); return createWindow(parent, type, token, name, 0 /* ownerId */); } } WindowState createWindow(WindowState parent, int type, DisplayContent dc, String name, int ownerId) { synchronized (mWm.mGlobalLock) { final WindowToken token = createWindowToken( dc, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, type); return createWindow(parent, type, token, name, ownerId); } } WindowState createWindow(WindowState parent, int type, DisplayContent dc, String name, boolean ownerCanAddInternalSystemWindow) { synchronized (mWm.mGlobalLock) { final WindowToken token = createWindowToken( dc, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, type); return createWindow(parent, type, token, name, 0 /* ownerId */, ownerCanAddInternalSystemWindow); } } WindowState createWindow(WindowState parent, int type, WindowToken token, String name) { synchronized (mWm.mGlobalLock) { return createWindow(parent, type, token, name, 0 /* ownerId */, false /* ownerCanAddInternalSystemWindow */); } } WindowState createWindow(WindowState parent, int type, WindowToken token, String name, int ownerId) { synchronized (mWm.mGlobalLock) { return createWindow(parent, type, token, name, ownerId, false /* ownerCanAddInternalSystemWindow */); } } WindowState createWindow(WindowState parent, int type, WindowToken token, String name, int ownerId, boolean ownerCanAddInternalSystemWindow) { Loading @@ -261,7 +232,8 @@ class WindowTestsBase extends SystemServiceTestsBase { String name, int ownerId, int userId, boolean ownerCanAddInternalSystemWindow, WindowManagerService service, Session session, IWindow iWindow, WindowState.PowerManagerWrapper powerManagerWrapper) { synchronized (service.mGlobalLock) { SystemServicesTestRule.checkHoldsLock(service.mGlobalLock); final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(type); attrs.setTitle(name); Loading @@ -274,7 +246,6 @@ class WindowTestsBase extends SystemServiceTestsBase { token.addWindow(w); return w; } } static void makeWindowVisible(WindowState... windows) { for (WindowState win : windows) { Loading @@ -292,9 +263,7 @@ class WindowTestsBase extends SystemServiceTestsBase { } ActivityStack createTaskStackOnDisplay(int windowingMode, int activityType, DisplayContent dc) { synchronized (mWm.mGlobalLock) { return new ActivityTestsBase.StackBuilder( dc.mWmService.mAtmService.mRootWindowContainer) return new ActivityTestsBase.StackBuilder(dc.mWmService.mRoot) .setDisplay(dc) .setWindowingMode(windowingMode) .setActivityType(activityType) Loading @@ -302,13 +271,10 @@ class WindowTestsBase extends SystemServiceTestsBase { .setIntent(new Intent()) .build(); } } ActivityStack createTaskStackOnTaskDisplayArea( int windowingMode, int activityType, TaskDisplayArea tda) { synchronized (mWm.mGlobalLock) { return new ActivityTestsBase.StackBuilder( tda.mDisplayContent.mWmService.mAtmService.mRootWindowContainer) ActivityStack createTaskStackOnTaskDisplayArea(int windowingMode, int activityType, TaskDisplayArea tda) { return new ActivityTestsBase.StackBuilder(tda.mWmService.mRoot) .setTaskDisplayArea(tda) .setWindowingMode(windowingMode) .setActivityType(activityType) Loading @@ -316,7 +282,6 @@ class WindowTestsBase extends SystemServiceTestsBase { .setIntent(new Intent()) .build(); } } /** Creates a {@link Task} and adds it to the specified {@link ActivityStack}. */ Task createTaskInStack(ActivityStack stack, int userId) { Loading Loading @@ -365,10 +330,10 @@ class WindowTestsBase extends SystemServiceTestsBase { /** Creates a {@link com.android.server.wm.WindowTestUtils.TestWindowState} */ WindowTestUtils.TestWindowState createWindowState(WindowManager.LayoutParams attrs, WindowToken token) { synchronized (mWm.mGlobalLock) { SystemServicesTestRule.checkHoldsLock(mWm.mGlobalLock); return new WindowTestUtils.TestWindowState(mWm, mMockSession, mIWindow, attrs, token); } } /** Creates a {@link DisplayContent} as parts of simulate display info for test. */ DisplayContent createMockSimulatedDisplay() { Loading Loading
services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +5 −0 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ class ActivityTestsBase extends SystemServiceTestsBase { } ActivityRecord build() { SystemServicesTestRule.checkHoldsLock(mService.mGlobalLock); try { mService.deferWindowLayout(); return buildInner(); Loading Loading @@ -394,6 +395,8 @@ class ActivityTestsBase extends SystemServiceTestsBase { } Task build() { SystemServicesTestRule.checkHoldsLock(mSupervisor.mService.mGlobalLock); if (mStack == null && mCreateStack) { TaskDisplayArea displayArea = mTaskDisplayArea != null ? mTaskDisplayArea : mSupervisor.mRootWindowContainer.getDefaultTaskDisplayArea(); Loading Loading @@ -501,6 +504,8 @@ class ActivityTestsBase extends SystemServiceTestsBase { } ActivityStack build() { SystemServicesTestRule.checkHoldsLock(mRootWindowContainer.mWmService.mGlobalLock); final int stackId = mStackId >= 0 ? mStackId : mTaskDisplayArea.getNextStackId(); final ActivityStack stack = mTaskDisplayArea.createStackUnchecked( mWindowingMode, mActivityType, stackId, mOnTop, mInfo, mIntent, Loading
services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java +13 −14 Original line number Diff line number Diff line Loading @@ -100,7 +100,6 @@ public class SystemServicesTestRule implements TestRule { static int sNextDisplayId = DEFAULT_DISPLAY + 100; static int sNextTaskId = 100; private final AtomicBoolean mCurrentMessagesProcessed = new AtomicBoolean(false); private static final int[] TEST_USER_PROFILE_IDS = {}; private Context mContext; Loading Loading @@ -419,20 +418,20 @@ public class SystemServicesTestRule implements TestRule { if (wm == null) { return; } synchronized (mCurrentMessagesProcessed) { // Add a message to the handler queue and make sure it is fully processed before we move // on. This makes sure all previous messages in the handler are fully processed vs. just // popping them from the message queue. mCurrentMessagesProcessed.set(false); // Add a message to the handler queue and make sure it is fully processed before we move on. // This makes sure all previous messages in the handler are fully processed vs. just popping // them from the message queue. final AtomicBoolean currentMessagesProcessed = new AtomicBoolean(false); wm.mAnimator.getChoreographer().postFrameCallback(time -> { synchronized (mCurrentMessagesProcessed) { mCurrentMessagesProcessed.set(true); mCurrentMessagesProcessed.notifyAll(); synchronized (currentMessagesProcessed) { currentMessagesProcessed.set(true); currentMessagesProcessed.notifyAll(); } }); while (!mCurrentMessagesProcessed.get()) { while (!currentMessagesProcessed.get()) { synchronized (currentMessagesProcessed) { try { mCurrentMessagesProcessed.wait(); currentMessagesProcessed.wait(); } catch (InterruptedException e) { } } Loading
services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java +17 −25 Original line number Diff line number Diff line Loading @@ -34,15 +34,12 @@ class WindowTestUtils { /** Creates a {@link Task} and adds it to the specified {@link ActivityStack}. */ static Task createTaskInStack(WindowManagerService service, ActivityStack stack, int userId) { synchronized (service.mGlobalLock) { final Task task = new ActivityTestsBase.TaskBuilder( stack.mStackSupervisor) final Task task = new ActivityTestsBase.TaskBuilder(stack.mStackSupervisor) .setUserId(userId) .setStack(stack) .build(); return task; } } /** Creates an {@link ActivityRecord} and adds it to the specified {@link Task}. */ static ActivityRecord createActivityRecordInTask(DisplayContent dc, Task task) { Loading @@ -52,24 +49,19 @@ class WindowTestUtils { } static ActivityRecord createTestActivityRecord(ActivityStack stack) { synchronized (stack.mAtmService.mGlobalLock) { final ActivityRecord activity = new ActivityTestsBase.ActivityBuilder( stack.mAtmService) final ActivityRecord activity = new ActivityTestsBase.ActivityBuilder(stack.mAtmService) .setStack(stack) .setCreateTask(true) .build(); postCreateActivitySetup(activity, stack.getDisplayContent()); return activity; } } static ActivityRecord createTestActivityRecord(DisplayContent dc) { synchronized (dc.mWmService.mGlobalLock) { final ActivityRecord activity = new ActivityBuilder(dc.mWmService.mAtmService).build(); postCreateActivitySetup(activity, dc); return activity; } } private static void postCreateActivitySetup(ActivityRecord activity, DisplayContent dc) { activity.onDisplayChanged(dc); Loading @@ -84,10 +76,10 @@ class WindowTestUtils { static TestWindowToken createTestWindowToken(int type, DisplayContent dc, boolean persistOnEmpty) { synchronized (dc.mWmService.mGlobalLock) { SystemServicesTestRule.checkHoldsLock(dc.mWmService.mGlobalLock); return new TestWindowToken(type, dc, persistOnEmpty); } } /* Used so we can gain access to some protected members of the {@link WindowToken} class */ static class TestWindowToken extends WindowToken { Loading
services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java +92 −127 Original line number Diff line number Diff line Loading @@ -55,11 +55,7 @@ import com.android.server.AttributeCache; import org.junit.Before; import org.junit.BeforeClass; /** * Common base class for window manager unit test classes. * * Make sure any requests to WM hold the WM lock if needed b/73966377 */ /** Common base class for window manager unit test classes. */ class WindowTestsBase extends SystemServiceTestsBase { private static final String TAG = WindowTestsBase.class.getSimpleName(); Loading Loading @@ -94,23 +90,21 @@ class WindowTestsBase extends SystemServiceTestsBase { @Before public void setUpBase() { mWm = mSystemServicesTestRule.getWindowManagerService(); SystemServicesTestRule.checkHoldsLock(mWm.mGlobalLock); mTransaction = mSystemServicesTestRule.mTransaction; mMockSession = mock(Session.class); final Context context = getInstrumentation().getTargetContext(); // If @Before throws an exception, the error isn't logged. This will make sure any failures // in the set up are clear. This can be removed when b/37850063 is fixed. try { mMockSession = mock(Session.class); final Context context = getInstrumentation().getTargetContext(); mWm = mSystemServicesTestRule.getWindowManagerService(); mTransaction = mSystemServicesTestRule.mTransaction; beforeCreateDisplay(); context.getDisplay().getDisplayInfo(mDisplayInfo); mDisplayContent = createNewDisplay(true /* supportIme */); // Set-up some common windows. synchronized (mWm.mGlobalLock) { mWallpaperWindow = createCommonWindow(null, TYPE_WALLPAPER, "wallpaperWindow"); mImeWindow = createCommonWindow(null, TYPE_INPUT_METHOD, "mImeWindow"); mDisplayContent.mInputMethodWindow = mImeWindow; Loading @@ -130,7 +124,6 @@ class WindowTestsBase extends SystemServiceTestsBase { TYPE_APPLICATION_MEDIA_OVERLAY, "mChildAppWindowBelow"); mDisplayContent.getDisplayPolicy().setForceShowSystemBars(false); } // Adding a display will cause freezing the display. Make sure to wait until it's // unfrozen to not run into race conditions with the tests. Loading @@ -146,24 +139,20 @@ class WindowTestsBase extends SystemServiceTestsBase { } private WindowState createCommonWindow(WindowState parent, int type, String name) { synchronized (mWm.mGlobalLock) { final WindowState win = createWindow(parent, type, name); // Prevent common windows from been IMe targets // Prevent common windows from been IME targets. win.mAttrs.flags |= FLAG_NOT_FOCUSABLE; return win; } } private WindowToken createWindowToken( DisplayContent dc, int windowingMode, int activityType, int type) { synchronized (mWm.mGlobalLock) { if (type < FIRST_APPLICATION_WINDOW || type > LAST_APPLICATION_WINDOW) { return WindowTestUtils.createTestWindowToken(type, dc); } return createActivityRecord(dc, windowingMode, activityType); } } ActivityRecord createActivityRecord(DisplayContent dc, int windowingMode, int activityType) { return createTestActivityRecord(dc, windowingMode, activityType); Loading @@ -176,79 +165,61 @@ class WindowTestsBase extends SystemServiceTestsBase { } WindowState createWindow(WindowState parent, int type, String name) { synchronized (mWm.mGlobalLock) { return (parent == null) ? createWindow(parent, type, mDisplayContent, name) : createWindow(parent, type, parent.mToken, name); } } WindowState createWindow(WindowState parent, int type, String name, int ownerId) { synchronized (mWm.mGlobalLock) { return (parent == null) ? createWindow(parent, type, mDisplayContent, name, ownerId) : createWindow(parent, type, parent.mToken, name, ownerId); } } WindowState createWindowOnStack(WindowState parent, int windowingMode, int activityType, int type, DisplayContent dc, String name) { synchronized (mWm.mGlobalLock) { final WindowToken token = createWindowToken(dc, windowingMode, activityType, type); return createWindow(parent, type, token, name); } } WindowState createAppWindow(Task task, int type, String name) { synchronized (mWm.mGlobalLock) { final ActivityRecord activity = WindowTestUtils.createTestActivityRecord(task.getDisplayContent()); task.addChild(activity, 0); return createWindow(null, type, activity, name); } } WindowState createWindow(WindowState parent, int type, DisplayContent dc, String name) { synchronized (mWm.mGlobalLock) { final WindowToken token = createWindowToken( dc, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, type); return createWindow(parent, type, token, name, 0 /* ownerId */); } } WindowState createWindow(WindowState parent, int type, DisplayContent dc, String name, int ownerId) { synchronized (mWm.mGlobalLock) { final WindowToken token = createWindowToken( dc, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, type); return createWindow(parent, type, token, name, ownerId); } } WindowState createWindow(WindowState parent, int type, DisplayContent dc, String name, boolean ownerCanAddInternalSystemWindow) { synchronized (mWm.mGlobalLock) { final WindowToken token = createWindowToken( dc, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, type); return createWindow(parent, type, token, name, 0 /* ownerId */, ownerCanAddInternalSystemWindow); } } WindowState createWindow(WindowState parent, int type, WindowToken token, String name) { synchronized (mWm.mGlobalLock) { return createWindow(parent, type, token, name, 0 /* ownerId */, false /* ownerCanAddInternalSystemWindow */); } } WindowState createWindow(WindowState parent, int type, WindowToken token, String name, int ownerId) { synchronized (mWm.mGlobalLock) { return createWindow(parent, type, token, name, ownerId, false /* ownerCanAddInternalSystemWindow */); } } WindowState createWindow(WindowState parent, int type, WindowToken token, String name, int ownerId, boolean ownerCanAddInternalSystemWindow) { Loading @@ -261,7 +232,8 @@ class WindowTestsBase extends SystemServiceTestsBase { String name, int ownerId, int userId, boolean ownerCanAddInternalSystemWindow, WindowManagerService service, Session session, IWindow iWindow, WindowState.PowerManagerWrapper powerManagerWrapper) { synchronized (service.mGlobalLock) { SystemServicesTestRule.checkHoldsLock(service.mGlobalLock); final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(type); attrs.setTitle(name); Loading @@ -274,7 +246,6 @@ class WindowTestsBase extends SystemServiceTestsBase { token.addWindow(w); return w; } } static void makeWindowVisible(WindowState... windows) { for (WindowState win : windows) { Loading @@ -292,9 +263,7 @@ class WindowTestsBase extends SystemServiceTestsBase { } ActivityStack createTaskStackOnDisplay(int windowingMode, int activityType, DisplayContent dc) { synchronized (mWm.mGlobalLock) { return new ActivityTestsBase.StackBuilder( dc.mWmService.mAtmService.mRootWindowContainer) return new ActivityTestsBase.StackBuilder(dc.mWmService.mRoot) .setDisplay(dc) .setWindowingMode(windowingMode) .setActivityType(activityType) Loading @@ -302,13 +271,10 @@ class WindowTestsBase extends SystemServiceTestsBase { .setIntent(new Intent()) .build(); } } ActivityStack createTaskStackOnTaskDisplayArea( int windowingMode, int activityType, TaskDisplayArea tda) { synchronized (mWm.mGlobalLock) { return new ActivityTestsBase.StackBuilder( tda.mDisplayContent.mWmService.mAtmService.mRootWindowContainer) ActivityStack createTaskStackOnTaskDisplayArea(int windowingMode, int activityType, TaskDisplayArea tda) { return new ActivityTestsBase.StackBuilder(tda.mWmService.mRoot) .setTaskDisplayArea(tda) .setWindowingMode(windowingMode) .setActivityType(activityType) Loading @@ -316,7 +282,6 @@ class WindowTestsBase extends SystemServiceTestsBase { .setIntent(new Intent()) .build(); } } /** Creates a {@link Task} and adds it to the specified {@link ActivityStack}. */ Task createTaskInStack(ActivityStack stack, int userId) { Loading Loading @@ -365,10 +330,10 @@ class WindowTestsBase extends SystemServiceTestsBase { /** Creates a {@link com.android.server.wm.WindowTestUtils.TestWindowState} */ WindowTestUtils.TestWindowState createWindowState(WindowManager.LayoutParams attrs, WindowToken token) { synchronized (mWm.mGlobalLock) { SystemServicesTestRule.checkHoldsLock(mWm.mGlobalLock); return new WindowTestUtils.TestWindowState(mWm, mMockSession, mIWindow, attrs, token); } } /** Creates a {@link DisplayContent} as parts of simulate display info for test. */ DisplayContent createMockSimulatedDisplay() { Loading