From e8a7e97ff28cb26964e6dbb93a37a66d2ce0b3ef Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Fri, 3 Sep 2021 00:08:10 -0400 Subject: [PATCH] Manually register Dumpables to DumpManager Dependency.get() automatically registers its managed objects to the DumpManager if they implement Dumpable. However, if code is refactored that removes all usages of Dependency.get() in favor of Dagger injection, then there is no longer a guarantee that the class in question will be registered to DumpManager (and so included in bug reports). Instead, remove the auto-registration feature of Dependency in favor of manually registering all dumpables with the DumpManager. Bug: 198713580 Test: atest Change-Id: Ie02a44fb7da0b76bf53da874cc9eee030a1b9173 Merged-In: Ie02a44fb7da0b76bf53da874cc9eee030a1b9173 --- .../src/com/android/systemui/Dependency.java | 16 --- .../systemui/ForegroundServiceController.java | 3 +- .../colorextraction/SysuiColorExtractor.java | 24 +++- .../systemui/dagger/DependencyProvider.java | 97 +--------------- .../systemui/dagger/SystemUIModule.java | 6 +- .../com/android/systemui/dump/DumpManager.kt | 9 ++ .../systemui/fragments/FragmentService.java | 9 +- .../systemui/keyguard/ScreenLifecycle.java | 4 +- .../keyguard/WakefulnessLifecycle.java | 6 +- .../systemui/navigationbar/NavigationBar.java | 4 +- .../NavigationBarController.java | 13 ++- .../NavigationModeController.java | 6 +- .../recents/OverviewProxyService.java | 6 +- .../systemui/statusbar/CommandQueue.java | 3 +- ...NotificationLockscreenUserManagerImpl.java | 10 +- .../statusbar/NotificationMediaManager.java | 8 +- .../NotificationRemoteInputManager.java | 6 +- .../StatusBarStateControllerImpl.java | 11 +- .../dagger/StatusBarDependenciesModule.java | 16 +-- .../NotificationEntryManager.java | 106 +++++++++--------- .../NotificationGroupManagerLegacy.java | 14 ++- .../legacy/VisualStabilityManager.java | 5 +- .../dagger/NotificationsModule.java | 20 ++-- .../init/NotificationsControllerImpl.kt | 3 +- .../row/NotificationGutsManager.java | 6 +- .../phone/DarkIconDispatcherImpl.java | 8 +- .../statusbar/phone/DozeParameters.java | 6 +- .../statusbar/phone/LightBarController.java | 11 +- .../systemui/statusbar/phone/StatusBar.java | 6 +- .../phone/StatusBarIconControllerImpl.java | 5 +- .../phone/dagger/StatusBarPhoneModule.java | 7 +- .../policy/ExtensionControllerImpl.java | 3 +- .../policy/FlashlightControllerImpl.java | 4 +- .../policy/HotspotControllerImpl.java | 9 +- .../policy/KeyguardStateControllerImpl.java | 12 +- .../policy/SecurityControllerImpl.java | 6 +- .../policy/SensorPrivacyControllerImpl.java | 3 +- .../policy/UserSwitcherController.java | 6 +- .../policy/ZenModeControllerImpl.java | 10 +- .../android/systemui/tracing/ProtoTracer.java | 11 +- .../systemui/util/leak/GarbageMonitor.java | 6 +- .../systemui/util/leak/LeakDetector.java | 20 +++- .../android/systemui/TestableDependency.java | 5 - .../SysuiColorExtractorTests.java | 21 +++- .../keyguard/ScreenLifecycleTest.java | 3 +- .../keyguard/WakefulnessLifecycleTest.java | 4 +- .../NavigationBarControllerTest.java | 4 +- ...NotificationLockscreenUserManagerTest.java | 4 +- .../NotificationRemoteInputManagerTest.java | 10 +- .../statusbar/SmartReplyControllerTest.java | 4 +- .../StatusBarStateControllerImplTest.kt | 4 +- .../NotificationEntryManagerTest.java | 9 +- .../notification/NotificationFilterTest.java | 4 +- .../VisualStabilityManagerTest.java | 4 +- ...NotificationEntryManagerInflationTest.java | 9 +- .../row/NotificationGutsManagerTest.java | 3 +- .../row/NotificationTestHelper.java | 4 +- .../phone/LightBarControllerTest.java | 9 +- ...ificationGroupAlertTransferHelperTest.java | 4 +- .../NotificationGroupManagerLegacyTest.java | 4 +- .../phone/NotificationPanelViewTest.java | 7 +- .../StatusBarKeyguardViewManagerTest.java | 6 +- .../statusbar/phone/StatusBarTest.java | 8 +- .../policy/ExtensionControllerImplTest.java | 8 +- .../policy/HotspotControllerImplTest.java | 5 +- .../policy/KeyguardStateControllerTest.java | 11 +- .../policy/SecurityControllerTest.java | 5 +- .../policy/UserSwitcherControllerTest.kt | 8 +- .../policy/ZenModeControllerImplTest.java | 10 +- .../util/leak/GarbageMonitorTest.java | 7 +- .../systemui/util/leak/LeakDetectorTest.java | 6 +- 71 files changed, 442 insertions(+), 292 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index 7adf8b591e12d..c73d19b5a20d7 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -597,11 +597,6 @@ public class Dependency { if (obj == null) { obj = createDependency(key); mDependencies.put(key, obj); - - // TODO: Get dependencies to register themselves instead - if (autoRegisterModulesForDump() && obj instanceof Dumpable) { - mDumpManager.registerDumpable(obj.getClass().getName(), (Dumpable) obj); - } } return obj; } @@ -619,17 +614,6 @@ public class Dependency { return provider.createDependency(); } - // Currently, there are situations in tests where we might create more than one instance of a - // thing that should be a singleton: the "real" one (created by Dagger, usually as a result of - // inflating a view), and a mocked one (injected into Dependency). If we register the mocked - // one, the DumpManager will throw an exception complaining (rightly) that we have too many - // things registered with that name. So in tests, we disable the auto-registration until the - // root cause is fixed, i.e. inflated views in tests with Dagger dependencies. - @VisibleForTesting - protected boolean autoRegisterModulesForDump() { - return true; - } - private static Dependency sDependency; /** diff --git a/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java b/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java index d859a63d09430..15e8c4e7abfb4 100644 --- a/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java +++ b/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java @@ -42,7 +42,8 @@ public class ForegroundServiceController { private final Handler mMainHandler; @Inject - public ForegroundServiceController(AppOpsController appOpsController, + public ForegroundServiceController( + AppOpsController appOpsController, @Main Handler mainHandler) { mMainHandler = mainHandler; appOpsController.addCallback(APP_OPS, (code, uid, packageName, active) -> { diff --git a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java index 5b33428ff5f1c..7c281f9426278 100644 --- a/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java +++ b/packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java @@ -29,6 +29,7 @@ import com.android.internal.colorextraction.types.Tonal; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.Dumpable; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import com.android.systemui.statusbar.policy.ConfigurationController; import java.io.FileDescriptor; @@ -50,19 +51,32 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable, private final GradientColors mBackdropColors; @Inject - public SysuiColorExtractor(Context context, ConfigurationController configurationController) { - this(context, new Tonal(context), configurationController, - context.getSystemService(WallpaperManager.class), false /* immediately */); + public SysuiColorExtractor( + Context context, + ConfigurationController configurationController, + DumpManager dumpManager) { + this( + context, + new Tonal(context), + configurationController, + context.getSystemService(WallpaperManager.class), + dumpManager, + false /* immediately */); } @VisibleForTesting - public SysuiColorExtractor(Context context, ExtractionType type, + public SysuiColorExtractor( + Context context, + ExtractionType type, ConfigurationController configurationController, - WallpaperManager wallpaperManager, boolean immediately) { + WallpaperManager wallpaperManager, + DumpManager dumpManager, + boolean immediately) { super(context, type, immediately, wallpaperManager); mTonal = type instanceof Tonal ? (Tonal) type : new Tonal(context); mNeutralColorsLock = new GradientColors(); configurationController.addCallback(this); + dumpManager.registerDumpable(getClass().getSimpleName(), this); mBackdropColors = new GradientColors(); mBackdropColors.setMainColor(Color.BLACK); diff --git a/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java b/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java index e7974bc3e6c9e..2d873f26c0c2a 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java @@ -36,11 +36,8 @@ import android.os.UserHandle; import android.view.Choreographer; import android.view.IWindowManager; import android.view.LayoutInflater; -import android.view.WindowManager; -import android.view.accessibility.AccessibilityManager; import com.android.internal.logging.MetricsLogger; -import com.android.internal.logging.UiEventLogger; import com.android.internal.util.NotificationMessagingUtil; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; @@ -51,9 +48,7 @@ import com.android.systemui.R; import com.android.systemui.accessibility.AccessibilityButtonModeObserver; import com.android.systemui.accessibility.AccessibilityButtonTargetsObserver; import com.android.systemui.accessibility.ModeSwitchesController; -import com.android.systemui.accessibility.SystemActions; import com.android.systemui.accessibility.floatingmenu.AccessibilityFloatingMenuController; -import com.android.systemui.assist.AssistManager; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.logging.BroadcastDispatcherLogger; import com.android.systemui.dagger.qualifiers.Background; @@ -62,48 +57,28 @@ import com.android.systemui.doze.AlwaysOnDisplayPolicy; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.LifecycleScreenStatusProvider; -import com.android.systemui.model.SysUiState; -import com.android.systemui.navigationbar.NavigationBarA11yHelper; -import com.android.systemui.navigationbar.NavigationBarController; -import com.android.systemui.navigationbar.NavigationBarOverlayController; -import com.android.systemui.navigationbar.NavigationModeController; -import com.android.systemui.navigationbar.TaskbarDelegate; -import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.qs.ReduceBrightColorsController; -import com.android.systemui.recents.OverviewProxyService; -import com.android.systemui.recents.Recents; import com.android.systemui.settings.UserTracker; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.DevicePolicyManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListeners; import com.android.systemui.shared.system.WindowManagerWrapper; -import com.android.systemui.statusbar.CommandQueue; -import com.android.systemui.statusbar.NotificationRemoteInputManager; -import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.phone.AutoHideController; import com.android.systemui.statusbar.phone.ConfigurationControllerImpl; -import com.android.systemui.statusbar.phone.ShadeController; -import com.android.systemui.statusbar.phone.StatusBar; -import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DataSaverController; -import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.theme.ThemeOverlayApplier; -import com.android.systemui.util.leak.LeakDetector; -import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.unfold.UnfoldTransitionFactory; import com.android.systemui.unfold.UnfoldTransitionProgressProvider; import com.android.systemui.unfold.config.UnfoldTransitionConfig; -import com.android.wm.shell.legacysplitscreen.LegacySplitScreen; -import com.android.wm.shell.pip.Pip; +import com.android.systemui.util.leak.LeakDetector; +import com.android.systemui.util.settings.SecureSettings; -import java.util.Optional; import java.util.concurrent.Executor; import javax.inject.Named; -import dagger.Lazy; import dagger.Module; import dagger.Provides; @@ -171,9 +146,8 @@ public class DependencyProvider { /** */ @Provides @SysUISingleton - public LeakDetector provideLeakDetector() { - return LeakDetector.create(); - + public LeakDetector provideLeakDetector(DumpManager dumpManager) { + return LeakDetector.create(dumpManager); } @SuppressLint("MissingPermission") @@ -205,69 +179,6 @@ public class DependencyProvider { context.getString(R.string.themepicker_overlayable_package), dumpManager); } - /** */ - @Provides - @SysUISingleton - public NavigationBarController provideNavigationBarController(Context context, - WindowManager windowManager, - Lazy assistManagerLazy, - AccessibilityManager accessibilityManager, - AccessibilityManagerWrapper accessibilityManagerWrapper, - DeviceProvisionedController deviceProvisionedController, - MetricsLogger metricsLogger, - OverviewProxyService overviewProxyService, - NavigationModeController navigationModeController, - AccessibilityButtonModeObserver accessibilityButtonModeObserver, - StatusBarStateController statusBarStateController, - SysUiState sysUiFlagsContainer, - BroadcastDispatcher broadcastDispatcher, - CommandQueue commandQueue, - Optional pipOptional, - Optional splitScreenOptional, - Optional recentsOptional, - Lazy> statusBarOptionalLazy, - ShadeController shadeController, - NotificationRemoteInputManager notificationRemoteInputManager, - NotificationShadeDepthController notificationShadeDepthController, - SystemActions systemActions, - @Main Handler mainHandler, - UiEventLogger uiEventLogger, - NavigationBarOverlayController navBarOverlayController, - ConfigurationController configurationController, - NavigationBarA11yHelper navigationBarA11yHelper, - TaskbarDelegate taskbarDelegate, - UserTracker userTracker) { - return new NavigationBarController(context, - windowManager, - assistManagerLazy, - accessibilityManager, - accessibilityManagerWrapper, - deviceProvisionedController, - metricsLogger, - overviewProxyService, - navigationModeController, - accessibilityButtonModeObserver, - statusBarStateController, - sysUiFlagsContainer, - broadcastDispatcher, - commandQueue, - pipOptional, - splitScreenOptional, - recentsOptional, - statusBarOptionalLazy, - shadeController, - notificationRemoteInputManager, - notificationShadeDepthController, - systemActions, - mainHandler, - uiEventLogger, - navBarOverlayController, - configurationController, - navigationBarA11yHelper, - taskbarDelegate, - userTracker); - } - /** */ @Provides @SysUISingleton diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java index d333341ccd623..3b459d1427d5b 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java @@ -143,8 +143,10 @@ public abstract class SystemUIModule { @SysUISingleton @Provides - static SysUiState provideSysUiState() { - return new SysUiState(); + static SysUiState provideSysUiState(DumpManager dumpManager) { + final SysUiState state = new SysUiState(); + dumpManager.registerDumpable(state); + return state; } @BindsOptionalOf diff --git a/packages/SystemUI/src/com/android/systemui/dump/DumpManager.kt b/packages/SystemUI/src/com/android/systemui/dump/DumpManager.kt index 5b327bd5e4c12..b0f3959119c84 100644 --- a/packages/SystemUI/src/com/android/systemui/dump/DumpManager.kt +++ b/packages/SystemUI/src/com/android/systemui/dump/DumpManager.kt @@ -55,6 +55,15 @@ open class DumpManager @Inject constructor() { dumpables[name] = RegisteredDumpable(name, module) } + /** + * Same as the above override, but automatically uses the simple class name as the dumpable + * name. + */ + @Synchronized + fun registerDumpable(module: Dumpable) { + registerDumpable(module::class.java.simpleName, module) + } + /** * Unregisters a previously-registered dumpable. */ diff --git a/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java b/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java index 37b8a2c953fe3..4f5a969c97911 100644 --- a/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java +++ b/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java @@ -22,6 +22,7 @@ import android.view.View; import com.android.systemui.Dumpable; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import com.android.systemui.qs.QSFragment; import com.android.systemui.statusbar.phone.CollapsedStatusBarFragment; import com.android.systemui.statusbar.policy.ConfigurationController; @@ -60,11 +61,15 @@ public class FragmentService implements Dumpable { }; @Inject - public FragmentService(FragmentCreator.Factory fragmentCreatorFactory, - ConfigurationController configurationController) { + public FragmentService( + FragmentCreator.Factory fragmentCreatorFactory, + ConfigurationController configurationController, + DumpManager dumpManager) { mFragmentCreator = fragmentCreatorFactory.build(); initInjectionMap(); configurationController.addCallback(mConfigurationListener); + + dumpManager.registerDumpable(getClass().getSimpleName(), this); } ArrayMap getInjectionMap() { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java index 084e84a7a77aa..30983aacd7d27 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ScreenLifecycle.java @@ -20,6 +20,7 @@ import android.os.Trace; import com.android.systemui.Dumpable; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -40,7 +41,8 @@ public class ScreenLifecycle extends Lifecycle impleme private int mScreenState = SCREEN_OFF; @Inject - public ScreenLifecycle() { + public ScreenLifecycle(DumpManager dumpManager) { + dumpManager.registerDumpable(getClass().getSimpleName(), this); } public int getScreenState() { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java index 6f878d19aa4bf..2e1c9faf88487 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/WakefulnessLifecycle.java @@ -32,6 +32,7 @@ import androidx.annotation.Nullable; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -83,10 +84,13 @@ public class WakefulnessLifecycle extends Lifecycle startingSurface, - SmartspaceTransitionController smartspaceTransitionController) { + SmartspaceTransitionController smartspaceTransitionController, + DumpManager dumpManager) { super(broadcastDispatcher); mContext = context; mPipOptional = pipOptional; @@ -558,6 +560,8 @@ public class OverviewProxyService extends CurrentUserTracker implements // Assumes device always starts with back button until launcher tells it that it does not mNavBarButtonAlpha = 1.0f; + dumpManager.registerDumpable(getClass().getSimpleName(), this); + // Listen for nav bar mode changes mNavBarMode = navModeController.addListener(this); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index aba1a249d3492..6676901997bf0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -79,7 +79,8 @@ import java.util.ArrayList; * coalescing these calls so they don't stack up. For the calls * are coalesced, note that they are all idempotent. */ -public class CommandQueue extends IStatusBar.Stub implements CallbackController, +public class CommandQueue extends IStatusBar.Stub implements + CallbackController, DisplayManager.DisplayListener { private static final String TAG = CommandQueue.class.getSimpleName(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java index e7e9404c9d3e7..db7d5c113031b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java @@ -50,6 +50,7 @@ import com.android.systemui.Dumpable; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.recents.OverviewProxyService; @@ -72,7 +73,9 @@ import javax.inject.Inject; */ @SysUISingleton public class NotificationLockscreenUserManagerImpl implements - Dumpable, NotificationLockscreenUserManager, StateListener { + Dumpable, + NotificationLockscreenUserManager, + StateListener { private static final String TAG = "LockscreenUserManager"; private static final boolean ENABLE_LOCK_SCREEN_ALLOW_REMOTE_INPUT = false; @@ -202,7 +205,8 @@ public class NotificationLockscreenUserManagerImpl implements StatusBarStateController statusBarStateController, @Main Handler mainHandler, DeviceProvisionedController deviceProvisionedController, - KeyguardStateController keyguardStateController) { + KeyguardStateController keyguardStateController, + DumpManager dumpManager) { mContext = context; mMainHandler = mainHandler; mDevicePolicyManager = devicePolicyManager; @@ -215,6 +219,8 @@ public class NotificationLockscreenUserManagerImpl implements mBroadcastDispatcher = broadcastDispatcher; mDeviceProvisionedController = deviceProvisionedController; mKeyguardStateController = keyguardStateController; + + dumpManager.registerDumpable(this); } public void setUpWithPresenter(NotificationPresenter presenter) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index 36d2d866f74db..dcb1e4f341888 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java @@ -52,6 +52,7 @@ import com.android.systemui.Dumpable; import com.android.systemui.animation.Interpolators; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.media.MediaData; import com.android.systemui.media.MediaDataManager; @@ -73,7 +74,6 @@ import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ScrimState; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.KeyguardStateController; -import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.Utils; import com.android.systemui.util.concurrency.DelayableExecutor; @@ -188,8 +188,8 @@ public class NotificationMediaManager implements Dumpable { NotifCollection notifCollection, FeatureFlags featureFlags, @Main DelayableExecutor mainExecutor, - DeviceConfigProxy deviceConfig, - MediaDataManager mediaDataManager) { + MediaDataManager mediaDataManager, + DumpManager dumpManager) { mContext = context; mMediaArtworkProcessor = mediaArtworkProcessor; mKeyguardBypassController = keyguardBypassController; @@ -214,6 +214,8 @@ public class NotificationMediaManager implements Dumpable { setupNotifPipeline(); mUsingNotifPipeline = true; } + + dumpManager.registerDumpable(this); } private void setupNotifPipeline() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index 625d9cd72e046..18a3d86589da5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -54,6 +54,7 @@ import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.dagger.StatusBarDependenciesModule; import com.android.systemui.statusbar.notification.NotificationEntryListener; @@ -290,7 +291,8 @@ public class NotificationRemoteInputManager implements Dumpable { @Main Handler mainHandler, RemoteInputUriController remoteInputUriController, NotificationClickNotifier clickNotifier, - ActionClickLogger logger) { + ActionClickLogger logger, + DumpManager dumpManager) { mContext = context; mLockscreenUserManager = lockscreenUserManager; mSmartReplyController = smartReplyController; @@ -307,6 +309,8 @@ public class NotificationRemoteInputManager implements Dumpable { mRemoteInputUriController = remoteInputUriController; mClickNotifier = clickNotifier; + dumpManager.registerDumpable(this); + notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() { @Override public void onPreEntryUpdated(NotificationEntry entry) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java index 545dca8e61402..19876ba063bbc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java @@ -48,6 +48,7 @@ import com.android.systemui.DejankUtils; import com.android.systemui.Dumpable; import com.android.systemui.animation.Interpolators; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.policy.CallbackController; @@ -63,8 +64,10 @@ import javax.inject.Inject; * Tracks and reports on {@link StatusBarState}. */ @SysUISingleton -public class StatusBarStateControllerImpl implements SysuiStatusBarStateController, - CallbackController, Dumpable { +public class StatusBarStateControllerImpl implements + SysuiStatusBarStateController, + CallbackController, + Dumpable { private static final String TAG = "SbStateController"; private static final boolean DEBUG_IMMERSIVE_APPS = SystemProperties.getBoolean("persist.debug.immersive_apps", false); @@ -146,11 +149,13 @@ public class StatusBarStateControllerImpl implements SysuiStatusBarStateControll private Interpolator mDozeInterpolator = Interpolators.FAST_OUT_SLOW_IN; @Inject - public StatusBarStateControllerImpl(UiEventLogger uiEventLogger) { + public StatusBarStateControllerImpl(UiEventLogger uiEventLogger, DumpManager dumpManager) { mUiEventLogger = uiEventLogger; for (int i = 0; i < HISTORY_SIZE; i++) { mHistoricalRecords[i] = new HistoricalState(); } + + dumpManager.registerDumpable(this); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java index f2cf93ed9dc8c..94f186f007784 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java @@ -24,6 +24,7 @@ import android.os.Handler; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.media.MediaDataManager; import com.android.systemui.plugins.ActivityStarter; @@ -65,7 +66,6 @@ import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController; import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallLogger; import com.android.systemui.statusbar.policy.RemoteInputUriController; import com.android.systemui.tracing.ProtoTracer; -import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.concurrency.DelayableExecutor; import com.android.systemui.util.time.SystemClock; import com.android.wm.shell.bubbles.Bubbles; @@ -98,7 +98,8 @@ public interface StatusBarDependenciesModule { Handler mainHandler, RemoteInputUriController remoteInputUriController, NotificationClickNotifier clickNotifier, - ActionClickLogger actionClickLogger) { + ActionClickLogger actionClickLogger, + DumpManager dumpManager) { return new NotificationRemoteInputManager( context, lockscreenUserManager, @@ -109,7 +110,8 @@ public interface StatusBarDependenciesModule { mainHandler, remoteInputUriController, clickNotifier, - actionClickLogger); + actionClickLogger, + dumpManager); } /** */ @@ -126,8 +128,8 @@ public interface StatusBarDependenciesModule { NotifCollection notifCollection, FeatureFlags featureFlags, @Main DelayableExecutor mainExecutor, - DeviceConfigProxy deviceConfigProxy, - MediaDataManager mediaDataManager) { + MediaDataManager mediaDataManager, + DumpManager dumpManager) { return new NotificationMediaManager( context, statusBarOptionalLazy, @@ -139,8 +141,8 @@ public interface StatusBarDependenciesModule { notifCollection, featureFlags, mainExecutor, - deviceConfigProxy, - mediaDataManager); + mediaDataManager, + dumpManager); } /** */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java index a65f3d5a20a44..a9ad0005973f9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java @@ -37,6 +37,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dumpable; +import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.statusbar.NotificationLifetimeExtender; import com.android.systemui.statusbar.NotificationListener; @@ -98,15 +99,16 @@ public class NotificationEntryManager implements CommonNotifCollection, Dumpable, VisualStabilityManager.Callback { - private static final String TAG = "NotificationEntryMgr"; - private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); - /** - * Used when a notification is removed and it doesn't have a reason that maps to one of the - * reasons defined in NotificationListenerService - * (e.g. {@link NotificationListenerService#REASON_CANCEL}) - */ - public static final int UNDEFINED_DISMISS_REASON = 0; + private final NotificationEntryManagerLogger mLogger; + private final NotificationGroupManagerLegacy mGroupManager; + private final FeatureFlags mFeatureFlags; + private final Lazy mNotificationRowBinderLazy; + private final Lazy mRemoteInputManagerLazy; + private final LeakDetector mLeakDetector; + private final ForegroundServiceDismissalFeatureController mFgsFeatureController; + private final IStatusBarService mStatusBarService; + private final DumpManager mDumpManager; private final Set mAllNotifications = new ArraySet<>(); private final Set mReadOnlyAllNotifications = @@ -129,20 +131,8 @@ public class NotificationEntryManager implements private final Map mRetainedNotifications = new ArrayMap<>(); - private final NotificationEntryManagerLogger mLogger; - - private final IStatusBarService mStatusBarService; - - // Lazily retrieved dependencies - private final Lazy mNotificationRowBinderLazy; - private final Lazy mRemoteInputManagerLazy; - private final LeakDetector mLeakDetector; private final List mNotifCollectionListeners = new ArrayList<>(); - private final NotificationGroupManagerLegacy mGroupManager; - private final FeatureFlags mFeatureFlags; - private final ForegroundServiceDismissalFeatureController mFgsFeatureController; - private LegacyNotificationRanker mRanker = new LegacyNotificationRankerStub(); private NotificationPresenter mPresenter; private RankingMap mLatestRankingMap; @@ -153,6 +143,40 @@ public class NotificationEntryManager implements private final List mNotificationEntryListeners = new ArrayList<>(); private final List mRemoveInterceptors = new ArrayList<>(); + /** + * Injected constructor. See {@link NotificationsModule}. + */ + public NotificationEntryManager( + NotificationEntryManagerLogger logger, + NotificationGroupManagerLegacy groupManager, + FeatureFlags featureFlags, + Lazy notificationRowBinderLazy, + Lazy notificationRemoteInputManagerLazy, + LeakDetector leakDetector, + ForegroundServiceDismissalFeatureController fgsFeatureController, + IStatusBarService statusBarService, + DumpManager dumpManager + ) { + mLogger = logger; + mGroupManager = groupManager; + mFeatureFlags = featureFlags; + mNotificationRowBinderLazy = notificationRowBinderLazy; + mRemoteInputManagerLazy = notificationRemoteInputManagerLazy; + mLeakDetector = leakDetector; + mFgsFeatureController = fgsFeatureController; + mStatusBarService = statusBarService; + mDumpManager = dumpManager; + } + + /** Once called, the NEM will start processing notification events from system server. */ + public void initialize( + NotificationListener notificationListener, + LegacyNotificationRanker ranker) { + mRanker = ranker; + notificationListener.addNotificationHandler(mNotifListener); + mDumpManager.registerDumpable(this); + } + @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("NotificationEntryManager state:"); @@ -194,38 +218,6 @@ public class NotificationEntryManager implements } } - /** - * Injected constructor. See {@link NotificationsModule}. - */ - public NotificationEntryManager( - NotificationEntryManagerLogger logger, - NotificationGroupManagerLegacy groupManager, - FeatureFlags featureFlags, - Lazy notificationRowBinderLazy, - Lazy notificationRemoteInputManagerLazy, - LeakDetector leakDetector, - ForegroundServiceDismissalFeatureController fgsFeatureController, - IStatusBarService statusBarService - ) { - mLogger = logger; - mGroupManager = groupManager; - mFeatureFlags = featureFlags; - mNotificationRowBinderLazy = notificationRowBinderLazy; - mRemoteInputManagerLazy = notificationRemoteInputManagerLazy; - mLeakDetector = leakDetector; - mFgsFeatureController = fgsFeatureController; - mStatusBarService = statusBarService; - } - - /** Once called, the NEM will start processing notification events from system server. */ - public void attach(NotificationListener notificationListener) { - notificationListener.addNotificationHandler(mNotifListener); - } - - public void setRanker(LegacyNotificationRanker ranker) { - mRanker = ranker; - } - /** Adds a {@link NotificationEntryListener}. */ public void addNotificationEntryListener(NotificationEntryListener listener) { mNotificationEntryListeners.add(listener); @@ -976,4 +968,14 @@ public class NotificationEntryManager implements /** true if the notification is for the current profiles */ boolean isNotificationForCurrentProfiles(StatusBarNotification sbn); } + + private static final String TAG = "NotificationEntryMgr"; + private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); + + /** + * Used when a notification is removed and it doesn't have a reason that maps to one of the + * reasons defined in NotificationListenerService + * (e.g. {@link NotificationListenerService#REASON_CANCEL}) + */ + public static final int UNDEFINED_DISMISS_REASON = 0; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/NotificationGroupManagerLegacy.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/NotificationGroupManagerLegacy.java index f40f24a935c42..5993f1dee3a7d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/NotificationGroupManagerLegacy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/NotificationGroupManagerLegacy.java @@ -25,6 +25,7 @@ import android.util.Log; import com.android.systemui.Dumpable; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.statusbar.StatusBarState; @@ -60,8 +61,12 @@ import dagger.Lazy; * 2. Tracking group expansion states */ @SysUISingleton -public class NotificationGroupManagerLegacy implements OnHeadsUpChangedListener, StateListener, - GroupMembershipManager, GroupExpansionManager, Dumpable { +public class NotificationGroupManagerLegacy implements + OnHeadsUpChangedListener, + StateListener, + GroupMembershipManager, + GroupExpansionManager, + Dumpable { private static final String TAG = "NotifGroupManager"; private static final boolean DEBUG = StatusBar.DEBUG; @@ -87,10 +92,13 @@ public class NotificationGroupManagerLegacy implements OnHeadsUpChangedListener, public NotificationGroupManagerLegacy( StatusBarStateController statusBarStateController, Lazy peopleNotificationIdentifier, - Optional bubblesOptional) { + Optional bubblesOptional, + DumpManager dumpManager) { statusBarStateController.addCallback(this); mPeopleNotificationIdentifier = peopleNotificationIdentifier; mBubblesOptional = bubblesOptional; + + dumpManager.registerDumpable(this); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/VisualStabilityManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/VisualStabilityManager.java index 165df30b457db..6e47c7bdf9272 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/VisualStabilityManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/legacy/VisualStabilityManager.java @@ -24,6 +24,7 @@ import androidx.collection.ArraySet; import com.android.systemui.Dumpable; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.NotificationEntryListener; @@ -71,9 +72,11 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener, Dumpabl NotificationEntryManager notificationEntryManager, @Main Handler handler, StatusBarStateController statusBarStateController, - WakefulnessLifecycle wakefulnessLifecycle) { + WakefulnessLifecycle wakefulnessLifecycle, + DumpManager dumpManager) { mHandler = handler; + dumpManager.registerDumpable(this); if (notificationEntryManager != null) { notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java index 55620b6340087..94f5c44d7c78c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java @@ -30,6 +30,7 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.UiBackground; +import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.people.widget.PeopleSpaceWidgetManager; @@ -109,7 +110,8 @@ public interface NotificationsModule { Lazy notificationRemoteInputManagerLazy, LeakDetector leakDetector, ForegroundServiceDismissalFeatureController fgsFeatureController, - IStatusBarService statusBarService) { + IStatusBarService statusBarService, + DumpManager dumpManager) { return new NotificationEntryManager( logger, groupManager, @@ -118,7 +120,8 @@ public interface NotificationsModule { notificationRemoteInputManagerLazy, leakDetector, fgsFeatureController, - statusBarService); + statusBarService, + dumpManager); } /** Provides an instance of {@link NotificationGutsManager} */ @@ -142,7 +145,8 @@ public interface NotificationsModule { Optional bubblesManagerOptional, UiEventLogger uiEventLogger, OnUserInteractionCallback onUserInteractionCallback, - ShadeController shadeController) { + ShadeController shadeController, + DumpManager dumpManager) { return new NotificationGutsManager( context, statusBarOptionalLazy, @@ -161,23 +165,25 @@ public interface NotificationsModule { bubblesManagerOptional, uiEventLogger, onUserInteractionCallback, - shadeController); + shadeController, + dumpManager); } /** Provides an instance of {@link VisualStabilityManager} */ @SysUISingleton @Provides static VisualStabilityManager provideVisualStabilityManager( - FeatureFlags featureFlags, NotificationEntryManager notificationEntryManager, Handler handler, StatusBarStateController statusBarStateController, - WakefulnessLifecycle wakefulnessLifecycle) { + WakefulnessLifecycle wakefulnessLifecycle, + DumpManager dumpManager) { return new VisualStabilityManager( notificationEntryManager, handler, statusBarStateController, - wakefulnessLifecycle); + wakefulnessLifecycle, + dumpManager); } /** Provides an instance of {@link NotificationLogger} */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt index c5899ad0d1a02..11b0429d2cf9b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/init/NotificationsControllerImpl.kt @@ -128,8 +128,7 @@ class NotificationsControllerImpl @Inject constructor( groupManagerLegacy.get().setHeadsUpManager(headsUpManager) groupAlertTransferHelper.setHeadsUpManager(headsUpManager) - entryManager.setRanker(legacyRanker) - entryManager.attach(notificationListener) + entryManager.initialize(notificationListener, legacyRanker) } peopleSpaceWidgetManager.attach(notificationListener) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java index 8fe0894f39c19..7eec95acc6ec6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java @@ -50,6 +50,7 @@ import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.people.widget.PeopleSpaceWidgetManager; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -151,7 +152,8 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx Optional bubblesManagerOptional, UiEventLogger uiEventLogger, OnUserInteractionCallback onUserInteractionCallback, - ShadeController shadeController) { + ShadeController shadeController, + DumpManager dumpManager) { mContext = context; mStatusBarOptionalLazy = statusBarOptionalLazy; mMainHandler = mainHandler; @@ -171,6 +173,8 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx mOnUserInteractionCallback = onUserInteractionCallback; mShadeController = shadeController; mAppWidgetManager = AppWidgetManager.getInstance(context); + + dumpManager.registerDumpable(this); } public void setUpWithPresenter(NotificationPresenter presenter, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java index f25359e5f481b..d06de75056d2a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java @@ -25,6 +25,7 @@ import android.widget.ImageView; import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import com.android.systemui.statusbar.CommandQueue; import java.io.FileDescriptor; @@ -50,11 +51,16 @@ public class DarkIconDispatcherImpl implements SysuiDarkIconDispatcher, /** */ @Inject - public DarkIconDispatcherImpl(Context context, CommandQueue commandQueue) { + public DarkIconDispatcherImpl( + Context context, + CommandQueue commandQueue, + DumpManager dumpManager) { mDarkModeIconColorSingleTone = context.getColor(R.color.dark_mode_icon_color_single_tone); mLightModeIconColorSingleTone = context.getColor(R.color.light_mode_icon_color_single_tone); mTransitionsController = new LightBarTransitionsController(context, this, commandQueue); + + dumpManager.registerDumpable(getClass().getSimpleName(), this); } public LightBarTransitionsController getTransitionsController() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java index 84b8f52c23ac7..ab7f9d3bbd251 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java @@ -48,8 +48,10 @@ import javax.inject.Inject; * Retrieve doze information */ @SysUISingleton -public class DozeParameters implements TunerService.Tunable, - com.android.systemui.plugins.statusbar.DozeParameters, Dumpable { +public class DozeParameters implements + TunerService.Tunable, + com.android.systemui.plugins.statusbar.DozeParameters, + Dumpable { private static final int MAX_DURATION = 60 * 1000; public static final boolean FORCE_NO_BLANKING = SystemProperties.getBoolean("debug.force_no_blanking", false); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java index 24c902151d7c1..51eb496c3c2a6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java @@ -33,6 +33,7 @@ import com.android.internal.view.AppearanceRegion; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.shared.system.QuickStepContract; @@ -86,8 +87,12 @@ public class LightBarController implements BatteryController.BatteryStateChangeC private boolean mNavbarColorManagedByIme; @Inject - public LightBarController(Context ctx, DarkIconDispatcher darkIconDispatcher, - BatteryController batteryController, NavigationModeController navModeController) { + public LightBarController( + Context ctx, + DarkIconDispatcher darkIconDispatcher, + BatteryController batteryController, + NavigationModeController navModeController, + DumpManager dumpManager) { mDarkModeColor = Color.valueOf(ctx.getColor(R.color.dark_mode_icon_color_single_tone)); mStatusBarIconController = (SysuiDarkIconDispatcher) darkIconDispatcher; mBatteryController = batteryController; @@ -95,6 +100,8 @@ public class LightBarController implements BatteryController.BatteryStateChangeC mNavigationMode = navModeController.addListener((mode) -> { mNavigationMode = mode; }); + + dumpManager.registerDumpable(getClass().getSimpleName(), this); } public void setNavigationBar(LightBarTransitionsController navigationBar) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 59c307cf448c4..685b0625b9a2b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -146,6 +146,7 @@ import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.UiBackground; import com.android.systemui.demomode.DemoModeController; +import com.android.systemui.dump.DumpManager; import com.android.systemui.emergency.EmergencyGesture; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.fragments.ExtensionFragmentListener; @@ -780,7 +781,8 @@ public class StatusBar extends SystemUI implements WallpaperManager wallpaperManager, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, Optional startingSurfaceOptional, - TunerService tunerService) { + TunerService tunerService, + DumpManager dumpManager) { super(context); mNotificationsController = notificationsController; mLightBarController = lightBarController; @@ -896,6 +898,8 @@ public class StatusBar extends SystemUI implements data -> mCommandQueueCallbacks.animateExpandSettingsPanel(data.mSubpanel)); mMessageRouter.subscribeTo(MSG_LAUNCH_TRANSITION_TIMEOUT, id -> onLaunchTransitionTimeout()); + + dumpManager.registerDumpable(this); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java index 9d1c1e63ac2d8..6a631566b9bbe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java @@ -33,6 +33,7 @@ import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.demomode.DemoMode; import com.android.systemui.demomode.DemoModeController; +import com.android.systemui.dump.DumpManager; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.StatusIconDisplayable; import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.CallIndicatorIconState; @@ -72,7 +73,8 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu public StatusBarIconControllerImpl( Context context, CommandQueue commandQueue, - DemoModeController demoModeController) { + DemoModeController demoModeController, + DumpManager dumpManager) { super(context.getResources().getStringArray( com.android.internal.R.array.config_statusBarIcons)); Dependency.get(ConfigurationController.class).addCallback(this); @@ -84,6 +86,7 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu commandQueue.addCallback(this); Dependency.get(TunerService.class).addTunable(this, ICON_HIDE_LIST); demoModeController.addCallback(this); + dumpManager.registerDumpable(getClass().getSimpleName(), this); } /** */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java index a7b57b966c229..63ee701425ed2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java @@ -36,6 +36,7 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.UiBackground; import com.android.systemui.demomode.DemoModeController; +import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.KeyguardViewMediator; @@ -225,7 +226,8 @@ public interface StatusBarPhoneModule { WallpaperManager wallpaperManager, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, Optional startingSurfaceOptional, - TunerService tunerService) { + TunerService tunerService, + DumpManager dumpManager) { return new StatusBar( context, notificationsController, @@ -318,6 +320,7 @@ public interface StatusBarPhoneModule { wallpaperManager, unlockedScreenOffAnimationController, startingSurfaceOptional, - tunerService); + tunerService, + dumpManager); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionControllerImpl.java index 5011d96d57f88..4c6c7e0f6c0f8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ExtensionControllerImpl.java @@ -56,7 +56,8 @@ public class ExtensionControllerImpl implements ExtensionController { /** */ @Inject - public ExtensionControllerImpl(Context context, + public ExtensionControllerImpl( + Context context, LeakDetector leakDetector, PluginManager pluginManager, TunerService tunerService, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java index d7c2b96640115..ad47e2bc44a85 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java @@ -33,6 +33,7 @@ import android.util.Log; import androidx.annotation.NonNull; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -72,10 +73,11 @@ public class FlashlightControllerImpl implements FlashlightController { private boolean mTorchAvailable; @Inject - public FlashlightControllerImpl(Context context) { + public FlashlightControllerImpl(Context context, DumpManager dumpManager) { mContext = context; mCameraManager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE); + dumpManager.registerDumpable(getClass().getSimpleName(), this); tryInitCamera(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java index 987812b0581cd..f364e49bb7576 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java @@ -36,6 +36,7 @@ import com.android.internal.util.ConcurrentUtils; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -91,14 +92,18 @@ public class HotspotControllerImpl implements HotspotController, WifiManager.Sof * Controller used to retrieve information related to a hotspot. */ @Inject - public HotspotControllerImpl(Context context, @Main Handler mainHandler, - @Background Handler backgroundHandler) { + public HotspotControllerImpl( + Context context, + @Main Handler mainHandler, + @Background Handler backgroundHandler, + DumpManager dumpManager) { mContext = context; mTetheringManager = context.getSystemService(TetheringManager.class); mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); mMainHandler = mainHandler; mTetheringManager.registerTetheringEventCallback( new HandlerExecutor(backgroundHandler), mTetheringCallback); + dumpManager.registerDumpable(getClass().getSimpleName(), this); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java index f787ecf37372f..2dfcc98b5037c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java @@ -34,6 +34,7 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dump.DumpManager; import com.android.systemui.shared.system.smartspace.SmartspaceTransitionController; import java.io.FileDescriptor; @@ -100,15 +101,20 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum /** */ @Inject - public KeyguardStateControllerImpl(Context context, - KeyguardUpdateMonitor keyguardUpdateMonitor, LockPatternUtils lockPatternUtils, - SmartspaceTransitionController smartspaceTransitionController) { + public KeyguardStateControllerImpl( + Context context, + KeyguardUpdateMonitor keyguardUpdateMonitor, + LockPatternUtils lockPatternUtils, + SmartspaceTransitionController smartspaceTransitionController, + DumpManager dumpManager) { mContext = context; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLockPatternUtils = lockPatternUtils; mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback); mSmartspaceTransitionController = smartspaceTransitionController; + dumpManager.registerDumpable(getClass().getSimpleName(), this); + update(true /* updateAlways */); if (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB) { // Watch for interesting updates diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java index 3e661df802a63..7c13173a7ec4c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java @@ -55,6 +55,7 @@ import com.android.systemui.R; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; +import com.android.systemui.dump.DumpManager; import com.android.systemui.settings.CurrentUserTracker; import org.xmlpull.v1.XmlPullParserException; @@ -109,7 +110,8 @@ public class SecurityControllerImpl extends CurrentUserTracker implements Securi Context context, @Background Handler bgHandler, BroadcastDispatcher broadcastDispatcher, - @Background Executor bgExecutor + @Background Executor bgExecutor, + DumpManager dumpManager ) { super(broadcastDispatcher); mContext = context; @@ -122,6 +124,8 @@ public class SecurityControllerImpl extends CurrentUserTracker implements Securi mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE); mBgExecutor = bgExecutor; + dumpManager.registerDumpable(getClass().getSimpleName(), this); + IntentFilter filter = new IntentFilter(); filter.addAction(KeyChain.ACTION_TRUST_STORE_CHANGED); filter.addAction(Intent.ACTION_USER_UNLOCKED); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java index 6f659c1f2af56..2b8d3a2f913b6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SensorPrivacyControllerImpl.java @@ -29,7 +29,8 @@ import java.util.List; * Controls sensor privacy state and notification. */ @SysUISingleton -public class SensorPrivacyControllerImpl implements SensorPrivacyController, +public class SensorPrivacyControllerImpl implements + SensorPrivacyController, SensorPrivacyManager.OnAllSensorPrivacyChangedListener { private SensorPrivacyManager mSensorPrivacyManager; private final List mListeners = new ArrayList<>(1); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index 251ecc626387c..22f08ada5fc4b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -68,6 +68,7 @@ import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.qs.DetailAdapter; @@ -163,7 +164,8 @@ public class UserSwitcherController implements Dumpable { IActivityTaskManager activityTaskManager, UserDetailAdapter userDetailAdapter, SecureSettings secureSettings, - @Background Executor bgExecutor) { + @Background Executor bgExecutor, + DumpManager dumpManager) { mContext = context; mUserTracker = userTracker; mBroadcastDispatcher = broadcastDispatcher; @@ -231,6 +233,8 @@ public class UserSwitcherController implements Dumpable { keyguardStateController.addCallback(mCallback); listenForCallState(); + dumpManager.registerDumpable(getClass().getSimpleName(), this); + refreshUsers(UserHandle.USER_NULL); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java index 897a3b863e739..5acce7f80f6cb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java @@ -44,6 +44,7 @@ import com.android.systemui.Dumpable; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.qs.GlobalSetting; import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.util.Utils; @@ -80,8 +81,11 @@ public class ZenModeControllerImpl extends CurrentUserTracker private NotificationManager.Policy mConsolidatedNotificationPolicy; @Inject - public ZenModeControllerImpl(Context context, @Main Handler handler, - BroadcastDispatcher broadcastDispatcher) { + public ZenModeControllerImpl( + Context context, + @Main Handler handler, + BroadcastDispatcher broadcastDispatcher, + DumpManager dumpManager) { super(broadcastDispatcher); mContext = context; mModeSetting = new GlobalSetting(mContext, handler, Global.ZEN_MODE) { @@ -108,6 +112,8 @@ public class ZenModeControllerImpl extends CurrentUserTracker mSetupObserver.register(); mUserManager = context.getSystemService(UserManager.class); startTracking(); + + dumpManager.registerDumpable(getClass().getSimpleName(), this); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/tracing/ProtoTracer.java b/packages/SystemUI/src/com/android/systemui/tracing/ProtoTracer.java index 8a8f92b32bfe0..98b2ccada4e64 100644 --- a/packages/SystemUI/src/com/android/systemui/tracing/ProtoTracer.java +++ b/packages/SystemUI/src/com/android/systemui/tracing/ProtoTracer.java @@ -48,8 +48,13 @@ import javax.inject.Inject; * Controller for coordinating winscope proto tracing. */ @SysUISingleton -public class ProtoTracer implements Dumpable, ProtoTraceParams { +public class ProtoTracer implements + Dumpable, + ProtoTraceParams< + MessageNano, + SystemUiTraceFileProto, + SystemUiTraceEntryProto, + SystemUiTraceProto> { private static final String TAG = "ProtoTracer"; private static final long MAGIC_NUMBER_VALUE = ((long) MAGIC_NUMBER_H << 32) | MAGIC_NUMBER_L; @@ -62,7 +67,7 @@ public class ProtoTracer implements Dumpable, ProtoTraceParams(this); - dumpManager.registerDumpable(getClass().getName(), this); + dumpManager.registerDumpable(this); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java index c7998882876ac..4318994605860 100644 --- a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java +++ b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java @@ -51,6 +51,7 @@ import com.android.systemui.SystemUI; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.qs.QSTile; @@ -137,7 +138,8 @@ public class GarbageMonitor implements Dumpable { @Background DelayableExecutor delayableExecutor, @Background MessageRouter messageRouter, LeakDetector leakDetector, - LeakReporter leakReporter) { + LeakReporter leakReporter, + DumpManager dumpManager) { mContext = context.getApplicationContext(); mDelayableExecutor = delayableExecutor; @@ -150,6 +152,8 @@ public class GarbageMonitor implements Dumpable { mDumpTruck = new DumpTruck(mContext); + dumpManager.registerDumpable(getClass().getSimpleName(), this); + if (ENABLE_AM_HEAP_LIMIT) { mHeapLimit = Settings.Global.getInt(context.getContentResolver(), SETTINGS_KEY_AM_HEAP_LIMIT, diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/LeakDetector.java b/packages/SystemUI/src/com/android/systemui/util/leak/LeakDetector.java index c50e8f8a35963..f215082584a8c 100644 --- a/packages/SystemUI/src/com/android/systemui/util/leak/LeakDetector.java +++ b/packages/SystemUI/src/com/android/systemui/util/leak/LeakDetector.java @@ -21,6 +21,7 @@ import android.os.Build; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.IndentingPrintWriter; import com.android.systemui.Dumpable; +import com.android.systemui.dump.DumpManager; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -38,12 +39,16 @@ public class LeakDetector implements Dumpable { private final TrackedObjects mTrackedObjects; @VisibleForTesting - public LeakDetector(TrackedCollections trackedCollections, + public LeakDetector( + TrackedCollections trackedCollections, TrackedGarbage trackedGarbage, - TrackedObjects trackedObjects) { + TrackedObjects trackedObjects, + DumpManager dumpManager) { mTrackedCollections = trackedCollections; mTrackedGarbage = trackedGarbage; mTrackedObjects = trackedObjects; + + dumpManager.registerDumpable(getClass().getSimpleName(), this); } /** @@ -130,13 +135,16 @@ public class LeakDetector implements Dumpable { pw.println(); } - public static LeakDetector create() { + public static LeakDetector create(DumpManager dumpManager) { if (ENABLED) { TrackedCollections collections = new TrackedCollections(); - return new LeakDetector(collections, new TrackedGarbage(collections), - new TrackedObjects(collections)); + return new LeakDetector( + collections, + new TrackedGarbage(collections), + new TrackedObjects(collections), + dumpManager); } else { - return new LeakDetector(null, null, null); + return new LeakDetector(null, null, null, dumpManager); } } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/TestableDependency.java b/packages/SystemUI/tests/src/com/android/systemui/TestableDependency.java index ee52c7804b690..0751475c2fb0a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/TestableDependency.java +++ b/packages/SystemUI/tests/src/com/android/systemui/TestableDependency.java @@ -56,11 +56,6 @@ public class TestableDependency extends Dependency { return mParent.createDependency(key); } - @Override - protected boolean autoRegisterModulesForDump() { - return false; - } - public boolean hasInstantiatedDependency(Class key) { return mObjs.containsKey(key) || mInstantiatedObjects.contains(key); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java index 41747f4075469..15e5e1c7b8db4 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java +++ b/packages/SystemUI/tests/src/com/android/systemui/colorextraction/SysuiColorExtractorTests.java @@ -35,6 +35,7 @@ import androidx.test.runner.AndroidJUnit4; import com.android.internal.colorextraction.ColorExtractor; import com.android.internal.colorextraction.types.Tonal; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.statusbar.policy.ConfigurationController; import org.junit.Before; @@ -60,6 +61,8 @@ public class SysuiColorExtractorTests extends SysuiTestCase { @Mock private WallpaperManager mWallpaperManager; + @Mock + private DumpManager mDumpManager; private ColorExtractor.GradientColors mColors; private SysuiColorExtractor mColorExtractor; @@ -69,13 +72,18 @@ public class SysuiColorExtractorTests extends SysuiTestCase { mColors = new ColorExtractor.GradientColors(); mColors.setMainColor(Color.RED); mColors.setSecondaryColor(Color.RED); - mColorExtractor = new SysuiColorExtractor(getContext(), + mColorExtractor = new SysuiColorExtractor( + getContext(), (inWallpaperColors, outGradientColorsNormal, outGradientColorsDark, outGradientColorsExtraDark) -> { outGradientColorsNormal.set(mColors); outGradientColorsDark.set(mColors); outGradientColorsExtraDark.set(mColors); - }, mock(ConfigurationController.class), mWallpaperManager, true /* immediately */); + }, + mock(ConfigurationController.class), + mWallpaperManager, + mDumpManager, + true /* immediately */); } @Test @@ -111,8 +119,13 @@ public class SysuiColorExtractorTests extends SysuiTestCase { public void onUiModeChanged_reloadsColors() { Tonal tonal = mock(Tonal.class); ConfigurationController configurationController = mock(ConfigurationController.class); - SysuiColorExtractor sysuiColorExtractor = new SysuiColorExtractor(getContext(), - tonal, configurationController, mWallpaperManager, true /* immediately */); + SysuiColorExtractor sysuiColorExtractor = new SysuiColorExtractor( + getContext(), + tonal, + configurationController, + mWallpaperManager, + mDumpManager, + true /* immediately */); verify(configurationController).addCallback(eq(sysuiColorExtractor)); reset(tonal); diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java index 06e597e1c87ae..2d1b25806dcc2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ScreenLifecycleTest.java @@ -26,6 +26,7 @@ import android.testing.AndroidTestingRunner; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import org.junit.Before; import org.junit.Test; @@ -43,7 +44,7 @@ public class ScreenLifecycleTest extends SysuiTestCase { @Before public void setUp() throws Exception { - mScreen = new ScreenLifecycle(); + mScreen = new ScreenLifecycle(mock(DumpManager.class)); mScreenObserverMock = mock(ScreenLifecycle.Observer.class); mScreen.addObserver(mScreenObserverMock); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java index 910b381053328..e453ff2dc7bf6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/WakefulnessLifecycleTest.java @@ -29,6 +29,7 @@ import android.testing.AndroidTestingRunner; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import org.junit.Before; import org.junit.Test; @@ -49,7 +50,8 @@ public class WakefulnessLifecycleTest extends SysuiTestCase { @Before public void setUp() throws Exception { mWallpaperManager = mock(IWallpaperManager.class); - mWakefulness = new WakefulnessLifecycle(mContext, mWallpaperManager); + mWakefulness = + new WakefulnessLifecycle(mContext, mWallpaperManager, mock(DumpManager.class)); mWakefulnessObserver = mock(WakefulnessLifecycle.Observer.class); mWakefulness.addObserver(mWakefulnessObserver); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarControllerTest.java index 3ea57be98be0b..c1a9739cb2326 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarControllerTest.java @@ -48,6 +48,7 @@ import com.android.systemui.accessibility.AccessibilityButtonModeObserver; import com.android.systemui.accessibility.SystemActions; import com.android.systemui.assist.AssistManager; import com.android.systemui.broadcast.BroadcastDispatcher; +import com.android.systemui.dump.DumpManager; import com.android.systemui.model.SysUiState; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.recents.OverviewProxyService; @@ -116,7 +117,8 @@ public class NavigationBarControllerTest extends SysuiTestCase { mock(ConfigurationController.class), mock(NavigationBarA11yHelper.class), mock(TaskbarDelegate.class), - mock(UserTracker.class))); + mock(UserTracker.class), + mock(DumpManager.class))); initializeNavigationBars(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java index 0c65830ea4557..ea21aa906ab14 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java @@ -56,6 +56,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.Dependency; import com.android.systemui.SysuiTestCase; import com.android.systemui.broadcast.BroadcastDispatcher; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationLockscreenUserManager.KeyguardNotificationSuppressor; import com.android.systemui.statusbar.notification.NotificationEntryManager; @@ -423,7 +424,8 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { mStatusBarStateController, Handler.createAsync(Looper.myLooper()), mDeviceProvisionedController, - mKeyguardStateController); + mKeyguardStateController, + mock(DumpManager.class)); } public BroadcastReceiver getBaseBroadcastReceiverForTest() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java index 8b7c76a9727a2..5944e9c1f3916 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java @@ -25,6 +25,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationRemoteInputManager.RemoteInputActiveExtender; import com.android.systemui.statusbar.NotificationRemoteInputManager.RemoteInputHistoryExtender; @@ -87,7 +88,8 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { Handler.createAsync(Looper.myLooper()), mRemoteInputUriController, mClickNotifier, - mock(ActionClickLogger.class)); + mock(ActionClickLogger.class), + mock(DumpManager.class)); mEntry = new NotificationEntryBuilder() .setPkg(TEST_PACKAGE_NAME) .setOpPkg(TEST_PACKAGE_NAME) @@ -272,7 +274,8 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { Handler mainHandler, RemoteInputUriController remoteInputUriController, NotificationClickNotifier clickNotifier, - ActionClickLogger actionClickLogger) { + ActionClickLogger actionClickLogger, + DumpManager dumpManager) { super( context, lockscreenUserManager, @@ -283,7 +286,8 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { mainHandler, remoteInputUriController, clickNotifier, - actionClickLogger); + actionClickLogger, + dumpManager); } public void setUpWithPresenterForTest(Callback callback, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java index 659d96e92f34f..837d71f8d74fc 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java @@ -38,6 +38,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -97,7 +98,8 @@ public class SmartReplyControllerTest extends SysuiTestCase { Handler.createAsync(Looper.myLooper()), mRemoteInputUriController, mClickNotifier, - mock(ActionClickLogger.class)); + mock(ActionClickLogger.class), + mock(DumpManager.class)); mRemoteInputManager.setUpWithCallback(mCallback, mDelegate); mNotification = new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt index fca6bc50f6e2a..c974882ff3054 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt @@ -21,10 +21,12 @@ import android.testing.TestableLooper import androidx.test.filters.SmallTest import com.android.internal.logging.testing.UiEventLoggerFake import com.android.systemui.SysuiTestCase +import com.android.systemui.dump.DumpManager import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +import org.mockito.Mockito.mock @SmallTest @RunWith(AndroidTestingRunner::class) @@ -37,7 +39,7 @@ class StatusBarStateControllerImplTest : SysuiTestCase() { @Before fun setUp() { uiEventLogger = UiEventLoggerFake() - controller = StatusBarStateControllerImpl(uiEventLogger) + controller = StatusBarStateControllerImpl(uiEventLogger, mock(DumpManager::class.java)) } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java index 8a32ce6c4f432..1f3e1c7a6b863 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java @@ -64,8 +64,10 @@ import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.statusbar.NotificationLifetimeExtender; +import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.NotificationRemoteInputManager; @@ -130,6 +132,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase { @Mock private LeakDetector mLeakDetector; @Mock private NotificationMediaManager mNotificationMediaManager; @Mock private NotificationRowBinder mNotificationRowBinder; + @Mock private NotificationListener mNotificationListener; private int mId; private NotificationEntry mEntry; @@ -195,9 +198,11 @@ public class NotificationEntryManagerTest extends SysuiTestCase { () -> mRemoteInputManager, mLeakDetector, mock(ForegroundServiceDismissalFeatureController.class), - mock(IStatusBarService.class) + mock(IStatusBarService.class), + mock(DumpManager.class) ); - mEntryManager.setRanker( + mEntryManager.initialize( + mNotificationListener, new NotificationRankingManager( () -> mNotificationMediaManager, mGroupManager, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java index b1eef4b67a6fd..b02a336b43963 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationFilterTest.java @@ -42,6 +42,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.ForegroundServiceController; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.media.MediaFeatureFlag; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.NotificationLockscreenUserManager; @@ -119,7 +120,8 @@ public class NotificationFilterTest extends SysuiTestCase { new NotificationGroupManagerLegacy( mock(StatusBarStateController.class), () -> mock(PeopleNotificationIdentifier.class), - Optional.of(mock(Bubbles.class)))); + Optional.of(mock(Bubbles.class)), + mock(DumpManager.class))); mDependency.injectMockDependency(ShadeController.class); mDependency.injectMockDependency(NotificationLockscreenUserManager.class); mDependency.injectTestDependency(KeyguardEnvironment.class, mEnvironment); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java index baeedcfc3fc55..a737ce5a2ae57 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/VisualStabilityManagerTest.java @@ -32,6 +32,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -70,7 +71,8 @@ public class VisualStabilityManagerTest extends SysuiTestCase { mock(NotificationEntryManager.class), new Handler(mTestableLooper.getLooper()), statusBarStateController, - wakefulnessLifecycle); + wakefulnessLifecycle, + mock(DumpManager.class)); mVisualStabilityManager.setVisibilityLocationProvider(mLocationProvider); mEntry = new NotificationEntryBuilder().build(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationEntryManagerInflationTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationEntryManagerInflationTest.java index 4562e4f5954d0..d3738f42e020f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationEntryManagerInflationTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationEntryManagerInflationTest.java @@ -47,11 +47,13 @@ import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.classifier.FalsingCollectorFake; import com.android.systemui.classifier.FalsingManagerFake; +import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.media.MediaFeatureFlag; import com.android.systemui.media.dialog.MediaOutputDialogFactory; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shared.plugins.PluginManager; +import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationPresenter; @@ -119,6 +121,7 @@ public class NotificationEntryManagerInflationTest extends SysuiTestCase { throw new RuntimeException("Timed out waiting to inflate"); }; + @Mock private NotificationListener mNotificationListener; @Mock private NotificationPresenter mPresenter; @Mock private NotificationEntryManager.KeyguardEnvironment mEnvironment; @Mock private NotificationListContainer mListContainer; @@ -186,9 +189,11 @@ public class NotificationEntryManagerInflationTest extends SysuiTestCase { () -> mRemoteInputManager, mLeakDetector, mock(ForegroundServiceDismissalFeatureController.class), - mock(IStatusBarService.class) + mock(IStatusBarService.class), + mock(DumpManager.class) ); - mEntryManager.setRanker( + mEntryManager.initialize( + mNotificationListener, new NotificationRankingManager( () -> mock(NotificationMediaManager.class), mGroupMembershipManager, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java index fc44669c56424..7d8e0d26464cd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java @@ -68,6 +68,7 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.testing.UiEventLoggerFake; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.people.widget.PeopleSpaceWidgetManager; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.settings.UserContextProvider; @@ -159,7 +160,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase { mPeopleSpaceWidgetManager, mLauncherApps, mShortcutManager, mChannelEditorDialogController, mContextTracker, mAssistantFeedbackController, Optional.of(mBubblesManager), new UiEventLoggerFake(), mOnUserInteractionCallback, - mShadeController); + mShadeController, mock(DumpManager.class)); mGutsManager.setUpWithPresenter(mPresenter, mNotificationListContainer, mCheckSaveListener, mOnSettingsClickListener); mGutsManager.setNotificationActivityStarter(mNotificationActivityStarter); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java index 0bb66fc14553c..42aecfdc11bdf 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationTestHelper.java @@ -46,6 +46,7 @@ import android.widget.RemoteViews; import com.android.systemui.TestableDependency; import com.android.systemui.classifier.FalsingCollectorFake; import com.android.systemui.classifier.FalsingManagerFake; +import com.android.systemui.dump.DumpManager; import com.android.systemui.media.MediaFeatureFlag; import com.android.systemui.media.dialog.MediaOutputDialogFactory; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -125,7 +126,8 @@ public class NotificationTestHelper { mGroupMembershipManager = new NotificationGroupManagerLegacy( mStatusBarStateController, () -> mock(PeopleNotificationIdentifier.class), - Optional.of((mock(Bubbles.class)))); + Optional.of((mock(Bubbles.class))), + mock(DumpManager.class)); mGroupExpansionManager = mGroupMembershipManager; mHeadsUpManager = new HeadsUpManagerPhone(mContext, mStatusBarStateController, mock(KeyguardBypassController.class), mock(NotificationGroupManagerLegacy.class), diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java index ccdc69aeaa18b..7e33c01572e1a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LightBarControllerTest.java @@ -34,6 +34,7 @@ import androidx.test.filters.SmallTest; import com.android.internal.view.AppearanceRegion; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.statusbar.policy.BatteryController; @@ -56,8 +57,12 @@ public class LightBarControllerTest extends SysuiTestCase { mLightBarTransitionsController = mock(LightBarTransitionsController.class); when(mStatusBarIconController.getTransitionsController()).thenReturn( mLightBarTransitionsController); - mLightBarController = new LightBarController(mContext, mStatusBarIconController, - mock(BatteryController.class), mock(NavigationModeController.class)); + mLightBarController = new LightBarController( + mContext, + mStatusBarIconController, + mock(BatteryController.class), + mock(NavigationModeController.class), + mock(DumpManager.class)); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java index 88852f111c4b4..80d9c0876ec1c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupAlertTransferHelperTest.java @@ -37,6 +37,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.NotificationEntryListener; import com.android.systemui.statusbar.notification.NotificationEntryManager; @@ -93,7 +94,8 @@ public class NotificationGroupAlertTransferHelperTest extends SysuiTestCase { mGroupManager = new NotificationGroupManagerLegacy( mock(StatusBarStateController.class), () -> mPeopleNotificationIdentifier, - Optional.of(mock(Bubbles.class))); + Optional.of(mock(Bubbles.class)), + mock(DumpManager.class)); mDependency.injectTestDependency(NotificationGroupManagerLegacy.class, mGroupManager); mGroupManager.setHeadsUpManager(mHeadsUpManager); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerLegacyTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerLegacyTest.java index 0110d7b58cefa..1be27da27d258 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerLegacyTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerLegacyTest.java @@ -33,6 +33,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy; @@ -76,7 +77,8 @@ public class NotificationGroupManagerLegacyTest extends SysuiTestCase { mGroupManager = new NotificationGroupManagerLegacy( mock(StatusBarStateController.class), () -> mPeopleNotificationIdentifier, - Optional.of(mock(Bubbles.class))); + Optional.of(mock(Bubbles.class)), + mock(DumpManager.class)); mGroupManager.setHeadsUpManager(mHeadsUpManager); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index bef10ce9d4237..7fc36f82142df 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -89,6 +89,7 @@ import com.android.systemui.classifier.FalsingCollectorFake; import com.android.systemui.classifier.FalsingManagerFake; import com.android.systemui.controls.dagger.ControlsComponent; import com.android.systemui.doze.DozeLog; +import com.android.systemui.dump.DumpManager; import com.android.systemui.fragments.FragmentHostManager; import com.android.systemui.fragments.FragmentService; import com.android.systemui.media.KeyguardMediaController; @@ -299,6 +300,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { private ControlsComponent mControlsComponent; @Mock private LockscreenGestureLogger mLockscreenGestureLogger; + @Mock + private DumpManager mDumpManager; private SysuiStatusBarStateController mStatusBarStateController; private NotificationPanelViewController mNotificationPanelViewController; @@ -310,7 +313,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Before public void setup() { MockitoAnnotations.initMocks(this); - mStatusBarStateController = new StatusBarStateControllerImpl(mUiEventLogger); + mStatusBarStateController = new StatusBarStateControllerImpl(mUiEventLogger, mDumpManager); mKeyguardStatusView = new KeyguardStatusView(mContext); mKeyguardStatusView.setId(R.id.keyguard_status_view); @@ -367,7 +370,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { NotificationWakeUpCoordinator coordinator = new NotificationWakeUpCoordinator( mock(HeadsUpManagerPhone.class), - new StatusBarStateControllerImpl(new UiEventLoggerFake()), + new StatusBarStateControllerImpl(new UiEventLoggerFake(), mDumpManager), mKeyguardBypassController, mDozeParameters, mUnlockedScreenOffAnimationController); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index 38f36bfa8cfbb..5115614f8bfb3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -45,6 +45,7 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; import com.android.systemui.SysuiTestCase; import com.android.systemui.dock.DockManager; +import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.keyguard.FaceAuthScreenBrightnessController; import com.android.systemui.keyguard.WakefulnessLifecycle; @@ -120,7 +121,10 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { .thenReturn(mBouncer); when(mContainer.findViewById(anyInt())).thenReturn(mKeyguardMessageArea); - mWakefulnessLifecycle = new WakefulnessLifecycle(getContext(), null); + mWakefulnessLifecycle = new WakefulnessLifecycle( + getContext(), + null, + mock(DumpManager.class)); mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager( getContext(), mViewMediatorCallback, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java index 2f7e39b35745d..b23414bacf10a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java @@ -83,6 +83,7 @@ import com.android.systemui.classifier.FalsingCollectorFake; import com.android.systemui.classifier.FalsingManagerFake; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.demomode.DemoModeController; +import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.KeyguardViewMediator; @@ -326,7 +327,7 @@ public class StatusBarTest extends SysuiTestCase { }).when(mStatusBarKeyguardViewManager).addAfterKeyguardGoneRunnable(any()); WakefulnessLifecycle wakefulnessLifecycle = - new WakefulnessLifecycle(mContext, mIWallpaperManager); + new WakefulnessLifecycle(mContext, mIWallpaperManager, mock(DumpManager.class)); wakefulnessLifecycle.dispatchStartedWakingUp(PowerManager.WAKE_REASON_UNKNOWN); wakefulnessLifecycle.dispatchFinishedWakingUp(); @@ -381,7 +382,7 @@ public class StatusBarTest extends SysuiTestCase { mNetworkController, mBatteryController, mColorExtractor, - new ScreenLifecycle(), + new ScreenLifecycle(mock(DumpManager.class)), wakefulnessLifecycle, mStatusBarStateController, Optional.of(mBubblesManager), @@ -440,7 +441,8 @@ public class StatusBarTest extends SysuiTestCase { mWallpaperManager, mUnlockedScreenOffAnimationController, Optional.of(mStartingSurface), - mTunerService); + mTunerService, + mock(DumpManager.class)); when(mKeyguardViewMediator.registerStatusBar(any(StatusBar.class), any(ViewGroup.class), any(NotificationPanelViewController.class), any(BiometricUnlockController.class), any(ViewGroup.class), any(KeyguardBypassController.class))) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java index 1240a4815b985..14cc032b1cecf 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ExtensionControllerImplTest.java @@ -63,8 +63,12 @@ public class ExtensionControllerImplTest extends SysuiTestCase { mPluginManager = mDependency.injectMockDependency(PluginManager.class); mTunerService = mDependency.injectMockDependency(TunerService.class); mConfigurationController = mDependency.injectMockDependency(ConfigurationController.class); - mExtensionController = new ExtensionControllerImpl(mContext, - mock(LeakDetector.class), mPluginManager, mTunerService, mConfigurationController); + mExtensionController = new ExtensionControllerImpl( + mContext, + mock(LeakDetector.class), + mPluginManager, + mTunerService, + mConfigurationController); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java index 57714722aea43..4f1fb02ecdcd4 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java @@ -37,6 +37,7 @@ import android.testing.TestableLooper; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import org.junit.Before; import org.junit.Test; @@ -56,6 +57,8 @@ import java.util.concurrent.Executor; @TestableLooper.RunWithLooper public class HotspotControllerImplTest extends SysuiTestCase { + @Mock + private DumpManager mDumpManager; @Mock private TetheringManager mTetheringManager; @Mock @@ -95,7 +98,7 @@ public class HotspotControllerImplTest extends SysuiTestCase { Handler handler = new Handler(mLooper.getLooper()); - mController = new HotspotControllerImpl(mContext, handler, handler); + mController = new HotspotControllerImpl(mContext, handler, handler, mDumpManager); verify(mTetheringManager) .registerTetheringEventCallback(any(), mTetheringCallbackCaptor.capture()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java index 4b87ec8957734..8ccaf93624546 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/KeyguardStateControllerTest.java @@ -32,6 +32,7 @@ import androidx.test.filters.SmallTest; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.shared.system.smartspace.SmartspaceTransitionController; import org.junit.Before; @@ -52,12 +53,18 @@ public class KeyguardStateControllerTest extends SysuiTestCase { private KeyguardStateController mKeyguardStateController; @Mock private SmartspaceTransitionController mSmartSpaceTransitionController; + @Mock + private DumpManager mDumpManager; @Before public void setup() { MockitoAnnotations.initMocks(this); - mKeyguardStateController = new KeyguardStateControllerImpl(mContext, - mKeyguardUpdateMonitor, mLockPatternUtils, mSmartSpaceTransitionController); + mKeyguardStateController = new KeyguardStateControllerImpl( + mContext, + mKeyguardUpdateMonitor, + mLockPatternUtils, + mSmartSpaceTransitionController, + mDumpManager); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java index c38a54771e128..d44cdb24421a0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SecurityControllerTest.java @@ -49,6 +49,7 @@ import androidx.test.runner.AndroidJUnit4; import com.android.systemui.SysuiTestCase; import com.android.systemui.broadcast.BroadcastDispatcher; +import com.android.systemui.dump.DumpManager; import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.time.FakeSystemClock; @@ -56,6 +57,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; import java.util.ArrayList; import java.util.Arrays; @@ -105,7 +107,8 @@ public class SecurityControllerTest extends SysuiTestCase { mContext, mHandler, mBroadcastDispatcher, - mBgExecutor); + mBgExecutor, + Mockito.mock(DumpManager.class)); verify(mBroadcastDispatcher).registerReceiverWithHandler( brCaptor.capture(), diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt index 3431a9d895d31..dba83e1eeeb99 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/UserSwitcherControllerTest.kt @@ -37,6 +37,7 @@ import com.android.systemui.GuestResumeSessionReceiver import com.android.systemui.R import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.BroadcastDispatcher +import com.android.systemui.dump.DumpManager import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.FalsingManager import com.android.systemui.qs.QSUserSwitcherEvent @@ -76,6 +77,7 @@ class UserSwitcherControllerTest : SysuiTestCase() { @Mock private lateinit var telephonyListenerManager: TelephonyListenerManager @Mock private lateinit var secureSettings: SecureSettings @Mock private lateinit var falsingManager: FalsingManager + @Mock private lateinit var dumpManager: DumpManager private lateinit var testableLooper: TestableLooper private lateinit var uiBgExecutor: FakeExecutor private lateinit var uiEventLogger: UiEventLoggerFake @@ -106,7 +108,8 @@ class UserSwitcherControllerTest : SysuiTestCase() { `when`(userManager.canAddMoreUsers()).thenReturn(true) - userSwitcherController = UserSwitcherController(context, + userSwitcherController = UserSwitcherController( + context, userManager, userTracker, keyguardStateController, @@ -121,7 +124,8 @@ class UserSwitcherControllerTest : SysuiTestCase() { activityTaskManager, userDetailAdapter, secureSettings, - uiBgExecutor) + uiBgExecutor, + dumpManager) userSwitcherController.mPauseRefreshUsers = true picture = UserIcons.convertToBitmap(context.getDrawable(R.drawable.ic_avatar_user)) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java index dcf0ef781b079..336f2b16aeb71 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/ZenModeControllerImplTest.java @@ -34,6 +34,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.broadcast.BroadcastDispatcher; +import com.android.systemui.dump.DumpManager; import com.android.systemui.statusbar.policy.ZenModeController.Callback; import org.junit.Before; @@ -54,6 +55,8 @@ public class ZenModeControllerImplTest extends SysuiTestCase { ZenModeConfig mConfig; @Mock BroadcastDispatcher mBroadcastDispatcher; + @Mock + DumpManager mDumpManager; private ZenModeControllerImpl mController; @@ -63,8 +66,11 @@ public class ZenModeControllerImplTest extends SysuiTestCase { mContext.addMockSystemService(NotificationManager.class, mNm); when(mNm.getZenModeConfig()).thenReturn(mConfig); - mController = new ZenModeControllerImpl(mContext, Handler.createAsync(Looper.myLooper()), - mBroadcastDispatcher); + mController = new ZenModeControllerImpl( + mContext, + Handler.createAsync(Looper.myLooper()), + mBroadcastDispatcher, + mDumpManager); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/leak/GarbageMonitorTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/leak/GarbageMonitorTest.java index 724d14e203745..a2b016f22473f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/util/leak/GarbageMonitorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/util/leak/GarbageMonitorTest.java @@ -26,6 +26,7 @@ import android.testing.AndroidTestingRunner; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.concurrency.MessageRouterImpl; import com.android.systemui.util.time.FakeSystemClock; @@ -42,6 +43,7 @@ public class GarbageMonitorTest extends SysuiTestCase { @Mock private LeakReporter mLeakReporter; @Mock private TrackedGarbage mTrackedGarbage; + @Mock private DumpManager mDumpManager; private GarbageMonitor mGarbageMonitor; private final FakeExecutor mFakeExecutor = new FakeExecutor(new FakeSystemClock()); @@ -53,8 +55,9 @@ public class GarbageMonitorTest extends SysuiTestCase { mContext, mFakeExecutor, new MessageRouterImpl(mFakeExecutor), - new LeakDetector(null, mTrackedGarbage, null), - mLeakReporter); + new LeakDetector(null, mTrackedGarbage, null, mDumpManager), + mLeakReporter, + mDumpManager); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakDetectorTest.java b/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakDetectorTest.java index c68c9206a2d82..6e42f0cc57847 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakDetectorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/util/leak/LeakDetectorTest.java @@ -21,12 +21,14 @@ import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.systemui.SysuiTestCase; +import com.android.systemui.dump.DumpManager; import com.android.systemui.util.leak.ReferenceTestUtils.CollectionWaiter; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; import java.io.FileOutputStream; import java.io.PrintWriter; @@ -67,7 +69,7 @@ public class LeakDetectorTest extends SysuiTestCase { @Before public void setup() { - mLeakDetector = LeakDetector.create(); + mLeakDetector = LeakDetector.create(Mockito.mock(DumpManager.class)); // Note: Do not try to factor out object / collection waiter creation. The optimizer will // try and cache accesses to fields and thus create a GC root for the duration of the test @@ -112,7 +114,7 @@ public class LeakDetectorTest extends SysuiTestCase { @Test public void testDisabled() throws Exception { - mLeakDetector = new LeakDetector(null, null, null); + mLeakDetector = new LeakDetector(null, null, null, Mockito.mock(DumpManager.class)); Object o1 = new Object(); Object o2 = new Object();