Remove AppWidgetManagerInternal instance before adding to global registry
of LocalServices
b/69981755 introduces AppWidgetManagerInternal and added this instance
as key in Local Services. setup() phase of Second testcase onwards
throwing IllegalStateException as the AppWidgetManagerInternal interface
already added in the global registry of LocalServices in first time setup()
phase.
Bug: 147165870
Test: atest FrameworksServicesTests:com.android.server.appwidget.AppWidgetServiceImplTest
Change-Id: I9e74b1a06e1c9a4b0ee0cad982cecaac3059f7c9
Signed-off-by: Naga Venkata Durga Ashok Mutyala <quic_nmutya@quicinc.com>
diff --git a/services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java b/services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java
index f3c76b6..8871348 100644
--- a/services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java
+++ b/services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java
@@ -28,6 +28,7 @@
import android.app.admin.DevicePolicyManagerInternal;
import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetManagerInternal;
import android.appwidget.AppWidgetProviderInfo;
import android.appwidget.PendingHostUpdate;
import android.content.BroadcastReceiver;
@@ -80,6 +81,7 @@
super.setUp();
LocalServices.removeServiceForTest(DevicePolicyManagerInternal.class);
LocalServices.removeServiceForTest(ShortcutServiceInternal.class);
+ LocalServices.removeServiceForTest(AppWidgetManagerInternal.class);
mTestContext = new TestContext();
mPkgName = mTestContext.getOpPackageName();