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

Commit d8fecad3 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge changes I703ea278,I2c517d0a into nyc-mr1-dev

* changes:
  Fixed a few bugs regarding big notification groups
  Fixed a bug where the scroller would stop tracking
parents e422b0b2 bc243a96
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -328,7 +328,7 @@ public class NotificationPanelView extends PanelView implements
        } else if (!mQsExpanded) {
            setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
        }
        updateStackHeight(getExpandedHeight());
        updateExpandedHeight(getExpandedHeight());
        updateHeader();

        // If we are running a size change animation, the animation takes care of the height of
@@ -376,10 +376,7 @@ public class NotificationPanelView extends PanelView implements
        boolean animate = mNotificationStackScroller.isAddOrRemoveAnimationPending();
        int stackScrollerPadding;
        if (mStatusBarState != StatusBarState.KEYGUARD) {
            int bottom = mQsContainer.getHeader().getHeight();
            stackScrollerPadding = mStatusBarState == StatusBarState.SHADE
                    ? bottom + mQsPeekHeight
                    : mKeyguardStatusBar.getHeight();
            stackScrollerPadding = mQsContainer.getHeader().getHeight() + mQsPeekHeight;
            mTopPaddingAdjustment = 0;
        } else {
            mClockPositionAlgorithm.setup(
@@ -1166,6 +1163,7 @@ public class NotificationPanelView extends PanelView implements

    private void updateQsState() {
        mQsContainer.setExpanded(mQsExpanded);
        mNotificationStackScroller.setQsExpanded(mQsExpanded);
        mNotificationStackScroller.setScrollingEnabled(
                mStatusBarState != StatusBarState.KEYGUARD && (!mQsExpanded
                        || mQsExpansionFromOverscroll));
@@ -1427,7 +1425,7 @@ public class NotificationPanelView extends PanelView implements
            setQsExpansion(mQsMinExpansionHeight
                    + t * (getTempQsMaxExpansion() - mQsMinExpansionHeight));
        }
        updateStackHeight(expandedHeight);
        updateExpandedHeight(expandedHeight);
        updateHeader();
        updateUnlockIcon();
        updateNotificationTranslucency();
@@ -1487,7 +1485,7 @@ public class NotificationPanelView extends PanelView implements
                maxQsHeight, mStatusBarState == StatusBarState.KEYGUARD
                        ? mClockPositionResult.stackScrollerPadding - mTopPaddingAdjustment
                        : 0)
                + notificationHeight;
                + notificationHeight + mNotificationStackScroller.getTopPaddingOverflow();
        if (totalHeight > mNotificationStackScroller.getHeight()) {
            float fullyCollapsedHeight = maxQsHeight
                    + mNotificationStackScroller.getLayoutMinHeight();
@@ -1730,6 +1728,14 @@ public class NotificationPanelView extends PanelView implements
        if (view == null && mQsExpanded) {
            return;
        }
        ExpandableView firstChildNotGone = mNotificationStackScroller.getFirstChildNotGone();
        ExpandableNotificationRow firstRow = firstChildNotGone instanceof ExpandableNotificationRow
                ? (ExpandableNotificationRow) firstChildNotGone
                : null;
        if (firstRow != null
                && (view == firstRow || (firstRow.getNotificationParent() == firstRow))) {
            requestScrollerTopPaddingUpdate(false);
        }
        requestPanelHeightUpdate();
    }

@@ -2249,8 +2255,8 @@ public class NotificationPanelView extends PanelView implements
        mQsAutoReinflateContainer.setTranslationX(translation);
    }

    protected void updateStackHeight(float stackHeight) {
        mNotificationStackScroller.setStackHeight(stackHeight);
    protected void updateExpandedHeight(float expandedHeight) {
        mNotificationStackScroller.setExpandedHeight(expandedHeight);
        updateKeyguardBottomAreaAlpha();
    }

+6 −5
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public class AmbientState {
    private boolean mShadeExpanded;
    private float mMaxHeadsUpTranslation;
    private boolean mDismissAllInProgress;
    private int mLayoutMinHeight;

    public int getScrollY() {
        return mScrollY;
@@ -137,10 +138,6 @@ public class AmbientState {
        mStackTranslation = stackTranslation;
    }

    public int getLayoutHeight() {
        return mLayoutHeight;
    }

    public void setLayoutHeight(int layoutHeight) {
        mLayoutHeight = layoutHeight;
    }
@@ -154,7 +151,7 @@ public class AmbientState {
    }

    public int getInnerHeight() {
        return mLayoutHeight - mTopPadding;
        return Math.max(mLayoutHeight - mTopPadding, mLayoutMinHeight);
    }

    public boolean isShadeExpanded() {
@@ -180,4 +177,8 @@ public class AmbientState {
    public boolean isDismissAllInProgress() {
        return mDismissAllInProgress;
    }

    public void setLayoutMinHeight(int layoutMinHeight) {
        mLayoutMinHeight = layoutMinHeight;
    }
}
+45 −29
Original line number Diff line number Diff line
@@ -111,11 +111,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    private int mCurrentStackHeight = Integer.MAX_VALUE;
    private final Paint mBackgroundPaint = new Paint();

    /**
     * mCurrentStackHeight is the actual stack height, mLastSetStackHeight is the stack height set
     * externally from {@link #setStackHeight}
     */
    private float mLastSetStackHeight;
    private float mExpandedHeight;
    private int mOwnScrollY;
    private int mMaxLayoutHeight;

@@ -354,6 +350,7 @@ public class NotificationStackScrollLayout extends ViewGroup
                    return object.getBackgroundFadeAmount();
                }
            };
    private boolean mQsExpanded;

    public NotificationStackScrollLayout(Context context) {
        this(context, null);
@@ -519,6 +516,7 @@ public class NotificationStackScrollLayout extends ViewGroup
        clampScrollPosition();
        requestChildrenUpdate();
        updateFirstAndLastBackgroundViews();
        updateAlgorithmLayoutMinHeight();
    }

    private void requestAnimationOnViewResize(ExpandableNotificationRow row) {
@@ -560,9 +558,14 @@ public class NotificationStackScrollLayout extends ViewGroup

    private void updateAlgorithmHeightAndPadding() {
        mAmbientState.setLayoutHeight(getLayoutHeight());
        updateAlgorithmLayoutMinHeight();
        mAmbientState.setTopPadding(mTopPadding);
    }

    private void updateAlgorithmLayoutMinHeight() {
        mAmbientState.setLayoutMinHeight(mQsExpanded && !onKeyguard() ? getLayoutMinHeight() : 0);
    }

    /**
     * Updates the children views according to the stack scroll algorithm. Call this whenever
     * modifications to {@link #mOwnScrollY} are performed to reflect it in the view layout.
@@ -659,19 +662,19 @@ public class NotificationStackScrollLayout extends ViewGroup
    }

    /**
     * Update the height of the stack to a new height.
     * Update the height of the panel.
     *
     * @param height the new height of the stack
     * @param height the expanded height of the panel
     */
    public void setStackHeight(float height) {
        mLastSetStackHeight = height;
    public void setExpandedHeight(float height) {
        mExpandedHeight = height;
        setIsExpanded(height > 0.0f);
        int stackHeight;
        float translationY;
        float appearEndPosition = getAppearEndPosition();
        float appearStartPosition = getAppearStartPosition();
        if (height >= appearEndPosition) {
            translationY = mTopPaddingOverflow;
            translationY = 0;
            stackHeight = (int) height;
        } else {
            float appearFraction = getAppearFraction(height);
@@ -698,8 +701,12 @@ public class NotificationStackScrollLayout extends ViewGroup
     *         Measured relative to the resting position.
     */
    private float getExpandTranslationStart() {
        int startPosition = mTrackingHeadsUp || mHeadsUpManager.hasPinnedHeadsUp()
                ? 0 : -getFirstChildIntrinsicHeight();
        int startPosition = 0;
        if (!mTrackingHeadsUp && !mHeadsUpManager.hasPinnedHeadsUp()) {
            startPosition = - Math.min(getFirstChildIntrinsicHeight(),
                    mMaxLayoutHeight - mIntrinsicPadding - mBottomStackSlowDownHeight
                            - mBottomStackPeekSize);
        }
        return startPosition - mTopPadding;
    }

@@ -722,7 +729,7 @@ public class NotificationStackScrollLayout extends ViewGroup
                ? mHeadsUpManager.getTopHeadsUpPinnedHeight() + mBottomStackPeekSize
                        + mBottomStackSlowDownHeight
                : getLayoutMinHeight();
        return firstItemHeight + mTopPadding + mTopPaddingOverflow;
        return firstItemHeight + (onKeyguard() ? mTopPadding : mIntrinsicPadding);
    }

    /**
@@ -1152,6 +1159,10 @@ public class NotificationStackScrollLayout extends ViewGroup

    @Override
    public boolean isAntiFalsingNeeded() {
        return onKeyguard();
    }

    private boolean onKeyguard() {
        return mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD;
    }

@@ -1228,7 +1239,7 @@ public class NotificationStackScrollLayout extends ViewGroup
        if (!isScrollingEnabled()) {
            return false;
        }
        if (ev.getY() < mQsContainer.getBottom()) {
        if (ev.getY() < mQsContainer.getBottom() && !mIsBeingDragged) {
            return false;
        }
        mForcedScroll = null;
@@ -2122,26 +2133,22 @@ public class NotificationStackScrollLayout extends ViewGroup
     */
    public void updateTopPadding(float qsHeight, boolean animate,
            boolean ignoreIntrinsicPadding) {
        float start = qsHeight;
        float stackHeight = getHeight() - start;
        int topPadding = (int) qsHeight;
        int minStackHeight = getLayoutMinHeight();
        if (stackHeight <= minStackHeight) {
            float overflow = minStackHeight - stackHeight;
            stackHeight = minStackHeight;
            start = getHeight() - stackHeight;
            mTopPaddingOverflow = overflow;
        if (topPadding + minStackHeight > getHeight()) {
            mTopPaddingOverflow = topPadding + minStackHeight - getHeight();
        } else {
            mTopPaddingOverflow = 0;
        }
        setTopPadding(ignoreIntrinsicPadding ? (int) start : clampPadding((int) start),
        setTopPadding(ignoreIntrinsicPadding ? topPadding : clampPadding(topPadding),
                animate);
        setStackHeight(mLastSetStackHeight);
        setExpandedHeight(mExpandedHeight);
    }

    public int getLayoutMinHeight() {
        int firstChildMinHeight = getFirstChildIntrinsicHeight();
        return Math.min(firstChildMinHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight,
                mMaxLayoutHeight - mTopPadding);
                mMaxLayoutHeight - mIntrinsicPadding);
    }

    public int getFirstChildIntrinsicHeight() {
@@ -3088,10 +3095,14 @@ public class NotificationStackScrollLayout extends ViewGroup
        updateScrollPositionOnExpandInBottom(view);
        clampScrollPosition();
        notifyHeightChangeListener(view);
        if (needsAnimation) {
        ExpandableNotificationRow row = view instanceof ExpandableNotificationRow
                ? (ExpandableNotificationRow) view
                : null;
        if (row != null && (row == mFirstVisibleBackgroundChild
                || row.getNotificationParent() == mFirstVisibleBackgroundChild)) {
            updateAlgorithmLayoutMinHeight();
        }
        if (needsAnimation) {
            requestAnimationOnViewResize(row);
        }
        requestChildrenUpdate();
@@ -3374,7 +3385,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    }

    private int findDarkAnimationOriginIndex(@Nullable PointF screenLocation) {
        if (screenLocation == null || screenLocation.y < mTopPadding + mTopPaddingOverflow) {
        if (screenLocation == null || screenLocation.y < mTopPadding) {
            return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
        }
        if (screenLocation.y > getBottomMostNotificationBottom()) {
@@ -3858,6 +3869,11 @@ public class NotificationStackScrollLayout extends ViewGroup
        mCurrentStackScrollState.removeViewStateForView(view);
    }

    public void setQsExpanded(boolean qsExpanded) {
        mQsExpanded = qsExpanded;
        updateAlgorithmLayoutMinHeight();
    }

    /**
     * A listener that is notified when some child locations might have changed.
     */
@@ -4081,7 +4097,7 @@ public class NotificationStackScrollLayout extends ViewGroup
            onDragCancelled(animView);

            // If we're on the lockscreen we want to false this.
            if (mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD) {
            if (isAntiFalsingNeeded()) {
                mHandler.removeCallbacks(mFalsingCheck);
                mHandler.postDelayed(mFalsingCheck, COVER_GEAR_DELAY);
            }