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

Commit c1d9ab22 authored by Selim Cinek's avatar Selim Cinek
Browse files

Extended the bypass experience

Notifications do not show on the lock screen
anymore and are instead collapsed to icons.
The experience with incoming notifications
is still an open issue.

Bug: 130327302
Test: astest SystemUITests
Change-Id: Iba4fbaaa3ca1e9dd6ccfe22c760f863452d990f3
parent 2c890ee6
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
@@ -117,6 +119,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
@@ -133,6 +138,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() {
@@ -452,7 +452,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) {
+10 −12
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);
@@ -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);
        }

@@ -1435,7 +1435,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;
@@ -3534,7 +3534,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);
@@ -4714,21 +4714,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();
@@ -6349,7 +6347,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