Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1016d962 authored by Ned Burns's avatar Ned Burns
Browse files

Remove NEM dependency on GutsManager

Moved to NotificationPresenter (which will need to be broken up
eventually, not but today).

Test: atest
Change-Id: I9dd9c612738bed8e34dc0f394fc397c6b5dbf5c5
parent 70a5fa70
Loading
Loading
Loading
Loading
+0 −16
Original line number Original line Diff line number Diff line
@@ -39,7 +39,6 @@ import com.android.systemui.statusbar.NotificationUpdateHandler;
import com.android.systemui.statusbar.notification.collection.NotificationData;
import com.android.systemui.statusbar.notification.collection.NotificationData;
import com.android.systemui.statusbar.notification.collection.NotificationData.KeyguardEnvironment;
import com.android.systemui.statusbar.notification.collection.NotificationData.KeyguardEnvironment;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.row.NotificationInflater;
import com.android.systemui.statusbar.notification.row.NotificationInflater;
import com.android.systemui.statusbar.notification.row.NotificationInflater.InflationFlag;
import com.android.systemui.statusbar.notification.row.NotificationInflater.InflationFlag;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
@@ -72,8 +71,6 @@ public class NotificationEntryManager implements
    protected final Context mContext;
    protected final Context mContext;
    protected final HashMap<String, NotificationEntry> mPendingNotifications = new HashMap<>();
    protected final HashMap<String, NotificationEntry> mPendingNotifications = new HashMap<>();


    private final NotificationGutsManager mGutsManager =
            Dependency.get(NotificationGutsManager.class);
    private final DeviceProvisionedController mDeviceProvisionedController =
    private final DeviceProvisionedController mDeviceProvisionedController =
            Dependency.get(DeviceProvisionedController.class);
            Dependency.get(DeviceProvisionedController.class);
    private final ForegroundServiceController mForegroundServiceController =
    private final ForegroundServiceController mForegroundServiceController =
@@ -370,19 +367,6 @@ public class NotificationEntryManager implements
        }
        }
    }
    }


    public void updateNotificationsOnDensityOrFontScaleChanged() {
        ArrayList<NotificationEntry> userNotifications =
                mNotificationData.getNotificationsForCurrentUser();
        for (int i = 0; i < userNotifications.size(); i++) {
            NotificationEntry entry = userNotifications.get(i);
            entry.onDensityOrFontScaleChanged();
            boolean exposedGuts = entry.areGutsExposed();
            if (exposedGuts) {
                mGutsManager.onDensityOrFontScaleChanged(entry);
            }
        }
    }

    private void addNotificationInternal(StatusBarNotification notification,
    private void addNotificationInternal(StatusBarNotification notification,
            NotificationListenerService.RankingMap rankingMap) throws InflationException {
            NotificationListenerService.RankingMap rankingMap) throws InflationException {
        String key = notification.getKey();
        String key = notification.getKey();
+19 −6
Original line number Original line Diff line number Diff line
@@ -104,6 +104,8 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
            Dependency.get(NotificationMediaManager.class);
            Dependency.get(NotificationMediaManager.class);
    private final VisualStabilityManager mVisualStabilityManager =
    private final VisualStabilityManager mVisualStabilityManager =
            Dependency.get(VisualStabilityManager.class);
            Dependency.get(VisualStabilityManager.class);
    private final NotificationGutsManager mGutsManager =
            Dependency.get(NotificationGutsManager.class);
    protected AmbientPulseManager mAmbientPulseManager = Dependency.get(AmbientPulseManager.class);
    protected AmbientPulseManager mAmbientPulseManager = Dependency.get(AmbientPulseManager.class);


    private final NotificationPanelView mNotificationPanel;
    private final NotificationPanelView mNotificationPanel;
@@ -206,14 +208,12 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
                }
                }
            };
            };


            NotificationGutsManager gutsManager = Dependency.get(NotificationGutsManager.class);

            mViewHierarchyManager.setUpWithPresenter(this, notifListContainer);
            mViewHierarchyManager.setUpWithPresenter(this, notifListContainer);
            mEntryManager.setUpWithPresenter(this, notifListContainer, mHeadsUpManager);
            mEntryManager.setUpWithPresenter(this, notifListContainer, mHeadsUpManager);
            mEntryManager.addNotificationEntryListener(notificationEntryListener);
            mEntryManager.addNotificationEntryListener(notificationEntryListener);
            mEntryManager.addNotificationLifetimeExtender(mHeadsUpManager);
            mEntryManager.addNotificationLifetimeExtender(mHeadsUpManager);
            mEntryManager.addNotificationLifetimeExtender(mAmbientPulseManager);
            mEntryManager.addNotificationLifetimeExtender(mAmbientPulseManager);
            mEntryManager.addNotificationLifetimeExtender(gutsManager);
            mEntryManager.addNotificationLifetimeExtender(mGutsManager);
            mEntryManager.addNotificationLifetimeExtenders(
            mEntryManager.addNotificationLifetimeExtenders(
                    remoteInputManager.getLifetimeExtenders());
                    remoteInputManager.getLifetimeExtenders());
            mNotificationRowBinder.setUpWithPresenter(this, notifListContainer, mHeadsUpManager,
            mNotificationRowBinder.setUpWithPresenter(this, notifListContainer, mHeadsUpManager,
@@ -223,7 +223,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
            mLockscreenUserManager.setUpWithPresenter(this);
            mLockscreenUserManager.setUpWithPresenter(this);
            mMediaManager.setUpWithPresenter(this);
            mMediaManager.setUpWithPresenter(this);
            mVisualStabilityManager.setUpWithPresenter(this);
            mVisualStabilityManager.setUpWithPresenter(this);
            gutsManager.setUpWithPresenter(this,
            mGutsManager.setUpWithPresenter(this,
                    notifListContainer, mCheckSaveListener, mOnSettingsClickListener);
                    notifListContainer, mCheckSaveListener, mOnSettingsClickListener);
            // ForegroundServiceControllerListener adds its listener in its constructor
            // ForegroundServiceControllerListener adds its listener in its constructor
            // but we need to request it here in order for it to be instantiated.
            // but we need to request it here in order for it to be instantiated.
@@ -242,7 +242,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
        MessagingMessage.dropCache();
        MessagingMessage.dropCache();
        MessagingGroup.dropCache();
        MessagingGroup.dropCache();
        if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
        if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
            mEntryManager.updateNotificationsOnDensityOrFontScaleChanged();
            updateNotificationsOnDensityOrFontScaleChanged();
        } else {
        } else {
            mReinflateNotificationsOnUserSwitched = true;
            mReinflateNotificationsOnUserSwitched = true;
        }
        }
@@ -269,6 +269,19 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
        }
        }
    }
    }


    private void updateNotificationsOnDensityOrFontScaleChanged() {
        ArrayList<NotificationEntry> userNotifications =
                mEntryManager.getNotificationData().getNotificationsForCurrentUser();
        for (int i = 0; i < userNotifications.size(); i++) {
            NotificationEntry entry = userNotifications.get(i);
            entry.onDensityOrFontScaleChanged();
            boolean exposedGuts = entry.areGutsExposed();
            if (exposedGuts) {
                mGutsManager.onDensityOrFontScaleChanged(entry);
            }
        }
    }

    @Override
    @Override
    public boolean isCollapsing() {
    public boolean isCollapsing() {
        return mNotificationPanel.isCollapsing()
        return mNotificationPanel.isCollapsing()
@@ -367,7 +380,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
        if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
        if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
        mCommandQueue.animateCollapsePanels();
        mCommandQueue.animateCollapsePanels();
        if (mReinflateNotificationsOnUserSwitched) {
        if (mReinflateNotificationsOnUserSwitched) {
            mEntryManager.updateNotificationsOnDensityOrFontScaleChanged();
            updateNotificationsOnDensityOrFontScaleChanged();
            mReinflateNotificationsOnUserSwitched = false;
            mReinflateNotificationsOnUserSwitched = false;
        }
        }
        if (mDispatchUiModeChangeOnUserSwitched) {
        if (mDispatchUiModeChangeOnUserSwitched) {