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

Commit 0fef57d7 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

[flexiglass] Rename NotificationStackView to NotificationScrollView

Bug: 296118689
Test: atest SystemUITests
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Change-Id: Ib281ca28e70b0cc81c7873ded3d88b2b7c245661
parent 66112141
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import com.android.systemui.scene.shared.model.fakeSceneDataSource
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape
import com.android.systemui.statusbar.notification.stack.shared.model.ViewPosition
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.notificationStackAppearanceViewModel
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.notificationScrollViewModel
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.notificationsPlaceholderViewModel
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
@@ -59,7 +59,7 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() {
        }
    private val testScope = kosmos.testScope
    private val placeholderViewModel by lazy { kosmos.notificationsPlaceholderViewModel }
    private val appearanceViewModel by lazy { kosmos.notificationStackAppearanceViewModel }
    private val appearanceViewModel by lazy { kosmos.notificationScrollViewModel }
    private val sceneInteractor by lazy { kosmos.sceneInteractor }
    private val fakeSceneDataSource by lazy { kosmos.fakeSceneDataSource }

+3 −3
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ import com.android.systemui.settings.UserTracker
import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.statusbar.NotificationInsetsController
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.notification.stack.ui.view.NotificationStackView
import com.android.systemui.statusbar.notification.stack.ui.view.NotificationScrollView
import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
import com.android.systemui.statusbar.phone.KeyguardBottomAreaView
import com.android.systemui.statusbar.phone.StatusBarLocation
@@ -65,9 +65,9 @@ abstract class ShadeViewProviderModule {
    @Binds
    @SysUISingleton
    // TODO(b/277762009): Only allow this view's binder to inject the view.
    abstract fun bindsNotificationStackView(
    abstract fun bindsNotificationScrollView(
        notificationStackScrollLayout: NotificationStackScrollLayout
    ): NotificationStackView
    ): NotificationScrollView

    companion object {
        const val SHADE_HEADER = "large_screen_shade_header"
+17 −21
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ import com.android.systemui.statusbar.notification.shared.NotificationsImprovedH
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor;
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds;
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape;
import com.android.systemui.statusbar.notification.stack.ui.view.NotificationStackView;
import com.android.systemui.statusbar.notification.stack.ui.view.NotificationScrollView;
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
import com.android.systemui.statusbar.phone.ScreenOffAnimationController;
@@ -149,7 +149,7 @@ import java.util.function.Consumer;
 */
public class NotificationStackScrollLayout
        extends ViewGroup
        implements Dumpable, NotificationStackView {
        implements Dumpable, NotificationScrollView {

    public static final float BACKGROUND_ALPHA_DIMMED = 0.7f;
    private static final String TAG = "StackScroller";
@@ -224,7 +224,7 @@ public class NotificationStackScrollLayout
     */
    private final StackScrollAlgorithm mStackScrollAlgorithm;
    private final AmbientState mAmbientState;
    private final StackViewFields mStackViewFields = new StackViewFields();
    private final ScrollViewFields mScrollViewFields = new ScrollViewFields();

    private final GroupMembershipManager mGroupMembershipManager;
    private final GroupExpansionManager mGroupExpansionManager;
@@ -515,9 +515,6 @@ public class NotificationStackScrollLayout
    private int mRoundedRectClippingRight;
    private final float[] mBgCornerRadii = new float[8];

    /** Shape used for defining the shade scrim with SceneContainerFlag enabled */
    private ShadeScrimShape mShadeScrimShape = null;

    /**
     * Whether stackY should be animated in case the view is getting shorter than the scroll
     * position and this scrolling will lead to the top scroll inset getting smaller.
@@ -599,7 +596,7 @@ public class NotificationStackScrollLayout
        @Override
        public boolean isScrolledToTop() {
            if (SceneContainerFlag.isEnabled()) {
                return mStackViewFields.isScrolledToTop();
                return mScrollViewFields.isScrolledToTop();
            } else {
                return mOwnScrollY == 0;
            }
@@ -1148,39 +1145,39 @@ public class NotificationStackScrollLayout

    @Override
    public void setScrolledToTop(boolean scrolledToTop) {
        mStackViewFields.setScrolledToTop(scrolledToTop);
        mScrollViewFields.setScrolledToTop(scrolledToTop);
    }

    @Override
    public void setStackTop(float stackTop) {
        mStackViewFields.setStackTop(stackTop);
        mScrollViewFields.setStackTop(stackTop);
        // TODO(b/332574413): replace the following with using stackTop
        updateTopPadding(stackTop, isAddOrRemoveAnimationPending());
    }

    @Override
    public void setStackBottom(float stackBottom) {
        mStackViewFields.setStackBottom(stackBottom);
        mScrollViewFields.setStackBottom(stackBottom);
    }

    @Override
    public void setHeadsUpTop(float headsUpTop) {
        mStackViewFields.setHeadsUpTop(headsUpTop);
        mScrollViewFields.setHeadsUpTop(headsUpTop);
    }

    @Override
    public void setSyntheticScrollConsumer(@Nullable Consumer<Float> consumer) {
        mStackViewFields.setSyntheticScrollConsumer(consumer);
        mScrollViewFields.setSyntheticScrollConsumer(consumer);
    }

    @Override
    public void setStackHeightConsumer(@Nullable Consumer<Float> consumer) {
        mStackViewFields.setStackHeightConsumer(consumer);
        mScrollViewFields.setStackHeightConsumer(consumer);
    }

    @Override
    public void setHeadsUpHeightConsumer(@Nullable Consumer<Float> consumer) {
        mStackViewFields.setHeadsUpHeightConsumer(consumer);
        mScrollViewFields.setHeadsUpHeightConsumer(consumer);
    }

    /**
@@ -2392,7 +2389,7 @@ public class NotificationStackScrollLayout
                        /* notificationStackScrollLayout= */ this, mMaxDisplayedNotifications,
                        shelfIntrinsicHeight);
        mIntrinsicContentHeight = height;
        mStackViewFields.sendStackHeight(height);
        mScrollViewFields.sendStackHeight(height);

        // The topPadding can be bigger than the regular padding when qs is expanded, in that
        // state the maxPanelHeight and the contentHeight should be bigger
@@ -3631,7 +3628,7 @@ public class NotificationStackScrollLayout

    protected boolean isInsideQsHeader(MotionEvent ev) {
        if (SceneContainerFlag.isEnabled()) {
            return ev.getY() < mStackViewFields.getShadeScrimClipping().getBounds().getTop();
            return ev.getY() < mScrollViewFields.getScrimClippingShape().getBounds().getTop();
        }

        mQsHeader.getBoundsOnScreen(mQsHeaderBound);
@@ -4164,7 +4161,7 @@ public class NotificationStackScrollLayout
                    // to it so that it can scroll the stack and scrim accordingly.
                    if (SceneContainerFlag.isEnabled()) {
                        float diff = endPosition - layoutEnd;
                        mStackViewFields.sendSyntheticScroll(diff);
                        mScrollViewFields.sendSyntheticScroll(diff);
                    }
                    setOwnScrollY((int) (mOwnScrollY + endPosition - layoutEnd));
                    mDisallowScrollingInThisMotion = true;
@@ -5026,7 +5023,6 @@ public class NotificationStackScrollLayout
            println(pw, "topPadding", getTopPadding());
            println(pw, "bottomPadding", mBottomPadding);
            dumpRoundedRectClipping(pw);
            println(pw, "shadeScrimShape", mShadeScrimShape);
            println(pw, "requestedClipBounds", mRequestedClipBounds);
            println(pw, "isClipped", mIsClipped);
            println(pw, "translationX", getTranslationX());
@@ -5048,7 +5044,7 @@ public class NotificationStackScrollLayout
                    elapsedRealtime - mLastUpdateSidePaddingElapsedRealtime);
            println(pw, "isSmallLandscapeLockscreenEnabled", mIsSmallLandscapeLockscreenEnabled);
            mNotificationStackSizeCalculator.dump(pw, args);
            mStackViewFields.dump(pw);
            mScrollViewFields.dump(pw);
        });
        pw.println();
        pw.println("Contents:");
@@ -5592,8 +5588,8 @@ public class NotificationStackScrollLayout
    @Override
    public void setScrimClippingShape(@Nullable ShadeScrimShape shape) {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;
        if (Objects.equals(mShadeScrimShape, shape)) return;
        mShadeScrimShape = shape;
        if (Objects.equals(mScrollViewFields.getScrimClippingShape(), shape)) return;
        mScrollViewFields.setScrimClippingShape(shape);
        mShouldUseRoundedRectClipping = shape != null;
        mRoundedClipPath.reset();
        if (shape != null) {
+5 −5
Original line number Diff line number Diff line
@@ -17,21 +17,21 @@
package com.android.systemui.statusbar.notification.stack

import android.util.IndentingPrintWriter
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimClipping
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape
import com.android.systemui.util.printSection
import com.android.systemui.util.println
import java.util.function.Consumer

/**
 * This is a state holder object used by [NSSL][NotificationStackScrollLayout] to contain states
 * provided by the `NotificationStackViewBinder` to the [NotificationStackView]
 * provided by the `NotificationScrollViewBinder` to the `NotificationScrollView`.
 *
 * Unlike AmbientState, no class other than NSSL should ever have access to this class in any way.
 * These fields are effectively NSSL's private fields.
 */
class StackViewFields {
class ScrollViewFields {
    /** Used to produce the clipping path */
    var shadeScrimClipping: ShadeScrimClipping = ShadeScrimClipping()
    var scrimClippingShape: ShadeScrimShape? = null
    /** Y coordinate in view pixels of the top of the notification stack */
    var stackTop: Float = 0f
    /**
@@ -71,7 +71,7 @@ class StackViewFields {

    fun dump(pw: IndentingPrintWriter) {
        pw.printSection("StackViewStates") {
            pw.println("shadeScrimClipping", shadeScrimClipping)
            pw.println("scrimClippingShape", scrimClippingShape)
            pw.println("stackTop", stackTop)
            pw.println("stackBottom", stackBottom)
            pw.println("headsUpTop", headsUpTop)
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import java.util.function.Consumer
 * This view (interface) is the view which scrolls and positions the heads up notification and
 * notification stack, but is otherwise agnostic to the content.
 */
interface NotificationStackView {
interface NotificationScrollView {
    /**
     * Since this is an interface rather than a literal View, this provides cast-like access to the
     * underlying view.
Loading