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

Commit f0a490ee authored by Nicolò Mazzucato's avatar Nicolò Mazzucato Committed by Nicolo' Mazzucato
Browse files

Don't animate NSSL background bounds on display change

This will prevent the NSSL bounds to be animated when the display id changes, as in that case we don't want to see any animation

Bug: 438436158
Test: expand shade on external display while internal had single and external dual -> observe no animation
Flag: com.android.systemui.shade_window_goes_around
Change-Id: I20f858318840dca387748f66271af0024bd78ee6
parent 4c0b540f
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ import com.android.systemui.qs.ui.composable.QuickSettingsShade.systemGestureExc
import com.android.systemui.qs.ui.composable.QuickSettingsTheme
import com.android.systemui.res.R
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener
import com.android.systemui.util.LifecycleFragment
@@ -660,9 +661,21 @@ constructor(
        lifecycleScope.launch {
            lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
                var lastQqsHeight = -1
                var lastQqsMediaVisible: Boolean? = null
                this@QSFragmentCompose.view?.setSnapshotBinding {
                    scrollListener.value?.onQsPanelScrollChanged(scrollState.value)
                    collapsedMediaVisibilityChangedListener.value?.accept(viewModel.qqsMediaVisible)
                    if (ShadeWindowGoesAround.isEnabled) {
                        if (lastQqsMediaVisible != viewModel.qqsMediaVisible) {
                            lastQqsMediaVisible = viewModel.qqsMediaVisible
                            collapsedMediaVisibilityChangedListener.value?.accept(
                                viewModel.qqsMediaVisible
                            )
                        }
                    } else {
                        collapsedMediaVisibilityChangedListener.value?.accept(
                            viewModel.qqsMediaVisible
                        )
                    }
                    if (lastQqsHeight != viewModel.qqsHeight) {
                        lastQqsHeight = viewModel.qqsHeight
                        qqsHeightListener.value?.onQqsHeightChanged()
+20 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.graphics.Region;
import android.util.IndentingPrintWriter;
import android.util.Log;
import android.util.MathUtils;
import android.view.Display;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;
@@ -80,6 +81,7 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.screenrecord.ScreenRecordUxController;
import com.android.systemui.shade.data.repository.ShadeRepository;
import com.android.systemui.shade.domain.interactor.ShadeInteractor;
import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
@@ -2215,6 +2217,8 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum
    /** */
    public final class QsFragmentListener implements FragmentHostManager.FragmentListener {

        private int mLastDisplayIdWithMediaVisibilityChange = Display.DEFAULT_DISPLAY;

        /** */
        @Override
        public void onFragmentViewCreated(String tag, Fragment fragment) {
@@ -2243,10 +2247,21 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum
                    mLastMediaVisibility = visible;
                    mPanelViewControllerLazy.get().positionClockAndNotifications();
                }
                if (mQs.isHeaderShown()) {
                boolean shouldSkipAnimation = false;

                if (ShadeWindowGoesAround.isEnabled() && mLastDisplayIdWithMediaVisibilityChange
                        != getDisplayId()) {
                    // Let's not animate the bounds if the visibility change is due to the
                    // display being changed, otherwise we'll see some animation after the
                    // shade changes display.
                    shouldSkipAnimation = true;
                    mLastDisplayIdWithMediaVisibilityChange = getDisplayId();
                }
                if (mQs.isHeaderShown() && !shouldSkipAnimation) {
                    setAnimateNextNotificationBounds(
                            StackStateAnimator.ANIMATION_DURATION_STANDARD, 0);
                    mNotificationStackScrollLayoutController.animateNextTopPaddingChange();

                }
            });
            mLockscreenShadeTransitionController.setQS(mQs);
@@ -2268,6 +2283,10 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum
            updateExpansion();
        }

        private int getDisplayId() {
            return mPanelView.getContext().getDisplayId();
        }

        /** */
        @Override
        public void onFragmentViewDestroyed(String tag, Fragment fragment) {