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

Commit 355652a6 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixes that notifications were sometimes clipped on the lockscreen

When dragging down a notification into the bottom, the top notification
could become clipped.

Test: add notifications, pull down on last notification on lockscreen
Bug: 32437839
Change-Id: Ibb58d1aa7575fbe9d84b8542ac57ffae494bb127
parent 61190fb7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4558,6 +4558,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mGroupManager.setStatusBarState(state);
        mFalsingManager.setStatusBarState(state);
        mStatusBarWindowManager.setStatusBarState(state);
        mStackScroller.setStatusBarState(state);
        updateReportRejectedTouchVisibility();
        updateDozing();
    }
+10 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.view.View;
import com.android.systemui.R;
import com.android.systemui.statusbar.ActivatableNotificationView;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.HeadsUpManager;

import java.util.ArrayList;
@@ -53,6 +54,7 @@ public class AmbientState {
    private int mMaxLayoutHeight;
    private ActivatableNotificationView mLastVisibleBackgroundChild;
    private float mCurrentScrollVelocity;
    private int mStatusBarState;

    public AmbientState(Context context) {
        reload(context);
@@ -250,4 +252,12 @@ public class AmbientState {
    public float getCurrentScrollVelocity() {
        return mCurrentScrollVelocity;
    }

    public boolean isOnKeyguard() {
        return mStatusBarState == StatusBarState.KEYGUARD;
    }

    public void setStatusBarState(int statusBarState) {
        mStatusBarState = statusBarState;
    }
}
+9 −3
Original line number Diff line number Diff line
@@ -357,6 +357,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    private Rect mRequestedClipBounds;
    private boolean mInHeadsUpPinnedMode;
    private boolean mHeadsUpAnimatingAway;
    private int mStatusBarState;

    public NotificationStackScrollLayout(Context context) {
        this(context, null);
@@ -1187,7 +1188,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    }

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

    private void setSwipingInProgress(boolean isSwiped) {
@@ -2124,7 +2125,7 @@ public class NotificationStackScrollLayout extends ViewGroup
            top = mTopPadding;
            bottom = top;
        }
        if (mPhoneStatusBar.getBarState() != StatusBarState.KEYGUARD) {
        if (mStatusBarState != StatusBarState.KEYGUARD) {
            top = (int) Math.max(mTopPadding + mStackTranslation, top);
        } else {
            // otherwise the animation from the shade to the keyguard will jump as it's maxed
@@ -2358,7 +2359,7 @@ public class NotificationStackScrollLayout extends ViewGroup
                }
                break;
            case MotionEvent.ACTION_UP:
                if (mPhoneStatusBar.getBarState() != StatusBarState.KEYGUARD && mTouchIsClick &&
                if (mStatusBarState != StatusBarState.KEYGUARD && mTouchIsClick &&
                        isBelowLastNotification(mInitialTouchX, mInitialTouchY)) {
                    mOnEmptySpaceClickListener.onEmptySpaceClicked(mInitialTouchX, mInitialTouchY);
                }
@@ -3981,6 +3982,11 @@ public class NotificationStackScrollLayout extends ViewGroup
        updateClipping();
    }

    public void setStatusBarState(int statusBarState) {
        mStatusBarState = statusBarState;
        mAmbientState.setStatusBarState(statusBarState);
    }

    /**
     * A listener that is notified when some child locations might have changed.
     */
+2 −1
Original line number Diff line number Diff line
@@ -124,7 +124,8 @@ public class StackScrollAlgorithm {

    private void updateClipping(StackScrollState resultState,
            StackScrollAlgorithmState algorithmState, AmbientState ambientState) {
        float drawStart = ambientState.getTopPadding() + ambientState.getStackTranslation();
        float drawStart = !ambientState.isOnKeyguard() ? ambientState.getTopPadding()
                + ambientState.getStackTranslation() : 0;
        float previousNotificationEnd = 0;
        float previousNotificationStart = 0;
        int childCount = algorithmState.visibleChildren.size();