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

Commit 89b04ea4 authored by Darrell Shi's avatar Darrell Shi
Browse files

Suppress reordering when QS is expanded over Communal

This change fixes an issue where notifications reordering is allowed
when Quick Settings is expanded over the Glanceable Hub.

Test: atest VisualStabilityCoordinatorTest
Bug: 361090914
Flag: com.android.systemui.communal_hub
Change-Id: I1312d6ec17ce94136aea691465a8f603e4621413
parent 88f1c7e6
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -133,7 +133,8 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
                mVisibilityLocationProvider,
                mVisualStabilityProvider,
                mWakefulnessLifecycle,
                mKosmos.getCommunalInteractor(),
                mKosmos.getCommunalSceneInteractor(),
                mKosmos.getShadeInteractor(),
                mKosmos.getKeyguardTransitionInteractor(),
                mLogger);
        mCoordinator.attach(mNotifPipeline);
@@ -561,17 +562,32 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {

    @Test
    public void testCommunalShowingWillNotSuppressReordering() {
        // GIVEN panel is expanded and communal is showing
        // GIVEN panel is expanded, communal is showing, and QS is collapsed
        setPulsing(false);
        setFullyDozed(false);
        setSleepy(false);
        setPanelExpanded(true);
        setQsExpanded(false);
        setCommunalShowing(true);

        // Reordering should be allowed
        assertTrue(mNotifStabilityManager.isEntryReorderingAllowed(mEntry));
    }

    @Test
    public void testQsExpandedOverCommunalWillSuppressReordering() {
        // GIVEN panel is expanded and communal is showing, but QS is expanded
        setPulsing(false);
        setFullyDozed(false);
        setSleepy(false);
        setPanelExpanded(true);
        setQsExpanded(true);
        setCommunalShowing(true);

        // Reordering should not be allowed
        assertFalse(mNotifStabilityManager.isEntryReorderingAllowed(mEntry));
    }

    @Test
    public void testQueryingEntryReorderingButNotReportingReorderSuppressedDoesNotInvalidate() {
        // GIVEN visual stability is being maintained b/c panel is expanded
@@ -631,7 +647,12 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase {
                        new ObservableTransitionState.Idle(
                                isShowing ? CommunalScenes.Communal : CommunalScenes.Blank)
                );
        mKosmos.getCommunalRepository().setTransitionState(showingFlow);
        mKosmos.getCommunalSceneInteractor().setTransitionState(showingFlow);
        mTestScope.getTestScheduler().runCurrent();
    }

    private void setQsExpanded(boolean isExpanded) {
        mKosmos.getShadeRepository().setQsExpansion(isExpanded ? 1.0f : 0.0f);
        mTestScope.getTestScheduler().runCurrent();
    }

+14 −5
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;

import com.android.systemui.Dumpable;
import com.android.systemui.communal.domain.interactor.CommunalInteractor;
import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dump.DumpManager;
@@ -32,6 +32,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor;
import com.android.systemui.shade.domain.interactor.ShadeInteractor;
import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
import com.android.systemui.statusbar.notification.collection.GroupEntry;
import com.android.systemui.statusbar.notification.collection.ListEntry;
@@ -43,6 +44,7 @@ import com.android.systemui.statusbar.notification.domain.interactor.SeenNotific
import com.android.systemui.statusbar.notification.shared.NotificationMinimalismPrototype;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.kotlin.BooleanFlowOperators;
import com.android.systemui.util.kotlin.JavaAdapter;

import java.io.PrintWriter;
@@ -70,7 +72,8 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable {
    private final VisibilityLocationProvider mVisibilityLocationProvider;
    private final VisualStabilityProvider mVisualStabilityProvider;
    private final WakefulnessLifecycle mWakefulnessLifecycle;
    private final CommunalInteractor mCommunalInteractor;
    private final CommunalSceneInteractor mCommunalSceneInteractor;
    private final ShadeInteractor mShadeInteractor;
    private final KeyguardTransitionInteractor mKeyguardTransitionInteractor;
    private final VisualStabilityCoordinatorLogger mLogger;

@@ -110,7 +113,8 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable {
            VisibilityLocationProvider visibilityLocationProvider,
            VisualStabilityProvider visualStabilityProvider,
            WakefulnessLifecycle wakefulnessLifecycle,
            CommunalInteractor communalInteractor,
            CommunalSceneInteractor communalSceneInteractor,
            ShadeInteractor shadeInteractor,
            KeyguardTransitionInteractor keyguardTransitionInteractor,
            VisualStabilityCoordinatorLogger logger) {
        mHeadsUpManager = headsUpManager;
@@ -122,7 +126,8 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable {
        mWakefulnessLifecycle = wakefulnessLifecycle;
        mStatusBarStateController = statusBarStateController;
        mDelayableExecutor = delayableExecutor;
        mCommunalInteractor = communalInteractor;
        mCommunalSceneInteractor = communalSceneInteractor;
        mShadeInteractor = shadeInteractor;
        mKeyguardTransitionInteractor = keyguardTransitionInteractor;
        mLogger = logger;

@@ -141,7 +146,11 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable {
                this::onShadeOrQsClosingChanged);
        mJavaAdapter.alwaysCollectFlow(mShadeAnimationInteractor.isLaunchingActivity(),
                this::onLaunchingActivityChanged);
        mJavaAdapter.alwaysCollectFlow(mCommunalInteractor.isIdleOnCommunal(),
        mJavaAdapter.alwaysCollectFlow(
                BooleanFlowOperators.INSTANCE.allOf(
                        mCommunalSceneInteractor.isIdleOnCommunal(),
                        BooleanFlowOperators.INSTANCE.not(mShadeInteractor.isAnyFullyExpanded())
                ),
                this::onCommunalShowingChanged);

        if (SceneContainerFlag.isEnabled()) {