diff options
15 files changed, 75 insertions, 82 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGutsManager.java index 0cecadfab9be..9dda2a218cef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGutsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGutsManager.java @@ -71,10 +71,8 @@ public class NotificationGutsManager implements Dumpable { // which notification is currently being longpress-examined by the user private NotificationGuts mNotificationGutsExposed; private NotificationMenuRowPlugin.MenuItem mGutsMenuItem; - private NotificationPresenter mPresenter; - - // TODO: Create NotificationListContainer interface and use it instead of - // NotificationStackScrollLayout here + protected NotificationPresenter mPresenter; + protected NotificationEntryManager mEntryManager; private NotificationListContainer mListContainer; private NotificationInfo.CheckSaveListener mCheckSaveListener; private OnSettingsClickListener mOnSettingsClickListener; @@ -95,10 +93,12 @@ public class NotificationGutsManager implements Dumpable { mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); } - public void setUp(NotificationPresenter presenter, NotificationListContainer listContainer, + public void setUpWithPresenter(NotificationPresenter presenter, + NotificationEntryManager entryManager, NotificationListContainer listContainer, NotificationInfo.CheckSaveListener checkSaveListener, OnSettingsClickListener onSettingsClickListener) { mPresenter = presenter; + mEntryManager = entryManager; mListContainer = listContainer; mCheckSaveListener = checkSaveListener; mOnSettingsClickListener = onSettingsClickListener; @@ -166,8 +166,7 @@ public class NotificationGutsManager implements Dumpable { String key = sbn.getKey(); if (key.equals(mKeyToRemoveOnGutsClosed)) { mKeyToRemoveOnGutsClosed = null; - mPresenter.getEntryManager().removeNotification(key, - mPresenter.getEntryManager().getLatestRankingMap()); + mEntryManager.removeNotification(key, mEntryManager.getLatestRankingMap()); } }); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java index cd51f03fcba9..113a5a477410 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java @@ -39,7 +39,8 @@ public class NotificationListener extends NotificationListenerWithPlugins { private final NotificationRemoteInputManager mRemoteInputManager; private final Context mContext; - private NotificationPresenter mPresenter; + protected NotificationPresenter mPresenter; + protected NotificationEntryManager mEntryManager; public NotificationListener(NotificationRemoteInputManager remoteInputManager, Context context) { @@ -59,7 +60,7 @@ public class NotificationListener extends NotificationListenerWithPlugins { final RankingMap currentRanking = getCurrentRanking(); mPresenter.getHandler().post(() -> { for (StatusBarNotification sbn : notifications) { - mPresenter.getEntryManager().addNotification(sbn, currentRanking); + mEntryManager.addNotification(sbn, currentRanking); } }); } @@ -74,7 +75,7 @@ public class NotificationListener extends NotificationListenerWithPlugins { String key = sbn.getKey(); mRemoteInputManager.getKeysKeptForRemoteInput().remove(key); boolean isUpdate = - mPresenter.getEntryManager().getNotificationData().get(key) != null; + mEntryManager.getNotificationData().get(key) != null; // In case we don't allow child notifications, we ignore children of // notifications that have a summary, since` we're not going to show them // anyway. This is true also when the summary is canceled, @@ -87,17 +88,17 @@ public class NotificationListener extends NotificationListenerWithPlugins { // Remove existing notification to avoid stale data. if (isUpdate) { - mPresenter.getEntryManager().removeNotification(key, rankingMap); + mEntryManager.removeNotification(key, rankingMap); } else { - mPresenter.getEntryManager().getNotificationData() + mEntryManager.getNotificationData() .updateRanking(rankingMap); } return; } if (isUpdate) { - mPresenter.getEntryManager().updateNotification(sbn, rankingMap); + mEntryManager.updateNotification(sbn, rankingMap); } else { - mPresenter.getEntryManager().addNotification(sbn, rankingMap); + mEntryManager.addNotification(sbn, rankingMap); } }); } @@ -110,7 +111,7 @@ public class NotificationListener extends NotificationListenerWithPlugins { if (sbn != null && !onPluginNotificationRemoved(sbn, rankingMap)) { final String key = sbn.getKey(); mPresenter.getHandler().post(() -> { - mPresenter.getEntryManager().removeNotification(key, rankingMap); + mEntryManager.removeNotification(key, rankingMap); }); } } @@ -121,13 +122,15 @@ public class NotificationListener extends NotificationListenerWithPlugins { if (rankingMap != null) { RankingMap r = onPluginRankingUpdate(rankingMap); mPresenter.getHandler().post(() -> { - mPresenter.getEntryManager().updateNotificationRanking(r); + mEntryManager.updateNotificationRanking(r); }); } } - public void setUpWithPresenter(NotificationPresenter presenter) { + public void setUpWithPresenter(NotificationPresenter presenter, + NotificationEntryManager entryManager) { mPresenter = presenter; + mEntryManager = entryManager; try { registerAsSystemService(mContext, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java index 25eb9cccf4ef..06e7f0acfbf3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManager.java @@ -81,7 +81,7 @@ public class NotificationLockscreenUserManager implements Dumpable { isCurrentProfile(getSendingUserId())) { mUsersAllowingPrivateNotifications.clear(); updateLockscreenNotificationSetting(); - mPresenter.getEntryManager().updateNotifications(); + mEntryManager.updateNotifications(); } else if (Intent.ACTION_DEVICE_LOCKED_CHANGED.equals(action)) { if (userId != mCurrentUserId && isCurrentProfile(userId)) { mPresenter.onWorkChallengeChanged(); @@ -157,6 +157,7 @@ public class NotificationLockscreenUserManager implements Dumpable { protected int mCurrentUserId = 0; protected NotificationPresenter mPresenter; + protected NotificationEntryManager mEntryManager; protected ContentObserver mLockscreenSettingsObserver; protected ContentObserver mSettingsObserver; @@ -170,8 +171,10 @@ public class NotificationLockscreenUserManager implements Dumpable { ServiceManager.getService(Context.STATUS_BAR_SERVICE)); } - public void setUpWithPresenter(NotificationPresenter presenter) { + public void setUpWithPresenter(NotificationPresenter presenter, + NotificationEntryManager entryManager) { mPresenter = presenter; + mEntryManager = entryManager; mLockscreenSettingsObserver = new ContentObserver(mPresenter.getHandler()) { @Override @@ -182,7 +185,7 @@ public class NotificationLockscreenUserManager implements Dumpable { mUsersAllowingNotifications.clear(); // ... and refresh all the notifications updateLockscreenNotificationSetting(); - mPresenter.getEntryManager().updateNotifications(); + mEntryManager.updateNotifications(); } }; @@ -191,7 +194,7 @@ public class NotificationLockscreenUserManager implements Dumpable { public void onChange(boolean selfChange) { updateLockscreenNotificationSetting(); if (mDeviceProvisionedController.isDeviceProvisioned()) { - mPresenter.getEntryManager().updateNotifications(); + mEntryManager.updateNotifications(); } } }; @@ -271,13 +274,13 @@ public class NotificationLockscreenUserManager implements Dumpable { */ public boolean shouldHideNotifications(String key) { return isLockscreenPublicMode(mCurrentUserId) - && mPresenter.getEntryManager().getNotificationData().getVisibilityOverride(key) == + && mEntryManager.getNotificationData().getVisibilityOverride(key) == Notification.VISIBILITY_SECRET; } public boolean shouldShowOnKeyguard(StatusBarNotification sbn) { return mShowLockscreenNotifications - && !mPresenter.getEntryManager().getNotificationData().isAmbient(sbn.getKey()); + && !mEntryManager.getNotificationData().isAmbient(sbn.getKey()); } private void setShowLockscreenNotifications(boolean show) { @@ -395,7 +398,7 @@ public class NotificationLockscreenUserManager implements Dumpable { } private boolean packageHasVisibilityOverride(String key) { - return mPresenter.getEntryManager().getNotificationData().getVisibilityOverride(key) == + return mEntryManager.getNotificationData().getVisibilityOverride(key) == Notification.VISIBILITY_PRIVATE; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLogger.java index 9ff7c18a570a..76825feac0ce 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLogger.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLogger.java @@ -49,7 +49,7 @@ public class NotificationLogger { private final NotificationListenerService mNotificationListener; private final UiOffloadThread mUiOffloadThread; - protected NotificationPresenter mPresenter; + protected NotificationEntryManager mEntryManager; protected Handler mHandler = new Handler(); protected IStatusBarService mBarService; private long mLastVisibilityReportUptimeMs; @@ -96,8 +96,8 @@ public class NotificationLogger { // notifications. // 3. Report newly visible and no-longer visible notifications. // 4. Keep currently visible notifications for next report. - ArrayList<NotificationData.Entry> activeNotifications = mPresenter.getEntryManager(). - getNotificationData().getActiveNotifications(); + ArrayList<NotificationData.Entry> activeNotifications = mEntryManager + .getNotificationData().getActiveNotifications(); int N = activeNotifications.size(); for (int i = 0; i < N; i++) { NotificationData.Entry entry = activeNotifications.get(i); @@ -140,9 +140,9 @@ public class NotificationLogger { ServiceManager.getService(Context.STATUS_BAR_SERVICE)); } - public void setUpWithPresenter(NotificationPresenter presenter, + public void setUpWithEntryManager(NotificationEntryManager entryManager, NotificationListContainer listContainer) { - mPresenter = presenter; + mEntryManager = entryManager; mListContainer = listContainer; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java index 158a986f2cd4..852239a2143b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java @@ -43,7 +43,8 @@ public class NotificationMediaManager implements Dumpable { private final Context mContext; private final MediaSessionManager mMediaSessionManager; - private NotificationPresenter mPresenter; + protected NotificationPresenter mPresenter; + protected NotificationEntryManager mEntryManager; private MediaController mMediaController; private String mMediaNotificationKey; private MediaMetadata mMediaMetadata; @@ -82,8 +83,10 @@ public class NotificationMediaManager implements Dumpable { // in session state } - public void setUpWithPresenter(NotificationPresenter presenter) { + public void setUpWithPresenter(NotificationPresenter presenter, + NotificationEntryManager entryManager) { mPresenter = presenter; + mEntryManager = entryManager; } public void onNotificationRemoved(String key) { @@ -104,8 +107,8 @@ public class NotificationMediaManager implements Dumpable { public void findAndUpdateMediaNotifications() { boolean metaDataChanged = false; - synchronized (mPresenter.getEntryManager().getNotificationData()) { - ArrayList<NotificationData.Entry> activeNotifications = mPresenter.getEntryManager() + synchronized (mEntryManager.getNotificationData()) { + ArrayList<NotificationData.Entry> activeNotifications = mEntryManager .getNotificationData().getActiveNotifications(); final int N = activeNotifications.size(); @@ -192,7 +195,7 @@ public class NotificationMediaManager implements Dumpable { } if (metaDataChanged) { - mPresenter.getEntryManager().updateNotifications(); + mEntryManager.updateNotifications(); } mPresenter.updateMediaMetaData(metaDataChanged, true); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java index ec1a8bae1f28..12641a0eca8c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java @@ -98,13 +98,6 @@ public interface NotificationPresenter extends NotificationData.Environment, boolean isDeviceInVrMode(); /** - * Returns the NotificationEntryManager for this presenter. - * - * @return NotificationEntryManager - */ - NotificationEntryManager getEntryManager(); - - /** * Updates the visual representation of the notifications. */ void updateNotificationViews(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index d0428d0ee51d..03e941dcbc7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -83,6 +83,7 @@ public class NotificationRemoteInputManager implements Dumpable { protected RemoteInputController mRemoteInputController; protected NotificationPresenter mPresenter; + protected NotificationEntryManager mEntryManager; protected IStatusBarService mBarService; protected Callback mCallback; @@ -273,16 +274,18 @@ public class NotificationRemoteInputManager implements Dumpable { } public void setUpWithPresenter(NotificationPresenter presenter, + NotificationEntryManager entryManager, Callback callback, RemoteInputController.Delegate delegate) { mPresenter = presenter; + mEntryManager = entryManager; mCallback = callback; mRemoteInputController = new RemoteInputController(delegate); mRemoteInputController.addCallback(new RemoteInputController.Callback() { @Override public void onRemoteInputSent(NotificationData.Entry entry) { if (FORCE_REMOTE_INPUT_HISTORY && mKeysKeptForRemoteInput.contains(entry.key)) { - mPresenter.getEntryManager().removeNotification(entry.key, null); + mEntryManager.removeNotification(entry.key, null); } else if (mRemoteInputEntriesToRemoveOnCollapse.contains(entry)) { // We're currently holding onto this notification, but from the apps point of // view it is already canceled, so we'll need to cancel it on the apps behalf @@ -290,7 +293,7 @@ public class NotificationRemoteInputManager implements Dumpable { // bit. mPresenter.getHandler().postDelayed(() -> { if (mRemoteInputEntriesToRemoveOnCollapse.remove(entry)) { - mPresenter.getEntryManager().removeNotification(entry.key, null); + mEntryManager.removeNotification(entry.key, null); } }, REMOTE_INPUT_KEPT_ENTRY_AUTO_CANCEL_DELAY); } @@ -336,8 +339,7 @@ public class NotificationRemoteInputManager implements Dumpable { for (int i = 0; i < mRemoteInputEntriesToRemoveOnCollapse.size(); i++) { NotificationData.Entry entry = mRemoteInputEntriesToRemoveOnCollapse.valueAt(i); mRemoteInputController.removeRemoteInput(entry, null); - mPresenter.getEntryManager().removeNotification(entry.key, - mPresenter.getEntryManager().getLatestRankingMap()); + mEntryManager.removeNotification(entry.key, mEntryManager.getLatestRankingMap()); } mRemoteInputEntriesToRemoveOnCollapse.clear(); } 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 72a52d84854d..2da1e4d108b4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -644,7 +644,7 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardManager = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); mLockPatternUtils = new LockPatternUtils(mContext); - mMediaManager.setUpWithPresenter(this); + mMediaManager.setUpWithPresenter(this, mEntryManager); // Connect in to the status bar manager service mCommandQueue = getComponent(CommandQueue.class); @@ -670,7 +670,7 @@ public class StatusBar extends SystemUI implements DemoMode, mContext.registerReceiver(mWallpaperChangedReceiver, wallpaperChangedFilter); mWallpaperChangedReceiver.onReceive(mContext, null); - mLockscreenUserManager.setUpWithPresenter(this); + mLockscreenUserManager.setUpWithPresenter(this, mEntryManager); mCommandQueue.disable(switches[0], switches[6], false /* animate */); setSystemUiVisibility(switches[1], switches[7], switches[8], 0xffffffff, fullscreenStackBounds, dockedStackBounds); @@ -685,7 +685,7 @@ public class StatusBar extends SystemUI implements DemoMode, } // Set up the initial notification state. - mNotificationListener.setUpWithPresenter(this); + mNotificationListener.setUpWithPresenter(this, mEntryManager); if (DEBUG) { Log.d(TAG, String.format( @@ -753,7 +753,7 @@ public class StatusBar extends SystemUI implements DemoMode, // into fragments, but the rest here, it leaves some awkward lifecycle and whatnot. mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel); mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller); - mGutsManager.setUp(this, mStackScroller, mCheckSaveListener, + mGutsManager.setUpWithPresenter(this, mEntryManager, mStackScroller, mCheckSaveListener, key -> { try { mBarService.onNotificationSettingsViewed(key); @@ -761,7 +761,7 @@ public class StatusBar extends SystemUI implements DemoMode, // if we're here we're dead } }); - mNotificationLogger.setUpWithPresenter(this, mStackScroller); + mNotificationLogger.setUpWithEntryManager(mEntryManager, mStackScroller); mNotificationPanel.setStatusBar(this); mNotificationPanel.setGroupManager(mGroupManager); mAboveShelfObserver = new AboveShelfObserver(mStackScroller); @@ -2728,19 +2728,20 @@ public class StatusBar extends SystemUI implements DemoMode, private void addStatusBarWindow() { makeStatusBarView(); mStatusBarWindowManager = Dependency.get(StatusBarWindowManager.class); - mRemoteInputManager.setUpWithPresenter(this, this, new RemoteInputController.Delegate() { - public void setRemoteInputActive(NotificationData.Entry entry, - boolean remoteInputActive) { - mHeadsUpManager.setRemoteInputActive(entry, remoteInputActive); - } - public void lockScrollTo(NotificationData.Entry entry) { - mStackScroller.lockScrollTo(entry.row); - } - public void requestDisallowLongPressAndDismiss() { - mStackScroller.requestDisallowLongPress(); - mStackScroller.requestDisallowDismiss(); - } - }); + mRemoteInputManager.setUpWithPresenter(this, mEntryManager, this, + new RemoteInputController.Delegate() { + public void setRemoteInputActive(NotificationData.Entry entry, + boolean remoteInputActive) { + mHeadsUpManager.setRemoteInputActive(entry, remoteInputActive); + } + public void lockScrollTo(NotificationData.Entry entry) { + mStackScroller.lockScrollTo(entry.row); + } + public void requestDisallowLongPressAndDismiss() { + mStackScroller.requestDisallowLongPress(); + mStackScroller.requestDisallowDismiss(); + } + }); mStatusBarWindowManager.add(mStatusBarWindow, getStatusBarHeight()); } @@ -4825,11 +4826,6 @@ public class StatusBar extends SystemUI implements DemoMode, return mVrMode; } - @Override - public NotificationEntryManager getEntryManager() { - return mEntryManager; - } - private final BroadcastReceiver mBannerActionBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryManagerTest.java index d8de4e343725..90812cfef9df 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationEntryManagerTest.java @@ -155,7 +155,6 @@ public class NotificationEntryManagerTest extends SysuiTestCase { mCountDownLatch = new CountDownLatch(1); when(mPresenter.getHandler()).thenReturn(mHandler); - when(mPresenter.getEntryManager()).thenReturn(mEntryManager); when(mPresenter.getNotificationLockscreenUserManager()).thenReturn(mLockscreenUserManager); when(mPresenter.getGroupManager()).thenReturn(mGroupManager); when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java index 5a4c4b890928..9fbf7eab0cb8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationListenerTest.java @@ -74,7 +74,6 @@ public class NotificationListenerTest extends SysuiTestCase { mKeysKeptForRemoteInput = new HashSet<>(); when(mPresenter.getHandler()).thenReturn(mHandler); - when(mPresenter.getEntryManager()).thenReturn(mEntryManager); when(mEntryManager.getNotificationData()).thenReturn(mNotificationData); when(mRemoteInputManager.getKeysKeptForRemoteInput()).thenReturn(mKeysKeptForRemoteInput); @@ -82,7 +81,7 @@ public class NotificationListenerTest extends SysuiTestCase { mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, 0, new Notification(), UserHandle.CURRENT, null, 0); - mListener.setUpWithPresenter(mPresenter); + mListener.setUpWithPresenter(mPresenter, mEntryManager); } @Test 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 ad0e24c280a8..cb8f7ce1a92b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerTest.java @@ -80,10 +80,9 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase { when(mUserManager.getProfiles(mCurrentUserId)).thenReturn(Lists.newArrayList( new UserInfo(mCurrentUserId, "", 0), new UserInfo(mCurrentUserId + 1, "", 0))); when(mPresenter.getHandler()).thenReturn(mHandler); - when(mPresenter.getEntryManager()).thenReturn(mEntryManager); mLockscreenUserManager = new TestNotificationLockscreenUserManager(mContext); - mLockscreenUserManager.setUpWithPresenter(mPresenter); + mLockscreenUserManager.setUpWithPresenter(mPresenter, mEntryManager); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLoggerTest.java index 20a5a63f8bed..b705241c803e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLoggerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationLoggerTest.java @@ -73,7 +73,6 @@ public class NotificationLoggerTest extends SysuiTestCase { mDependency.injectTestDependency(NotificationEntryManager.class, mEntryManager); mDependency.injectTestDependency(NotificationListener.class, mListener); - when(mPresenter.getEntryManager()).thenReturn(mEntryManager); when(mEntryManager.getNotificationData()).thenReturn(mNotificationData); mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, @@ -83,7 +82,7 @@ public class NotificationLoggerTest extends SysuiTestCase { mLogger = new TestableNotificationLogger(mListener, mDependency.get(UiOffloadThread.class), mBarService); - mLogger.setUpWithPresenter(mPresenter, mListContainer); + mLogger.setUpWithEntryManager(mEntryManager, mListContainer); } @Test 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 016336396049..e1d28e93b451 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationRemoteInputManagerTest.java @@ -59,7 +59,6 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { mHandler = new Handler(Looper.getMainLooper()); when(mPresenter.getHandler()).thenReturn(mHandler); - when(mPresenter.getEntryManager()).thenReturn(mEntryManager); when(mEntryManager.getLatestRankingMap()).thenReturn(mRanking); mRemoteInputManager = new TestableNotificationRemoteInputManager(mLockscreenUserManager, @@ -69,8 +68,8 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { mEntry = new NotificationData.Entry(mSbn); mEntry.row = mRow; - mRemoteInputManager.setUpWithPresenterForTest(mPresenter, mCallback, mDelegate, - mController); + mRemoteInputManager.setUpWithPresenterForTest(mPresenter, mEntryManager, mCallback, + mDelegate, mController); } @Test @@ -115,10 +114,11 @@ public class NotificationRemoteInputManagerTest extends SysuiTestCase { } public void setUpWithPresenterForTest(NotificationPresenter presenter, + NotificationEntryManager entryManager, Callback callback, RemoteInputController.Delegate delegate, RemoteInputController controller) { - super.setUpWithPresenter(presenter, callback, delegate); + super.setUpWithPresenter(presenter, entryManager, callback, delegate); mRemoteInputController = controller; } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java index b9baf431e95c..60bdf0cb3399 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationViewHierarchyManagerTest.java @@ -71,7 +71,6 @@ public class NotificationViewHierarchyManagerTest extends SysuiTestCase { mDependency.injectTestDependency(NotificationGroupManager.class, mGroupManager); mDependency.injectTestDependency(VisualStabilityManager.class, mVisualStabilityManager); - when(mPresenter.getEntryManager()).thenReturn(mEntryManager); when(mEntryManager.getNotificationData()).thenReturn(mNotificationData); mViewHierarchyManager = new NotificationViewHierarchyManager(mLockscreenUserManager, 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 52b2308403bd..bf6e9baa4de8 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 @@ -53,7 +53,6 @@ import android.support.test.metricshelper.MetricsAsserts; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; -import android.util.DisplayMetrics; import android.util.SparseArray; import android.view.ViewGroup.LayoutParams; @@ -195,7 +194,7 @@ public class StatusBarTest extends SysuiTestCase { mStatusBar.mComponents = mContext.getComponents(); mEntryManager.setUpForTest(mStatusBar, mStackScroller, mStatusBar, mHeadsUpManager, mNotificationData); - mNotificationLogger.setUpWithPresenter(mStatusBar, mStackScroller); + mNotificationLogger.setUpWithEntryManager(mEntryManager, mStackScroller); TestableLooper.get(this).setMessageHandler(m -> { if (m.getCallback() == mStatusBar.mNotificationLogger.getVisibilityReporter()) { |