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

Commit f4918271 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I938c93bd,Ia3640874 into main

* changes:
  [flexiglass] Only show full notifications on lockscreen
  [flexiglass] StatusBarState is KEYGUARD on Scenes.Lockscreen
parents cf745080 d0c09925
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.systemui.kosmos.testScope
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.scene.data.repository.Idle
import com.android.systemui.scene.data.repository.setTransition
import com.android.systemui.scene.domain.interactor.sceneBackInteractor
import com.android.systemui.scene.domain.interactor.sceneContainerOcclusionInteractor
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Scenes
@@ -112,6 +113,7 @@ class StatusBarStateControllerImplTest(flags: FlagsParameterization) : SysuiTest
                    { kosmos.sceneInteractor },
                    { kosmos.sceneContainerOcclusionInteractor },
                    { kosmos.keyguardClockInteractor },
                    { kosmos.sceneBackInteractor },
                ) {
                override fun createDarkAnimator(): ObjectAnimator {
                    return mockDarkAnimator
@@ -320,12 +322,23 @@ class StatusBarStateControllerImplTest(flags: FlagsParameterization) : SysuiTest

            assertThat(deviceUnlockStatus!!.isUnlocked).isTrue()

            kosmos.sceneInteractor.changeScene(toScene = Scenes.Gone, loggingReason = "reason")
            kosmos.sceneInteractor.changeScene(
                toScene = Scenes.Lockscreen,
                loggingReason = "reason"
            )
            runCurrent()
            assertThat(currentScene).isEqualTo(Scenes.Gone)
            assertThat(currentScene).isEqualTo(Scenes.Lockscreen)

            // Call start to begin hydrating based on the scene framework:
            underTest.start()
            runCurrent()

            assertThat(statusBarState).isEqualTo(StatusBarState.KEYGUARD)

            kosmos.sceneInteractor.changeScene(toScene = Scenes.Gone, loggingReason = "reason")
            runCurrent()
            assertThat(currentScene).isEqualTo(Scenes.Gone)
            assertThat(statusBarState).isEqualTo(StatusBarState.SHADE)

            kosmos.sceneInteractor.changeScene(toScene = Scenes.Shade, loggingReason = "reason")
            runCurrent()
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ fun SceneStack.asIterable(): Iterable<SceneKey> = Iterable {
    }
}

/** Does this stack contain the given [sceneKey]? O(N) */
fun SceneStack.contains(sceneKey: SceneKey): Boolean = asIterable().any { it == sceneKey }

/**
 * Returns a new [SceneStack] containing the given [scenes], ordered such that the first argument is
 * the head returned from [peek], then the second, and so forth.
+15 −3
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac
import com.android.systemui.keyguard.shared.model.KeyguardState;
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.res.R;
import com.android.systemui.scene.data.model.SceneStack;
import com.android.systemui.scene.data.model.SceneStackKt;
import com.android.systemui.scene.domain.interactor.SceneBackInteractor;
import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor;
import com.android.systemui.scene.domain.interactor.SceneInteractor;
import com.android.systemui.scene.shared.flag.SceneContainerFlag;
@@ -118,6 +121,7 @@ public class StatusBarStateControllerImpl implements
    private final Lazy<SceneInteractor> mSceneInteractorLazy;
    private final Lazy<SceneContainerOcclusionInteractor> mSceneContainerOcclusionInteractorLazy;
    private final Lazy<KeyguardClockInteractor> mKeyguardClockInteractorLazy;
    private final Lazy<SceneBackInteractor> mSceneBackInteractorLazy;
    private int mState;
    private int mLastState;
    private int mUpcomingState;
@@ -186,7 +190,8 @@ public class StatusBarStateControllerImpl implements
            Lazy<DeviceUnlockedInteractor> deviceUnlockedInteractorLazy,
            Lazy<SceneInteractor> sceneInteractorLazy,
            Lazy<SceneContainerOcclusionInteractor> sceneContainerOcclusionInteractor,
            Lazy<KeyguardClockInteractor> keyguardClockInteractorLazy) {
            Lazy<KeyguardClockInteractor> keyguardClockInteractorLazy,
            Lazy<SceneBackInteractor> sceneBackInteractorLazy) {
        mUiEventLogger = uiEventLogger;
        mInteractionJankMonitorLazy = interactionJankMonitorLazy;
        mJavaAdapter = javaAdapter;
@@ -196,6 +201,7 @@ public class StatusBarStateControllerImpl implements
        mSceneInteractorLazy = sceneInteractorLazy;
        mSceneContainerOcclusionInteractorLazy = sceneContainerOcclusionInteractor;
        mKeyguardClockInteractorLazy = keyguardClockInteractorLazy;
        mSceneBackInteractorLazy = sceneBackInteractorLazy;
        for (int i = 0; i < HISTORY_SIZE; i++) {
            mHistoricalRecords[i] = new HistoricalState();
        }
@@ -221,6 +227,7 @@ public class StatusBarStateControllerImpl implements
                    combineFlows(
                        mDeviceUnlockedInteractorLazy.get().getDeviceUnlockStatus(),
                        mSceneInteractorLazy.get().getCurrentScene(),
                        mSceneBackInteractorLazy.get().getBackStack(),
                        mSceneContainerOcclusionInteractorLazy.get().getInvisibleDueToOcclusion(),
                        this::calculateStateFromSceneFramework),
                    this::onStatusBarStateChanged);
@@ -677,10 +684,15 @@ public class StatusBarStateControllerImpl implements
    private int calculateStateFromSceneFramework(
            DeviceUnlockStatus deviceUnlockStatus,
            SceneKey currentScene,
            SceneStack backStack,
            boolean isOccluded) {
        SceneContainerFlag.isUnexpectedlyInLegacyMode();

        if (deviceUnlockStatus.isUnlocked() || isOccluded) {
        if (currentScene.equals(Scenes.Lockscreen)) {
            return StatusBarState.KEYGUARD;
        } else if (currentScene.equals(Scenes.Shade)
                && SceneStackKt.contains(backStack, Scenes.Lockscreen)) {
            return StatusBarState.SHADE_LOCKED;
        } else if (deviceUnlockStatus.isUnlocked() || isOccluded) {
            return StatusBarState.SHADE;
        } else {
            return Preconditions.checkNotNull(sStatusBarStateByLockedSceneKey.get(currentScene));
+8 −1
Original line number Diff line number Diff line
@@ -1487,7 +1487,14 @@ public class NotificationStackScrollLayout

    private float updateStackEndHeight() {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return 0f;
        float height = Math.max(0f, mAmbientState.getStackCutoff() - mAmbientState.getStackTop());
        final float height;
        if (mMaxDisplayedNotifications != -1) {
            // The stack intrinsic height already contains the correct value when there is a limit
            // in the max number of notifications (e.g. as in keyguard).
            height = mIntrinsicContentHeight;
        } else {
            height = Math.max(0f, mAmbientState.getStackCutoff() - mAmbientState.getStackTop());
        }
        mAmbientState.setStackEndHeight(height);
        return height;
    }
+4 −2
Original line number Diff line number Diff line
@@ -468,7 +468,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                () -> mKosmos.getDeviceUnlockedInteractor(),
                () -> mKosmos.getSceneInteractor(),
                () -> mKosmos.getSceneContainerOcclusionInteractor(),
                () -> mKosmos.getKeyguardClockInteractor());
                () -> mKosmos.getKeyguardClockInteractor(),
                () -> mKosmos.getSceneBackInteractor());

        KeyguardStatusView keyguardStatusView = new KeyguardStatusView(mContext);
        keyguardStatusView.setId(R.id.keyguard_status_view);
@@ -625,7 +626,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                                () -> mKosmos.getDeviceUnlockedInteractor(),
                                () -> mKosmos.getSceneInteractor(),
                                () -> mKosmos.getSceneContainerOcclusionInteractor(),
                                () -> mKosmos.getKeyguardClockInteractor()),
                                () -> mKosmos.getKeyguardClockInteractor(),
                                () -> mKosmos.getSceneBackInteractor()),
                        mKeyguardBypassController,
                        mDozeParameters,
                        mScreenOffAnimationController,
Loading