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

Commit 448601b7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE Filter out suppressed notifications in entry manager" into rvc-d1-dev

parents 8e41a2de b88b1b68
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.Dumpable;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NotificationLifetimeExtender;
import com.android.systemui.statusbar.NotificationListener;
@@ -189,6 +190,8 @@ public class NotificationEntryManager implements
        }
    }

    private final Lazy<BubbleController> mBubbleControllerLazy;

    /**
     * Injected constructor. See {@link NotificationsModule}.
     */
@@ -201,6 +204,7 @@ public class NotificationEntryManager implements
            Lazy<NotificationRowBinder> notificationRowBinderLazy,
            Lazy<NotificationRemoteInputManager> notificationRemoteInputManagerLazy,
            LeakDetector leakDetector,
            Lazy<BubbleController> bubbleController,
            ForegroundServiceDismissalFeatureController fgsFeatureController) {
        mLogger = logger;
        mGroupManager = groupManager;
@@ -211,6 +215,7 @@ public class NotificationEntryManager implements
        mRemoteInputManagerLazy = notificationRemoteInputManagerLazy;
        mLeakDetector = leakDetector;
        mFgsFeatureController = fgsFeatureController;
        mBubbleControllerLazy = bubbleController;
    }

    /** Once called, the NEM will start processing notification events from system server. */
@@ -920,8 +925,20 @@ public class NotificationEntryManager implements
    /**
     * @return {@code true} if there is at least one notification that should be visible right now
     */
    public boolean hasActiveNotifications() {
        return mReadOnlyNotifications.size() != 0;
    public boolean hasVisibleNotifications() {
        if (mReadOnlyNotifications.size() == 0) {
            return false;
        }

        // Filter out suppressed notifications, which are active notifications backing a bubble
        // but are not present in the shade
        for (NotificationEntry e : mSortedAndFiltered) {
            if (!mBubbleControllerLazy.get().isBubbleNotificationSuppressedFromShade(e)) {
                return true;
            }
        }

        return false;
    }

    @Override
+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ public interface NotificationsModule {
            Lazy<NotificationRowBinder> notificationRowBinderLazy,
            Lazy<NotificationRemoteInputManager> notificationRemoteInputManagerLazy,
            LeakDetector leakDetector,
            Lazy<BubbleController> bubbleController,
            ForegroundServiceDismissalFeatureController fgsFeatureController) {
        return new NotificationEntryManager(
                logger,
@@ -97,6 +98,7 @@ public interface NotificationsModule {
                notificationRowBinderLazy,
                notificationRemoteInputManagerLazy,
                leakDetector,
                bubbleController,
                fgsFeatureController);
    }

+1 −1
Original line number Diff line number Diff line
@@ -6580,7 +6580,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        if (mFeatureFlags.isNewNotifPipelineRenderingEnabled()) {
            return !mNotifPipeline.getShadeList().isEmpty();
        } else {
            return mEntryManager.hasActiveNotifications();
            return mEntryManager.hasVisibleNotifications();
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public class LightsOutNotifController {
    }

    private boolean hasActiveNotifications() {
        return mEntryManager.hasActiveNotifications();
        return mEntryManager.hasVisibleNotifications();
    }

    @VisibleForTesting
+1 −1
Original line number Diff line number Diff line
@@ -3003,7 +3003,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private void updateShowEmptyShadeView() {
        boolean
                showEmptyShadeView =
                mBarState != StatusBarState.KEYGUARD && !mEntryManager.hasActiveNotifications();
                mBarState != StatusBarState.KEYGUARD && !mEntryManager.hasVisibleNotifications();
        showEmptyShadeView(showEmptyShadeView);
    }

Loading