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

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

Merge changes I1f223159,I3ba88d2b into main

* changes:
  [Flexiglass] Allow to increase Notif height with drag-to-expand on the LS
  [Flexiglass] Wire in LockScreenShadeTransitionController
parents ff168d7a 70057436
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.power.domain.interactor.PowerInteractor;
import com.android.systemui.scene.ui.view.WindowRootView;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener;
@@ -149,6 +150,7 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
    @Mock private NotifCollection mNotifCollection;
    @Mock private UiEventLogger mUiEventLogger;
    @Mock private LockscreenShadeTransitionController mLockscreenShadeTransitionController;
    @Mock private DragDownHelper mDragDownHelper;
    @Mock private VisibilityLocationProviderDelegator mVisibilityLocationProviderDelegator;
    @Mock private ShadeController mShadeController;
    @Mock private Provider<WindowRootView> mWindowRootView;
@@ -771,6 +773,7 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
        when(mNotificationStackScrollLayout.getContext()).thenReturn(getContext());
        when(mNotificationStackScrollLayout.getHeadsUpCallback()).thenReturn(mHeadsUpCallback);
        when(mHeadsUpCallback.getContext()).thenReturn(getContext());
        when(mLockscreenShadeTransitionController.getTouchHelper()).thenReturn(mDragDownHelper);
        mController = new NotificationStackScrollLayoutController(
                mNotificationStackScrollLayout,
                true,
+30 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.view.View.VISIBLE
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.kosmos.testScope
import com.android.systemui.media.controls.domain.pipeline.MediaDataManager
import com.android.systemui.res.R
@@ -382,6 +383,35 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() {
        assertThat(space.whenSavingSpace).isEqualTo(5)
    }

    @Test
    @EnableSceneContainer
    fun getSpaceNeeded_onLockscreenAndUserLocked_intrinsicHeight() {
        // GIVEN: No divider height since we're testing one element where index = 0
        setGapHeight(0f)

        // AND: the row has its max height
        val expandableView = createMockRow(rowHeight)

        // AND: the user is dragging down on the Notification
        whenever(expandableView.isUserLocked).thenReturn(true)

        // AND: the row has a smaller min height, that we won't use here
        whenever(expandableView.getMinHeight(any())).thenReturn(1)

        // WHEN: we calculate the space for the Lockscreen
        val space =
            sizeCalculator.getSpaceNeeded(
                expandableView,
                visibleIndex = 0,
                previousView = null,
                stack = stackLayout,
                onLockscreen = true,
            )

        // THEN: the row gets its unrestricted height (if there's enough space)
        assertThat(space.whenEnoughSpace).isEqualTo(rowHeight)
    }

    @Test
    fun getSpaceNeeded_notOnLockscreen_intrinsicHeight() {
        setGapHeight(0f)
+6 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.plugins.qs.QS
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.qs.ui.adapter.QSSceneAdapter
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.shade.data.repository.ShadeRepository
import com.android.systemui.shade.domain.interactor.ShadeInteractor
@@ -412,7 +413,11 @@ constructor(
        set(value) {
            if (field != value || forceApplyAmount) {
                field = value
                if (!nsslController.isInLockedDownShade() || field == 0f || forceApplyAmount) {
                if (SceneContainerFlag.isEnabled) {
                    // TODO(b/359957196) do we need to do anything here?
                } else if (
                    !nsslController.isInLockedDownShade() || field == 0f || forceApplyAmount
                ) {
                    fractionToShade =
                        MathUtils.saturate(dragDownAmount / notificationShelfTransitionDistance)
                    shadeRepository.setLockscreenShadeExpansion(fractionToShade)
+25 −2
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeDisplayAware;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener;
@@ -2093,6 +2094,11 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    && !mView.isExpandingNotification() && !skipForDragging) {
                scrollWantsIt = mView.onInterceptTouchEventScroll(ev);
            }
            boolean lockscreenExpandWantsIt = false;
            if (shouldLockscreenExpandHandleTouch()) {
                lockscreenExpandWantsIt =
                        getLockscreenExpandTouchHelper().onInterceptTouchEvent(ev);
            }
            boolean hunWantsIt = false;
            if (shouldHeadsUpHandleTouch()) {
                hunWantsIt = mHeadsUpTouchHelper.onInterceptTouchEvent(ev);
@@ -2127,7 +2133,8 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    && ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
                mJankMonitor.begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING);
            }
            return swipeWantsIt || scrollWantsIt || expandWantsIt || longPressWantsIt || hunWantsIt;
            return swipeWantsIt || scrollWantsIt || expandWantsIt || longPressWantsIt || hunWantsIt
                    || lockscreenExpandWantsIt;
        }

        @Override
@@ -2178,6 +2185,11 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    && !expandingNotification && !mView.getDisallowScrollingInThisMotion()) {
                scrollerWantsIt = mView.onScrollTouch(ev);
            }
            boolean lockscreenExpandWantsIt = false;
            if (shouldLockscreenExpandHandleTouch()) {
                lockscreenExpandWantsIt =
                        getLockscreenExpandTouchHelper().onTouchEvent(ev);
            }
            boolean hunWantsIt = false;
            if (shouldHeadsUpHandleTouch()) {
                hunWantsIt = mHeadsUpTouchHelper.onTouchEvent(ev);
@@ -2208,9 +2220,15 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                traceJankOnTouchEvent(ev.getActionMasked(), scrollerWantsIt);
            }
            return horizontalSwipeWantsIt || scrollerWantsIt || expandWantsIt || longPressWantsIt
                    || hunWantsIt;
                    || hunWantsIt || lockscreenExpandWantsIt;
        }

        @NonNull
        private DragDownHelper getLockscreenExpandTouchHelper() {
            return mLockscreenShadeTransitionController.getTouchHelper();
        }


        private void traceJankOnTouchEvent(int action, boolean scrollerWantsIt) {
            if (mJankMonitor == null) {
                Log.w(TAG, "traceJankOnTouchEvent, mJankMonitor is null");
@@ -2236,6 +2254,11 @@ public class NotificationStackScrollLayoutController implements Dumpable {
            }
        }

        private boolean shouldLockscreenExpandHandleTouch() {
            return SceneContainerFlag.isEnabled() && mLongPressedView == null
                    && !mSwipeHelper.isSwiping();
        }

        private boolean shouldHeadsUpHandleTouch() {
            return SceneContainerFlag.isEnabled() && mLongPressedView == null
                    && !mSwipeHelper.isSwiping();
+5 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.media.controls.domain.pipeline.MediaDataManager
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.statusbar.LockscreenShadeTransitionController
import com.android.systemui.statusbar.StatusBarState.KEYGUARD
@@ -421,6 +422,7 @@ constructor(
                "\tcomputeHeightPerNotificationLimit i=$i notifs=$notifications " +
                    "notifsHeightSavingSpace=$notifsWithCollapsedHun" +
                    " shelfWithSpaceBefore=$shelfWithSpaceBefore" +
                    " isOnLockScreen=$onLockscreen" +
                    " limitLockScreenToOneImportant: $limitLockScreenToOneImportant"
            }
            yield(
@@ -476,7 +478,9 @@ constructor(
            if (onLockscreen) {
                if (
                    view is ExpandableNotificationRow &&
                        (canPeek || view.isPromotedOngoing)
                        (canPeek ||
                            view.isPromotedOngoing ||
                            (SceneContainerFlag.isEnabled && view.isUserLocked))
                ) {
                    height
                } else {