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

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

Merge changes I60669089,Iba4fbaaa into qt-r1-dev

* changes:
  Fixed the maxPanelheight on the lockscreen
  Extended the bypass experience
parents 3764b3b2 db6d6df8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -453,7 +453,7 @@ public class NotificationShelf extends ActivatableNotificationView implements

    private void updateContinuousClipping(final ExpandableNotificationRow row) {
        StatusBarIconView icon = row.getEntry().expandedIcon;
        boolean needsContinuousClipping = ViewState.isAnimatingY(icon) && !mAmbientState.isDark();
        boolean needsContinuousClipping = ViewState.isAnimatingY(icon) && !mAmbientState.isDozing();
        boolean isContinuousClipping = icon.getTag(TAG_CONTINUOUS_CLIPPING) != null;
        if (needsContinuousClipping && !isContinuousClipping) {
            final ViewTreeObserver observer = icon.getViewTreeObserver();
@@ -829,7 +829,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
    private void setOpenedAmount(float openedAmount) {
        mNoAnimationsInThisFrame = openedAmount == 1.0f && mOpenedAmount == 0.0f;
        mOpenedAmount = openedAmount;
        if (!mAmbientState.isPanelFullWidth() || mAmbientState.isDark()) {
        if (!mAmbientState.isPanelFullWidth() || mAmbientState.isDozing()) {
            // We don't do a transformation at all, lets just assume we are fully opened
            openedAmount = 1.0f;
        }
+28 −2
Original line number Diff line number Diff line
@@ -22,11 +22,12 @@ import android.util.FloatProperty
import com.android.systemui.Interpolators
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.statusbar.AmbientPulseManager
import com.android.systemui.statusbar.SysuiStatusBarStateController
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.notification.stack.StackStateAnimator
import com.android.systemui.statusbar.phone.DozeParameters
import com.android.systemui.statusbar.phone.KeyguardBypassController

import javax.inject.Inject
import javax.inject.Singleton
@@ -35,7 +36,8 @@ import javax.inject.Singleton
class NotificationWakeUpCoordinator @Inject constructor(
        private val mContext: Context,
        private val mAmbientPulseManager: AmbientPulseManager,
        private val mStatusBarStateController: StatusBarStateController)
        private val mStatusBarStateController: StatusBarStateController,
        private val mBypassController: KeyguardBypassController)
    : AmbientPulseManager.OnAmbientChangedListener, StatusBarStateController.StateListener {

    private val mNotificationVisibility
@@ -137,6 +139,9 @@ class NotificationWakeUpCoordinator @Inject constructor(
    }

    override fun onDozeAmountChanged(linear: Float, eased: Float) {
        if (updateDozeAmountIfBypass()) {
            return
        }
        if (linear != 1.0f && linear != 0.0f
                && (mLinearDozeAmount == 0.0f || mLinearDozeAmount == 1.0f)) {
            // Let's notify the scroller that an animation started
@@ -153,6 +158,27 @@ class NotificationWakeUpCoordinator @Inject constructor(
        }
    }

    override fun onStateChanged(newState: Int) {
        updateDozeAmountIfBypass();
    }

    private fun updateDozeAmountIfBypass(): Boolean {
        if (mBypassController.bypassEnabled) {
            if (mStatusBarStateController.state == StatusBarState.SHADE
                    || mStatusBarStateController.state == StatusBarState.SHADE_LOCKED) {
                mDozeAmount = 0.0f
                mLinearDozeAmount = 0.0f
            } else {
                mDozeAmount = 1.0f
                mLinearDozeAmount = 1.0f
            }
            updateDarkAmount()
            mStackScroller.setDozeAmount(mDozeAmount)
            return true
        }
        return false
    }

    private fun startVisibilityAnimation(increaseSpeed: Boolean) {
        if (mNotificationVisibleAmount == 0f || mNotificationVisibleAmount == 1f) {
            mVisibilityInterpolator = if (mNotificationsVisible)
+6 −6
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public class AmbientState {
    private float mOverScrollTopAmount;
    private float mOverScrollBottomAmount;
    private int mSpeedBumpIndex = -1;
    private boolean mDark;
    private boolean mDozing;
    private boolean mHideSensitive;
    private AmbientPulseManager mAmbientPulseManager = Dependency.get(AmbientPulseManager.class);
    private float mStackTranslation;
@@ -181,8 +181,8 @@ public class AmbientState {
    }

    /** In dark mode, we draw as little as possible, assuming a black background */
    public void setDark(boolean dark) {
        mDark = dark;
    public void setDozing(boolean dozing) {
        mDozing = dozing;
    }

    /** Dark ratio of the status bar **/
@@ -215,8 +215,8 @@ public class AmbientState {
        return mDimmed;
    }

    public boolean isDark() {
        return mDark;
    public boolean isDozing() {
        return mDozing;
    }

    public boolean isHideSensitive() {
@@ -459,7 +459,7 @@ public class AmbientState {
     * @return whether a row is dozing and not pulsing right now
     */
    public boolean isDozingAndNotPulsing(ExpandableNotificationRow row) {
        return isDark() && !isPulsing(row.getEntry());
        return isDozing() && !isPulsing(row.getEntry());
    }

    public void setExpandAnimationTopChange(int expandAnimationTopChange) {
+16 −20
Original line number Diff line number Diff line
@@ -770,7 +770,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        if (mShouldDrawNotificationBackground
                && (mSections[0].getCurrentBounds().top
                < mSections[NUM_SECTIONS - 1].getCurrentBounds().bottom
                || mAmbientState.isDark())) {
                || mAmbientState.isDozing())) {
            drawBackground(canvas);
        } else if (mInHeadsUpPinnedMode || mHeadsUpAnimatingAway) {
            drawHeadsUpBackground(canvas);
@@ -804,7 +804,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                canvas.drawLine(0, y, getWidth(), y, mDebugPaint);
            }
            canvas.drawText(Integer.toString(getMaxNegativeScrollAmount()), getWidth() - 100,
                    getIntrinsicPadding() + 30, mDebugPaint);
                    getTopPadding() + 30, mDebugPaint);
            canvas.drawText(Integer.toString(getMaxPositiveScrollAmount()), getWidth() - 100,
                    getHeight() - 30, mDebugPaint);
        }
@@ -842,7 +842,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                break;
            }
        }
        if (!mAmbientState.isDark() || anySectionHasVisibleChild) {
        if (!mAmbientState.isDozing() || anySectionHasVisibleChild) {
            drawBackgroundRects(canvas, left, right, top, backgroundTopAnimationOffset);
        }

@@ -1438,7 +1438,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        int notGoneChildCount = getNotGoneChildCount();
        if (mEmptyShadeView.getVisibility() == GONE && notGoneChildCount != 0) {
            if (isHeadsUpTransition()
                    || (mHeadsUpManager.hasPinnedHeadsUp() && !mAmbientState.isDark())) {
                    || (mHeadsUpManager.hasPinnedHeadsUp() && !mAmbientState.isDozing())) {
                appearPosition = getTopHeadsUpPinnedHeight();
            } else {
                appearPosition = 0;
@@ -2403,7 +2403,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        }
        mIntrinsicContentHeight = height;

        mContentHeight = height + mTopPadding + mBottomMargin;
        // The topPadding can be bigger than the regular padding when qs is expanded, in that
        // state the maxPanelHeight and the contentHeight should be bigger
        mContentHeight = height + Math.max(mIntrinsicPadding, mTopPadding) + mBottomMargin;
        updateScrollability();
        clampScrollPosition();
        mAmbientState.setLayoutMaxHeight(mContentHeight);
@@ -2783,12 +2785,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
     *
     * @param qsHeight               the top padding imposed by the quick settings panel
     * @param animate                whether to animate the change
     * @param ignoreIntrinsicPadding if true, {@link #getIntrinsicPadding()} is ignored and
     *                               {@code qsHeight} is the final top padding
     */
    @ShadeViewRefactor(RefactorComponent.COORDINATOR)
    public void updateTopPadding(float qsHeight, boolean animate,
            boolean ignoreIntrinsicPadding) {
    public void updateTopPadding(float qsHeight, boolean animate) {
        int topPadding = (int) qsHeight;
        int minStackHeight = getLayoutMinHeight();
        if (topPadding + minStackHeight > getHeight()) {
@@ -2796,8 +2795,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        } else {
            mTopPaddingOverflow = 0;
        }
        setTopPadding(ignoreIntrinsicPadding ? topPadding : clampPadding(topPadding),
                animate);
        setTopPadding(topPadding, animate);
        setExpandedHeight(mExpandedHeight);
    }

@@ -3532,7 +3530,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    private void generateTopPaddingEvent() {
        if (mTopPaddingNeedsAnimation) {
            AnimationEvent event;
            if (mAmbientState.isDark()) {
            if (mAmbientState.isDozing()) {
                event = new AnimationEvent(null /* view */,
                        AnimationEvent.ANIMATION_TYPE_TOP_PADDING_CHANGED,
                        KeyguardSliceView.DEFAULT_ANIM_DURATION);
@@ -4712,21 +4710,19 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    }

    /**
     * See {@link AmbientState#setDark}.
     * See {@link AmbientState#setDozing}.
     */
    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    public void setDark(boolean dark, boolean animate, @Nullable PointF touchWakeUpScreenLocation) {
        if (mAmbientState.isDark() == dark) {
    public void setDozing(boolean dozing, boolean animate,
            @Nullable PointF touchWakeUpScreenLocation) {
        if (mAmbientState.isDozing() == dozing) {
            return;
        }
        mAmbientState.setDark(dark);
        mAmbientState.setDozing(dozing);
        if (animate && mAnimationsEnabled) {
            mDarkNeedsAnimation = true;
            mDarkAnimationOriginIndex = findDarkAnimationOriginIndex(touchWakeUpScreenLocation);
            mNeedsAnimation = true;
        } else {
            setDarkAmount(dark ? 1f : 0f);
            updateBackground();
        }
        requestChildrenUpdate();
        updateWillNotDraw();
@@ -6348,7 +6344,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                        (int) (dragLengthY / mDisplayMetrics.density),
                        0 /* velocityDp - N/A */);

                if (!mAmbientState.isDark() || startingChild != null) {
                if (!mAmbientState.isDozing() || startingChild != null) {
                    // We have notifications, go to locked shade.
                    mShadeController.goToLockedShade(startingChild);
                    if (startingChild instanceof ExpandableNotificationRow) {
+1 −1
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ public class StackScrollAlgorithm {
        state.paddingMap.clear();
        int notGoneIndex = 0;
        ExpandableView lastView = null;
        int firstHiddenIndex = ambientState.isDark()
        int firstHiddenIndex = ambientState.isDozing()
                ? (ambientState.hasPulsingNotifications() ? 1 : 0)
                : childCount;

Loading