Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java +11 −8 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; import com.android.systemui.UiOffloadThread; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.StatusBarStateController; Loading Loading @@ -59,11 +58,9 @@ public class NotificationLogger implements StateListener { new ArraySet<>(); // Dependencies: private final NotificationListenerService mNotificationListener = Dependency.get(NotificationListener.class); private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class); protected NotificationEntryManager mEntryManager = Dependency.get(NotificationEntryManager.class); private final NotificationListenerService mNotificationListener; private final UiOffloadThread mUiOffloadThread; protected NotificationEntryManager mEntryManager; protected Handler mHandler = new Handler(); protected IStatusBarService mBarService; Loading Loading @@ -150,11 +147,17 @@ public class NotificationLogger implements StateListener { }; @Inject public NotificationLogger() { public NotificationLogger(NotificationListener notificationListener, UiOffloadThread uiOffloadThread, NotificationEntryManager entryManager, StatusBarStateController statusBarStateController) { mNotificationListener = notificationListener; mUiOffloadThread = uiOffloadThread; mEntryManager = entryManager; mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); // Not expected to be destroyed, don't need to unsubscribe Dependency.get(StatusBarStateController.class).addCallback(this); statusBarStateController.addCallback(this); } public void setUpWithContainer(NotificationListContainer listContainer) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java +12 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.logging; import static org.junit.Assert.assertArrayEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; Loading @@ -36,9 +37,12 @@ import android.testing.TestableLooper; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; import com.android.systemui.SysuiTestCase; import com.android.systemui.UiOffloadThread; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; Loading Loading @@ -91,7 +95,8 @@ public class NotificationLoggerTest extends SysuiTestCase { mEntry = new NotificationData.Entry(mSbn); mEntry.setRow(mRow); mLogger = new TestableNotificationLogger(mBarService); mLogger = new TestableNotificationLogger(mListener, Dependency.get(UiOffloadThread.class), mEntryManager, mock(StatusBarStateController.class), mBarService); mLogger.setUpWithContainer(mListContainer); } Loading Loading @@ -153,7 +158,12 @@ public class NotificationLoggerTest extends SysuiTestCase { private class TestableNotificationLogger extends NotificationLogger { public TestableNotificationLogger(IStatusBarService barService) { public TestableNotificationLogger(NotificationListener notificationListener, UiOffloadThread uiOffloadThread, NotificationEntryManager entryManager, StatusBarStateController statusBarStateController, IStatusBarService barService) { super(notificationListener, uiOffloadThread, entryManager, statusBarStateController); mBarService = barService; // Make this on the current thread so we can wait for it during tests. mHandler = Handler.createAsync(Looper.myLooper()); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import com.android.systemui.ForegroundServiceController; import com.android.systemui.InitController; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.UiOffloadThread; import com.android.systemui.appops.AppOpsController; import com.android.systemui.appops.AppOpsControllerImpl; import com.android.systemui.assist.AssistManager; Loading Loading @@ -195,8 +196,10 @@ public class StatusBarTest extends SysuiTestCase { mMetricsLogger = new FakeMetricsLogger(); mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); mEntryManager = new TestableNotificationEntryManager(mPowerManager, mContext); mNotificationLogger = new NotificationLogger(mNotificationListener, Dependency.get(UiOffloadThread.class), mEntryManager, mStatusBarStateController); mDependency.injectTestDependency(NotificationLogger.class, mNotificationLogger); mNotificationLogger = new NotificationLogger(); DozeLog.traceDozing(mContext, false /* dozing */); mCommandQueue = mock(CommandQueue.class); Loading Loading @@ -225,7 +228,6 @@ public class StatusBarTest extends SysuiTestCase { mNotificationInterruptionStateProvider.setUpWithPresenter(mNotificationPresenter, mHeadsUpManager, mHeadsUpSuppressor); mEntryManager = new TestableNotificationEntryManager(mPowerManager, mContext); when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController); mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager, mUnlockMethodCache, mKeyguardIndicationController, mStackScroller, mHeadsUpManager, Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java +11 −8 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; import com.android.systemui.UiOffloadThread; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.StatusBarStateController; Loading Loading @@ -59,11 +58,9 @@ public class NotificationLogger implements StateListener { new ArraySet<>(); // Dependencies: private final NotificationListenerService mNotificationListener = Dependency.get(NotificationListener.class); private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class); protected NotificationEntryManager mEntryManager = Dependency.get(NotificationEntryManager.class); private final NotificationListenerService mNotificationListener; private final UiOffloadThread mUiOffloadThread; protected NotificationEntryManager mEntryManager; protected Handler mHandler = new Handler(); protected IStatusBarService mBarService; Loading Loading @@ -150,11 +147,17 @@ public class NotificationLogger implements StateListener { }; @Inject public NotificationLogger() { public NotificationLogger(NotificationListener notificationListener, UiOffloadThread uiOffloadThread, NotificationEntryManager entryManager, StatusBarStateController statusBarStateController) { mNotificationListener = notificationListener; mUiOffloadThread = uiOffloadThread; mEntryManager = entryManager; mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); // Not expected to be destroyed, don't need to unsubscribe Dependency.get(StatusBarStateController.class).addCallback(this); statusBarStateController.addCallback(this); } public void setUpWithContainer(NotificationListContainer listContainer) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/NotificationLoggerTest.java +12 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.logging; import static org.junit.Assert.assertArrayEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; Loading @@ -36,9 +37,12 @@ import android.testing.TestableLooper; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; import com.android.systemui.SysuiTestCase; import com.android.systemui.UiOffloadThread; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.NotificationData; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; Loading Loading @@ -91,7 +95,8 @@ public class NotificationLoggerTest extends SysuiTestCase { mEntry = new NotificationData.Entry(mSbn); mEntry.setRow(mRow); mLogger = new TestableNotificationLogger(mBarService); mLogger = new TestableNotificationLogger(mListener, Dependency.get(UiOffloadThread.class), mEntryManager, mock(StatusBarStateController.class), mBarService); mLogger.setUpWithContainer(mListContainer); } Loading Loading @@ -153,7 +158,12 @@ public class NotificationLoggerTest extends SysuiTestCase { private class TestableNotificationLogger extends NotificationLogger { public TestableNotificationLogger(IStatusBarService barService) { public TestableNotificationLogger(NotificationListener notificationListener, UiOffloadThread uiOffloadThread, NotificationEntryManager entryManager, StatusBarStateController statusBarStateController, IStatusBarService barService) { super(notificationListener, uiOffloadThread, entryManager, statusBarStateController); mBarService = barService; // Make this on the current thread so we can wait for it during tests. mHandler = Handler.createAsync(Looper.myLooper()); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import com.android.systemui.ForegroundServiceController; import com.android.systemui.InitController; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.UiOffloadThread; import com.android.systemui.appops.AppOpsController; import com.android.systemui.appops.AppOpsControllerImpl; import com.android.systemui.assist.AssistManager; Loading Loading @@ -195,8 +196,10 @@ public class StatusBarTest extends SysuiTestCase { mMetricsLogger = new FakeMetricsLogger(); mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); mEntryManager = new TestableNotificationEntryManager(mPowerManager, mContext); mNotificationLogger = new NotificationLogger(mNotificationListener, Dependency.get(UiOffloadThread.class), mEntryManager, mStatusBarStateController); mDependency.injectTestDependency(NotificationLogger.class, mNotificationLogger); mNotificationLogger = new NotificationLogger(); DozeLog.traceDozing(mContext, false /* dozing */); mCommandQueue = mock(CommandQueue.class); Loading Loading @@ -225,7 +228,6 @@ public class StatusBarTest extends SysuiTestCase { mNotificationInterruptionStateProvider.setUpWithPresenter(mNotificationPresenter, mHeadsUpManager, mHeadsUpSuppressor); mEntryManager = new TestableNotificationEntryManager(mPowerManager, mContext); when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController); mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager, mUnlockMethodCache, mKeyguardIndicationController, mStackScroller, mHeadsUpManager, Loading