Use mock window manager for BubbleController in tests
Bubbles are no longer part of the status bar window and
live in their own window now. This resulted in a new
window being created each time setUp step happened in
BubbleControllerTests without ever being removed, resulting
in OOM when running tests :(
This CL fixes it by using a mock window manager in tests.
Test: atest
Fixes: 155805511
Change-Id: Id1940aeb7ee94801fa5669a30a98e2ea9c92126b
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index ad8d57b..6691331 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -280,31 +280,6 @@
}
}
- public BubbleController(Context context,
- NotificationShadeWindowController notificationShadeWindowController,
- StatusBarStateController statusBarStateController,
- ShadeController shadeController,
- BubbleData data,
- ConfigurationController configurationController,
- NotificationInterruptStateProvider interruptionStateProvider,
- ZenModeController zenModeController,
- NotificationLockscreenUserManager notifUserManager,
- NotificationGroupManager groupManager,
- NotificationEntryManager entryManager,
- NotifPipeline notifPipeline,
- FeatureFlags featureFlags,
- DumpManager dumpManager,
- FloatingContentCoordinator floatingContentCoordinator,
- BubbleDataRepository dataRepository,
- SysUiState sysUiState,
- INotificationManager notificationManager) {
- this(context, notificationShadeWindowController, statusBarStateController, shadeController,
- data, null /* synchronizer */, configurationController, interruptionStateProvider,
- zenModeController, notifUserManager, groupManager, entryManager,
- notifPipeline, featureFlags, dumpManager, floatingContentCoordinator,
- dataRepository, sysUiState, notificationManager);
- }
-
/**
* Injected constructor. See {@link BubbleModule}.
*/
@@ -326,7 +301,8 @@
FloatingContentCoordinator floatingContentCoordinator,
BubbleDataRepository dataRepository,
SysUiState sysUiState,
- INotificationManager notificationManager) {
+ INotificationManager notificationManager,
+ WindowManager windowManager) {
dumpManager.registerDumpable(TAG, this);
mContext = context;
mShadeController = shadeController;
@@ -395,7 +371,7 @@
}
mSurfaceSynchronizer = synchronizer;
- mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
+ mWindowManager = windowManager;
mBarService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));