From 30fa728060dcd0fd804f73c047917fca5eb808c1 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Tue, 12 May 2020 15:01:19 +0800 Subject: [PATCH] Fix other tests be affected by mocked local services. Remove mocked local services after test finish, so it won't affect other tests. Fixes: 156221489 Test: atest ActivityStartInterceptorTest AppWindowTokenTests Change-Id: I2e868204fe098c616ff8b2b17c3d47e42d799124 --- .../android/server/wm/ActivityStartInterceptorTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java index fc256b09f2b22..702d9d3142fb1 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java @@ -53,6 +53,7 @@ import com.android.server.LocalServices; import com.android.server.am.ActivityManagerService; import com.android.server.pm.PackageManagerService; +import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -161,6 +162,12 @@ public class ActivityStartInterceptorTest { mAInfo.packageName = mAInfo.applicationInfo.packageName = TEST_PACKAGE_NAME; } + @After + public void tearDown() { + LocalServices.removeServiceForTest(ActivityManagerInternal.class); + LocalServices.removeServiceForTest(DevicePolicyManagerInternal.class); + } + @Test public void testSuspendedByAdminPackage() { // GIVEN the package we're about to launch is currently suspended