Do not depend on actual WindowManagerService object.
The Activity unit tests do not need a real instance of
WindowManagerService and can instead use a mock.
Test: bit FrameworksServicesTests:com.android.server.am.ActivityRecordTests
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStarterTests
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackSupervisorTests
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackTests
Bug: 67629551
Change-Id: I2ab681eb88ebfa7113838dab19a3a1c017132955
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
index 1f6dda1..cc8bd69 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
@@ -55,10 +55,6 @@
private final Context mContext = InstrumentationRegistry.getContext();
private HandlerThread mHandlerThread;
- // Grabbing an instance of {@link WindowManagerService} creates it if not present so this must
- // be called at before any tests.
- private final WindowManagerService mWms = WindowTestUtils.getWindowManagerService(mContext);
-
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
@@ -136,7 +132,7 @@
mSupportsSplitScreenMultiWindow = true;
mSupportsFreeformWindowManagement = true;
mSupportsPictureInPicture = true;
- mWindowManager = WindowTestUtils.getWindowManagerService(context);
+ mWindowManager = WindowTestUtils.getMockWindowManagerService();
}
@Override