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

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

Made heads up persist through unlocks

The heads up now persists through unlocking.

Bug: 130327302
Test: get Heads up on lockscreen, unlock with face
Change-Id: Ie61d5da33024418f1214e70c414bd643af176e71
parent b2c5dc52
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -37,8 +37,10 @@ import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.ExpandableView
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone
import com.android.systemui.statusbar.phone.KeyguardBypassController
import com.android.systemui.statusbar.phone.ShadeController
import com.android.systemui.statusbar.policy.HeadsUpManager

import javax.inject.Inject
import javax.inject.Singleton
@@ -51,7 +53,8 @@ import kotlin.math.max
class PulseExpansionHandler @Inject
constructor(context: Context,
            private val wakeUpCoordinator: NotificationWakeUpCoordinator,
            private val bypassController: KeyguardBypassController) : Gefingerpoken {
            private val bypassController: KeyguardBypassController,
            private val headsUpManager: HeadsUpManagerPhone) : Gefingerpoken {
    companion object {
        private val RUBBERBAND_FACTOR_STATIC = 0.25f
        private val SPRING_BACK_ANIMATION_LENGTH_MS = 375
@@ -67,11 +70,14 @@ constructor(context: Context,
            val changed = field != value
            field = value
            bypassController.isPulseExpanding = value
            if (changed && !value && !leavingLockscreen) {
            if (changed) {
                headsUpManager.unpinAll(true /* userUnPinned */)
                if (!value && !leavingLockscreen) {
                    bypassController.maybePerformPendingUnlock()
                    pulseExpandAbortListener?.run()
                }
            }
        }
    var leavingLockscreen: Boolean = false
        private set
    private val mTouchSlop: Float
+9 −3
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
    @VisibleForTesting
    final int mExtensionTime;
    private final StatusBarStateController mStatusBarStateController;
    private final KeyguardBypassController mBypassController;
    private View mStatusBarWindowView;
    private NotificationGroupManager mGroupManager;
    private VisualStabilityManager mVisualStabilityManager;
@@ -113,7 +114,8 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,

    @Inject
    public HeadsUpManagerPhone(@NonNull final Context context,
            StatusBarStateController statusBarStateController) {
            StatusBarStateController statusBarStateController,
            KeyguardBypassController bypassController) {
        super(context);
        Resources resources = mContext.getResources();
        mAutoDismissNotificationDecayDozing = resources.getInteger(
@@ -121,6 +123,7 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
        mExtensionTime = resources.getInteger(R.integer.ambient_notification_extension_time);
        mStatusBarStateController = statusBarStateController;
        mStatusBarStateController.addCallback(this);
        mBypassController = bypassController;

        initResources();
    }
@@ -412,8 +415,11 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,

    @Override
    protected boolean shouldHeadsUpBecomePinned(NotificationEntry entry) {
        return mStatusBarState != StatusBarState.KEYGUARD && !mIsExpanded
                || super.shouldHeadsUpBecomePinned(entry);
        boolean pin = mStatusBarState == StatusBarState.SHADE && !mIsExpanded;
        if (mBypassController.getBypassEnabled()) {
            pin |= mStatusBarState == StatusBarState.KEYGUARD;
        }
        return pin || super.shouldHeadsUpBecomePinned(entry);
    }

    @Override
+0 −12
Original line number Diff line number Diff line
@@ -434,18 +434,6 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener, State
        return sbn.isGroup() && !sbn.getNotification().isGroupSummary();
    }

    @Override
    public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) {
    }

    @Override
    public void onHeadsUpPinned(NotificationEntry entry) {
    }

    @Override
    public void onHeadsUpUnPinned(NotificationEntry entry) {
    }

    @Override
    public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
        onAlertStateChanged(entry, isHeadsUp);
+17 −4
Original line number Diff line number Diff line
@@ -356,6 +356,7 @@ public class NotificationPanelView extends PanelView implements
    private Runnable mOnReinflationListener;
    private int mDarkIconSize;
    private int mHeadsUpInset;
    private boolean mHeadsUpPinnedMode;

    @Inject
    public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
@@ -2029,7 +2030,8 @@ public class NotificationPanelView extends PanelView implements
                !mHeadsUpManager.hasPinnedHeadsUp()) {
            alpha = getFadeoutAlpha();
        }
        if (mBarState == StatusBarState.KEYGUARD && !mHintAnimationRunning) {
        if (mBarState == StatusBarState.KEYGUARD && !mHintAnimationRunning
                && !mKeyguardBypassController.getBypassEnabled()) {
            alpha *= mClockPositionResult.clockAlpha;
        }
        mNotificationStackScroller.setAlpha(alpha);
@@ -2750,16 +2752,26 @@ public class NotificationPanelView extends PanelView implements
                    mHeadsUpExistenceChangedRunnable);
        }
        updateGestureExclusionRect();
        mHeadsUpPinnedMode = inPinnedMode;
        updateHeadsUpVisibility();
    }

    public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
        mHeadsUpAnimatingAway = headsUpAnimatingAway;
        mNotificationStackScroller.setHeadsUpAnimatingAway(headsUpAnimatingAway);
        updateHeadsUpVisibility();
    }

    private void updateHeadsUpVisibility() {
        ((PhoneStatusBarView) mBar).setHeadsUpVisible(mHeadsUpAnimatingAway || mHeadsUpPinnedMode);
    }

    @Override
    public void onHeadsUpPinned(NotificationEntry entry) {
        mNotificationStackScroller.generateHeadsUpAnimation(entry.getHeadsUpAnimationView(), true);
        if (!isOnKeyguard()) {
            mNotificationStackScroller.generateHeadsUpAnimation(entry.getHeadsUpAnimationView(),
                    true);
        }
    }

    @Override
@@ -2768,7 +2780,7 @@ public class NotificationPanelView extends PanelView implements
        // When we're unpinning the notification via active edge they remain heads-upped,
        // we need to make sure that an animation happens in this case, otherwise the notification
        // will stick to the top without any interaction.
        if (isFullyCollapsed() && entry.isRowHeadsUp()) {
        if (isFullyCollapsed() && entry.isRowHeadsUp() && !isOnKeyguard()) {
            mNotificationStackScroller.generateHeadsUpAnimation(
                    entry.getHeadsUpAnimationView(), false);
            entry.setHeadsUpIsVisible();
@@ -2891,7 +2903,8 @@ public class NotificationPanelView extends PanelView implements

    @Override
    protected boolean isPanelVisibleBecauseOfHeadsUp() {
        return mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpAnimatingAway;
        return (mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpAnimatingAway)
                && mBarState == StatusBarState.SHADE;
    }

    @Override
+6 −2
Original line number Diff line number Diff line
@@ -107,8 +107,12 @@ public abstract class PanelBar extends FrameLayout {
        return mExpanded;
    }

    private void updateVisibility() {
        mPanel.setVisibility(mExpanded || mBouncerShowing ? VISIBLE : INVISIBLE);
    protected void updateVisibility() {
        mPanel.setVisibility(shouldPanelBeVisible() ? VISIBLE : INVISIBLE);
    }

    protected boolean shouldPanelBeVisible() {
        return mExpanded || mBouncerShowing;
    }

    public boolean panelEnabled() {
Loading