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

Commit 3747c15a authored by Jeff DeCew's avatar Jeff DeCew
Browse files

New Pipeline: Fix some feature flagging

* Calling addKeyguardNotificationSuppressor was supposed to be only when the old pipeline was enabled, but it was still being used on the new pipeline, so I've guarded the calls.  This makes it easier to remove the old pipeline cleanly.

Test: manual
Bug: 218105118
Change-Id: I681dfeaf6ca352f3feb287064581b746e130c701
parent a75676fd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.notification.collection

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.statusbar.notification.NotifPipelineFlags
import com.android.systemui.statusbar.notification.collection.listbuilder.OnAfterRenderEntryListener
import com.android.systemui.statusbar.notification.collection.listbuilder.OnAfterRenderGroupListener
import com.android.systemui.statusbar.notification.collection.listbuilder.OnAfterRenderListListener
@@ -75,6 +76,7 @@ import javax.inject.Inject
 */
@SysUISingleton
class NotifPipeline @Inject constructor(
    notifPipelineFlags: NotifPipelineFlags,
    private val mNotifCollection: NotifCollection,
    private val mShadeListBuilder: ShadeListBuilder,
    private val mRenderStageManager: RenderStageManager
@@ -105,6 +107,8 @@ class NotifPipeline @Inject constructor(
        return mNotifCollection.getEntry(key)
    }

    val isNewPipelineEnabled: Boolean = notifPipelineFlags.isNewPipelineEnabled()

    /**
     * Registers a lifetime extender. Lifetime extenders can cause notifications that have been
     * dismissed or retracted by system server to be temporarily retained in the collection.
+1 −5
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.statusbar.notification.collection.coordinator;

import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.collection.NotifCollection;
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -58,7 +57,6 @@ import javax.inject.Inject;
public class BubbleCoordinator implements Coordinator {
    private static final String TAG = "BubbleCoordinator";

    private final NotifPipelineFlags mNotifPipelineFlags;
    private final Optional<BubblesManager> mBubblesManagerOptional;
    private final Optional<Bubbles> mBubblesOptional;
    private final NotifCollection mNotifCollection;
@@ -68,11 +66,9 @@ public class BubbleCoordinator implements Coordinator {

    @Inject
    public BubbleCoordinator(
            NotifPipelineFlags notifPipelineFlags,
            Optional<BubblesManager> bubblesManagerOptional,
            Optional<Bubbles> bubblesOptional,
            NotifCollection notifCollection) {
        mNotifPipelineFlags = notifPipelineFlags;
        mBubblesManagerOptional = bubblesManagerOptional;
        mBubblesOptional = bubblesOptional;
        mNotifCollection = notifCollection;
@@ -131,7 +127,7 @@ public class BubbleCoordinator implements Coordinator {
                DismissedByUserStats dismissedByUserStats,
                int reason
        ) {
            if (!mNotifPipelineFlags.isNewPipelineEnabled()) {
            if (!mNotifPipeline.isNewPipelineEnabled()) {
                // The `entry` will be from whichever pipeline is active, so if the old pipeline is
                // running, make sure that we use the new pipeline's entry (if it still exists).
                NotificationEntry newPipelineEntry = mNotifPipeline.getEntry(entry.getKey());
+4 −2
Original line number Diff line number Diff line
@@ -74,7 +74,9 @@ public class CommunalCoordinator implements Coordinator {
    public void attach(@NonNull NotifPipeline pipeline) {
        pipeline.addPreGroupFilter(mFilter);
        mCommunalStateController.addCallback(mStateCallback);
        if (!pipeline.isNewPipelineEnabled()) {
            mNotificationLockscreenUserManager.addKeyguardNotificationSuppressor(
                    entry -> mCommunalStateController.getCommunalViewShowing());
        }
    }
}
+5 −3
Original line number Diff line number Diff line
@@ -65,10 +65,12 @@ class SmartspaceDedupingCoordinator @Inject constructor(
        statusBarStateController.addCallback(statusBarStateListener)
        smartspaceController.addListener(this::onNewSmartspaceTargets)

        if (!pipeline.isNewPipelineEnabled) {
            // TODO (b/173126564): Remove this once the old pipeline is no longer necessary
            notificationLockscreenUserManager.addKeyguardNotificationSuppressor { entry ->
                isDupedWithSmartspaceContent(entry)
            }
        }

        recordStatusBarState(statusBarStateController.state)
    }
+6 −11
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import com.android.internal.widget.MessagingMessage
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener
import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl
import com.android.systemui.statusbar.notification.NotifPipelineFlags
import com.android.systemui.statusbar.notification.collection.NotifPipeline
import com.android.systemui.statusbar.notification.collection.coordinator.dagger.CoordinatorScope
import com.android.systemui.statusbar.notification.row.NotificationGutsManager
@@ -35,9 +34,8 @@ import javax.inject.Inject
 */
@CoordinatorScope
class ViewConfigCoordinator @Inject internal constructor(
    configurationController: ConfigurationController,
    lockscreenUserManager: NotificationLockscreenUserManagerImpl,
    notifPipelineFlags: NotifPipelineFlags,
    private val mConfigurationController: ConfigurationController,
    private val mLockscreenUserManager: NotificationLockscreenUserManagerImpl,
    private val mGutsManager: NotificationGutsManager,
    private val mKeyguardUpdateMonitor: KeyguardUpdateMonitor
) : Coordinator, UserChangedListener, ConfigurationController.ConfigurationListener {
@@ -46,15 +44,12 @@ class ViewConfigCoordinator @Inject internal constructor(
    private var mDispatchUiModeChangeOnUserSwitched = false
    private var mPipeline: NotifPipeline? = null

    init {
        if (notifPipelineFlags.isNewPipelineEnabled()) {
            lockscreenUserManager.addUserChangedListener(this)
            configurationController.addCallback(this)
        }
    }

    override fun attach(pipeline: NotifPipeline) {
        mPipeline = pipeline
        if (pipeline.isNewPipelineEnabled) {
            mLockscreenUserManager.addUserChangedListener(this)
            mConfigurationController.addCallback(this)
        }
    }

    override fun onDensityOrFontScaleChanged() {
Loading