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

Commit 687043b7 authored by Ned Burns's avatar Ned Burns
Browse files

Break circular dependency in NotificationEntryManager

The NEM has a dependency on the ranker that it really shouldn't have
(because the ranker has a dependency on things that might want to have a
dependency on the NEM). This makes it a lazy dependency for now -- this
should be a field that gets set on the NEM eventually.

Bug: 186481467
Test: atest
Change-Id: Ic5192c787ad367fadfc1e43eb529f7663ab81d77
parent 4f2e331f
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ public class NotificationEntryManager implements

    private final KeyguardEnvironment mKeyguardEnvironment;
    private final NotificationGroupManagerLegacy mGroupManager;
    private final NotificationRankingManager mRankingManager;
    private final Lazy<NotificationRankingManager> mRankingManager;
    private final FeatureFlags mFeatureFlags;
    private final ForegroundServiceDismissalFeatureController mFgsFeatureController;

@@ -200,7 +200,7 @@ public class NotificationEntryManager implements
    public NotificationEntryManager(
            NotificationEntryManagerLogger logger,
            NotificationGroupManagerLegacy groupManager,
            NotificationRankingManager rankingManager,
            Lazy<NotificationRankingManager> rankingManager,
            KeyguardEnvironment keyguardEnvironment,
            FeatureFlags featureFlags,
            Lazy<NotificationRowBinder> notificationRowBinderLazy,
@@ -419,7 +419,7 @@ public class NotificationEntryManager implements

        mActiveNotifications.put(entry.getKey(), entry);
        mGroupManager.onEntryAdded(entry);
        updateRankingAndSort(mRankingManager.getRankingMap(), "addEntryInternalInternal");
        updateRankingAndSort(mRankingManager.get().getRankingMap(), "addEntryInternalInternal");
    }

    /**
@@ -886,13 +886,13 @@ public class NotificationEntryManager implements

    /** Resorts / filters the current notification set with the current RankingMap */
    public void reapplyFilterAndSort(String reason) {
        updateRankingAndSort(mRankingManager.getRankingMap(), reason);
        updateRankingAndSort(mRankingManager.get().getRankingMap(), reason);
    }

    /** Calls to NotificationRankingManager and updates mSortedAndFiltered */
    private void updateRankingAndSort(@NonNull RankingMap rankingMap, String reason) {
        mSortedAndFiltered.clear();
        mSortedAndFiltered.addAll(mRankingManager.updateRanking(
        mSortedAndFiltered.addAll(mRankingManager.get().updateRanking(
                rankingMap, mActiveNotifications.values(), reason));
    }

+1 −3
Original line number Diff line number Diff line
@@ -80,8 +80,6 @@ import com.android.systemui.wmshell.BubblesManager;
import java.util.Optional;
import java.util.concurrent.Executor;

import javax.inject.Provider;

import dagger.Binds;
import dagger.Lazy;
import dagger.Module;
@@ -102,7 +100,7 @@ public interface NotificationsModule {
    static NotificationEntryManager provideNotificationEntryManager(
            NotificationEntryManagerLogger logger,
            NotificationGroupManagerLegacy groupManager,
            NotificationRankingManager rankingManager,
            Lazy<NotificationRankingManager> rankingManager,
            NotificationEntryManager.KeyguardEnvironment keyguardEnvironment,
            FeatureFlags featureFlags,
            Lazy<NotificationRowBinder> notificationRowBinderLazy,
+1 −1
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase {
        mEntryManager = new NotificationEntryManager(
                mLogger,
                mGroupManager,
                new NotificationRankingManager(
                () -> new NotificationRankingManager(
                        () -> mNotificationMediaManager,
                        mGroupManager,
                        mHeadsUpManager,
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ public class NotificationEntryManagerInflationTest extends SysuiTestCase {
        mEntryManager = new NotificationEntryManager(
                mock(NotificationEntryManagerLogger.class),
                mGroupMembershipManager,
                new NotificationRankingManager(
                () -> new NotificationRankingManager(
                        () -> mock(NotificationMediaManager.class),
                        mGroupMembershipManager,
                        mHeadsUpManager,