diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java index 094ebb9ef0a7b..5f222afd77e50 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java @@ -24,7 +24,6 @@ import com.android.internal.logging.UiEvent; import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLoggerImpl; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; -import com.android.systemui.Dependency; import com.android.systemui.EventLogConstants; import com.android.systemui.EventLogTags; import com.android.systemui.dagger.SysUISingleton; @@ -88,10 +87,11 @@ public class LockscreenGestureLogger { } private ArrayMap mLegacyMap; - private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class); + private final MetricsLogger mMetricsLogger; @Inject - public LockscreenGestureLogger() { + public LockscreenGestureLogger(MetricsLogger metricsLogger) { + mMetricsLogger = metricsLogger; mLegacyMap = new ArrayMap<>(EventLogConstants.METRICS_GESTURE_TYPE_MAP.length); for (int i = 0; i < EventLogConstants.METRICS_GESTURE_TYPE_MAP.length ; i++) { mLegacyMap.put(EventLogConstants.METRICS_GESTURE_TYPE_MAP[i], i); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index edaed78bfd36b..07508a6c31a08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -482,7 +482,6 @@ public class NotificationPanelViewController extends PanelViewController { private float mLinearDarkAmount; private boolean mPulsing; - private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger(); private boolean mUserSetupComplete; private int mQsNotificationTopPadding; private boolean mHideIconsDuringLaunchAnimation = true; @@ -742,12 +741,21 @@ public class NotificationPanelViewController extends PanelViewController { SplitShadeHeaderController splitShadeHeaderController, LockscreenSmartspaceController lockscreenSmartspaceController, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, + LockscreenGestureLogger lockscreenGestureLogger, NotificationRemoteInputManager remoteInputManager, ControlsComponent controlsComponent) { - super(view, falsingManager, dozeLog, keyguardStateController, - (SysuiStatusBarStateController) statusBarStateController, vibratorHelper, - statusBarKeyguardViewManager, latencyTracker, flingAnimationUtilsBuilder.get(), - statusBarTouchableRegionManager, ambientState); + super(view, + falsingManager, + dozeLog, + keyguardStateController, + (SysuiStatusBarStateController) statusBarStateController, + vibratorHelper, + statusBarKeyguardViewManager, + latencyTracker, + flingAnimationUtilsBuilder.get(), + statusBarTouchableRegionManager, + lockscreenGestureLogger, + ambientState); mView = view; mVibratorHelper = vibratorHelper; mKeyguardMediaController = keyguardMediaController; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java index 27f08a860f28b..310f02e9f222e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java @@ -79,7 +79,6 @@ public abstract class PanelViewController { protected long mDownTime; protected boolean mTouchSlopExceededBeforeDown; private float mMinExpandHeight; - private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger(); private boolean mPanelUpdateWhenAnimatorEnds; private boolean mVibrateOnOpening; protected boolean mIsLaunchAnimationRunning; @@ -182,6 +181,7 @@ public abstract class PanelViewController { protected final KeyguardStateController mKeyguardStateController; protected final SysuiStatusBarStateController mStatusBarStateController; protected final AmbientState mAmbientState; + protected final LockscreenGestureLogger mLockscreenGestureLogger; protected void onExpandingFinished() { mBar.onExpandingFinished(); @@ -217,10 +217,12 @@ public abstract class PanelViewController { LatencyTracker latencyTracker, FlingAnimationUtils.Builder flingAnimationUtilsBuilder, StatusBarTouchableRegionManager statusBarTouchableRegionManager, + LockscreenGestureLogger lockscreenGestureLogger, AmbientState ambientState) { mAmbientState = ambientState; mView = view; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; + mLockscreenGestureLogger = lockscreenGestureLogger; mView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { 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 9c2b2793c4673..565ca507df50a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -197,6 +197,7 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationActivityStarter; +import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorControllerProvider; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager; @@ -454,6 +455,7 @@ public class StatusBar extends SystemUI implements private BiometricUnlockController mBiometricUnlockController; private final LightBarController mLightBarController; private final Lazy mLockscreenWallpaperLazy; + private final LockscreenGestureLogger mLockscreenGestureLogger; @Nullable protected LockscreenWallpaper mLockscreenWallpaper; private final AutoHideController mAutoHideController; @@ -529,6 +531,7 @@ public class StatusBar extends SystemUI implements private final int[] mAbsPos = new int[2]; + protected final NotificationEntryManager mEntryManager; private final NotificationGutsManager mGutsManager; private final NotificationLogger mNotificationLogger; private final NotificationViewHierarchyManager mViewHierarchyManager; @@ -805,6 +808,7 @@ public class StatusBar extends SystemUI implements FalsingManager falsingManager, FalsingCollector falsingCollector, BroadcastDispatcher broadcastDispatcher, + NotificationEntryManager notificationEntryManager, NotificationGutsManager notificationGutsManager, NotificationLogger notificationLogger, NotificationInterruptStateProvider notificationInterruptStateProvider, @@ -834,6 +838,7 @@ public class StatusBar extends SystemUI implements DozeParameters dozeParameters, ScrimController scrimController, Lazy lockscreenWallpaperLazy, + LockscreenGestureLogger lockscreenGestureLogger, Lazy biometricUnlockControllerLazy, DozeServiceHost dozeServiceHost, PowerManager powerManager, @@ -894,6 +899,7 @@ public class StatusBar extends SystemUI implements mFalsingCollector = falsingCollector; mFalsingManager = falsingManager; mBroadcastDispatcher = broadcastDispatcher; + mEntryManager = notificationEntryManager; mGutsManager = notificationGutsManager; mNotificationLogger = notificationLogger; mNotificationInterruptStateProvider = notificationInterruptStateProvider; @@ -925,6 +931,7 @@ public class StatusBar extends SystemUI implements mDozeParameters = dozeParameters; mScrimController = scrimController; mLockscreenWallpaperLazy = lockscreenWallpaperLazy; + mLockscreenGestureLogger = lockscreenGestureLogger; mScreenPinningRequest = screenPinningRequest; mDozeScrimController = dozeScrimController; mBiometricUnlockControllerLazy = biometricUnlockControllerLazy; @@ -1530,9 +1537,11 @@ public class StatusBar extends SystemUI implements mViewHierarchyManager, mLockscreenUserManager, mStatusBarStateController, + mEntryManager, mMediaManager, mGutsManager, mKeyguardUpdateMonitor, + mLockscreenGestureLogger, mInitController, mNotificationInterruptStateProvider, mRemoteInputManager, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java index 608697df79058..8ebaf9188e912 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java @@ -82,10 +82,6 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, ConfigurationController.ConfigurationListener, NotificationRowBinderImpl.BindRowCallback, CommandQueue.Callbacks { - - private final LockscreenGestureLogger mLockscreenGestureLogger = - Dependency.get(LockscreenGestureLogger.class); - private static final String TAG = "StatusBarNotificationPresenter"; private final ActivityStarter mActivityStarter = Dependency.get(ActivityStarter.class); @@ -93,11 +89,11 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, private final NotificationViewHierarchyManager mViewHierarchyManager; private final NotificationLockscreenUserManager mLockscreenUserManager; private final SysuiStatusBarStateController mStatusBarStateController; - private final NotificationEntryManager mEntryManager = - Dependency.get(NotificationEntryManager.class); + private final NotificationEntryManager mEntryManager; private final NotificationMediaManager mMediaManager; private final NotificationGutsManager mGutsManager; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; + private final LockscreenGestureLogger mLockscreenGestureLogger; private final NotificationPanelViewController mNotificationPanel; private final HeadsUpManagerPhone mHeadsUpManager; @@ -139,9 +135,11 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, NotificationViewHierarchyManager notificationViewHierarchyManager, NotificationLockscreenUserManager lockscreenUserManager, SysuiStatusBarStateController sysuiStatusBarStateController, + NotificationEntryManager notificationEntryManager, NotificationMediaManager notificationMediaManager, NotificationGutsManager notificationGutsManager, KeyguardUpdateMonitor keyguardUpdateMonitor, + LockscreenGestureLogger lockscreenGestureLogger, InitController initController, NotificationInterruptStateProvider notificationInterruptStateProvider, NotificationRemoteInputManager remoteInputManager, @@ -159,9 +157,11 @@ public class StatusBarNotificationPresenter implements NotificationPresenter, mViewHierarchyManager = notificationViewHierarchyManager; mLockscreenUserManager = lockscreenUserManager; mStatusBarStateController = sysuiStatusBarStateController; + mEntryManager = notificationEntryManager; mMediaManager = notificationMediaManager; mGutsManager = notificationGutsManager; mKeyguardUpdateMonitor = keyguardUpdateMonitor; + mLockscreenGestureLogger = lockscreenGestureLogger; mAboveShelfObserver = new AboveShelfObserver(stackScrollerController.getView()); mNotificationShadeWindowController = notificationShadeWindowController; mAboveShelfObserver.setListener(statusBarWindow.findViewById( 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 eabb2ab696ee2..4074caaa2fb44 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 @@ -60,6 +60,7 @@ import com.android.systemui.statusbar.SuperStatusBarViewFactory; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler; import com.android.systemui.statusbar.notification.DynamicPrivacyController; +import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager; import com.android.systemui.statusbar.notification.init.NotificationsController; @@ -77,6 +78,7 @@ import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import com.android.systemui.statusbar.phone.LightBarController; import com.android.systemui.statusbar.phone.LightsOutNotifController; +import com.android.systemui.statusbar.phone.LockscreenGestureLogger; import com.android.systemui.statusbar.phone.LockscreenWallpaper; import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.PhoneStatusBarPolicy; @@ -143,6 +145,7 @@ public interface StatusBarPhoneModule { FalsingManager falsingManager, FalsingCollector falsingCollector, BroadcastDispatcher broadcastDispatcher, + NotificationEntryManager notificationEntryManager, NotificationGutsManager notificationGutsManager, NotificationLogger notificationLogger, NotificationInterruptStateProvider notificationInterruptStateProvider, @@ -172,6 +175,7 @@ public interface StatusBarPhoneModule { DozeParameters dozeParameters, ScrimController scrimController, Lazy lockscreenWallpaperLazy, + LockscreenGestureLogger lockscreenGestureLogger, Lazy biometricUnlockControllerLazy, DozeServiceHost dozeServiceHost, PowerManager powerManager, @@ -231,6 +235,7 @@ public interface StatusBarPhoneModule { falsingManager, falsingCollector, broadcastDispatcher, + notificationEntryManager, notificationGutsManager, notificationLogger, notificationInterruptStateProvider, @@ -260,6 +265,7 @@ public interface StatusBarPhoneModule { dozeParameters, scrimController, lockscreenWallpaperLazy, + lockscreenGestureLogger, biometricUnlockControllerLazy, dozeServiceHost, powerManager, 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 1387b8e1f1b96..0ea619dfadc89 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 @@ -306,6 +306,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { private LockscreenSmartspaceController mLockscreenSmartspaceController; @Mock private FrameLayout mSplitShadeSmartspaceContainer; + @Mock + private LockscreenGestureLogger mLockscreenGestureLogger; private SysuiStatusBarStateController mStatusBarStateController; private NotificationPanelViewController mNotificationPanelViewController; @@ -452,6 +454,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { mSplitShadeHeaderController, mLockscreenSmartspaceController, mUnlockedScreenOffAnimationController, + mLockscreenGestureLogger, mNotificationRemoteInputManager, mControlsComponent); mNotificationPanelViewController.initDependencies( diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java index 03a353b6c2b47..c80c07249cc57 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.java @@ -31,7 +31,6 @@ import android.testing.TestableLooper.RunWithLooper; import androidx.test.filters.SmallTest; -import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.testing.FakeMetricsLogger; import com.android.keyguard.KeyguardUpdateMonitor; @@ -67,14 +66,10 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import java.util.ArrayList; - @SmallTest @RunWith(AndroidTestingRunner.class) @RunWithLooper() public class StatusBarNotificationPresenterTest extends SysuiTestCase { - - private StatusBarNotificationPresenter mStatusBarNotificationPresenter; private NotificationInterruptStateProvider mNotificationInterruptStateProvider = mock(NotificationInterruptStateProvider.class); @@ -88,7 +83,8 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase { @Before public void setup() { mMetricsLogger = new FakeMetricsLogger(); - mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); + LockscreenGestureLogger lockscreenGestureLogger = new LockscreenGestureLogger( + mMetricsLogger); mCommandQueue = new CommandQueue(mContext); mDependency.injectTestDependency(StatusBarStateController.class, mock(SysuiStatusBarStateController.class)); @@ -96,9 +92,6 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase { mDependency.injectMockDependency(NotificationRemoteInputManager.Callback.class); mDependency.injectMockDependency(NotificationShadeWindowController.class); mDependency.injectMockDependency(ForegroundServiceNotificationListener.class); - NotificationEntryManager entryManager = - mDependency.injectMockDependency(NotificationEntryManager.class); - when(entryManager.getActiveNotificationsForCurrentUser()).thenReturn(new ArrayList<>()); NotificationShadeWindowView notificationShadeWindowView = mock(NotificationShadeWindowView.class); @@ -122,9 +115,11 @@ public class StatusBarNotificationPresenterTest extends SysuiTestCase { mock(NotificationViewHierarchyManager.class), mock(NotificationLockscreenUserManager.class), mock(SysuiStatusBarStateController.class), + mock(NotificationEntryManager.class), mock(NotificationMediaManager.class), mock(NotificationGutsManager.class), mock(KeyguardUpdateMonitor.class), + lockscreenGestureLogger, mInitController, mNotificationInterruptStateProvider, mock(NotificationRemoteInputManager.class), 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 e4f6e13db607f..216be628620a9 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 @@ -205,6 +205,7 @@ public class StatusBarTest extends SysuiTestCase { @Mock private NotificationShadeWindowView mNotificationShadeWindowView; @Mock private BroadcastDispatcher mBroadcastDispatcher; @Mock private AssistManager mAssistManager; + @Mock private NotificationEntryManager mNotificationEntryManager; @Mock private NotificationGutsManager mNotificationGutsManager; @Mock private NotificationMediaManager mNotificationMediaManager; @Mock private NavigationBarController mNavigationBarController; @@ -226,6 +227,7 @@ public class StatusBarTest extends SysuiTestCase { @Mock private NotificationShadeWindowViewController mNotificationShadeWindowViewController; @Mock private DozeParameters mDozeParameters; @Mock private Lazy mLockscreenWallpaperLazy; + @Mock private LockscreenGestureLogger mLockscreenGestureLogger; @Mock private LockscreenWallpaper mLockscreenWallpaper; @Mock private DozeServiceHost mDozeServiceHost; @Mock private ViewMediatorCallback mKeyguardVieMediatorCallback; @@ -359,6 +361,7 @@ public class StatusBarTest extends SysuiTestCase { new FalsingManagerFake(), new FalsingCollectorFake(), mBroadcastDispatcher, + mNotificationEntryManager, mNotificationGutsManager, notificationLogger, mNotificationInterruptStateProvider, @@ -388,6 +391,7 @@ public class StatusBarTest extends SysuiTestCase { mDozeParameters, mScrimController, mLockscreenWallpaperLazy, + mLockscreenGestureLogger, mBiometricUnlockControllerLazy, mDozeServiceHost, mPowerManager, mScreenPinningRequest,