From b57dd8ab1750640773cf85f45d090188eb2b418d Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 14 Jun 2019 12:27:58 -0700 Subject: [PATCH] Made sure huns can show on the lock screen even when awake Previously we only showed them if the screen was dozing Bug: 130327302 Test: atest SystemUITests Change-Id: Ib8a0fa19f8031fd2cc213e156ff89dfd24ee6fa3 --- .../NotificationWakeUpCoordinator.kt | 21 +++++++++++++------ .../collection/NotificationEntry.java | 4 ++++ .../statusbar/phone/HeadsUpManagerPhone.java | 4 ++-- .../systemui/statusbar/phone/StatusBar.java | 2 ++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt index 6dc5fb34f9bd5..bf25c455531bc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt @@ -39,7 +39,7 @@ class NotificationWakeUpCoordinator @Inject constructor( private val mContext: Context, private val mHeadsUpManagerPhone: HeadsUpManagerPhone, private val mStatusBarStateController: StatusBarStateController, - private val mBypassController: KeyguardBypassController) + private val bypassController: KeyguardBypassController) : OnHeadsUpChangedListener, StatusBarStateController.StateListener { private val mNotificationVisibility @@ -67,6 +67,8 @@ class NotificationWakeUpCoordinator @Inject constructor( private var mWakingUp = false private val mEntrySetToClearWhenFinished = mutableSetOf() private val mDozeParameters: DozeParameters; + var fullyAwake: Boolean = false + var willWakeUp = false set(value) { if (!value || mDozeAmount != 0.0f) { @@ -75,7 +77,6 @@ class NotificationWakeUpCoordinator @Inject constructor( } lateinit var iconAreaController : NotificationIconAreaController - var pulsing: Boolean = false set(value) { field = value @@ -118,8 +119,15 @@ class NotificationWakeUpCoordinator @Inject constructor( private fun updateNotificationVisibility(animate: Boolean, increaseSpeed: Boolean) { // TODO: handle Lockscreen wakeup for bypass when we're not pulsing anymore - var visible = (mNotificationsVisibleForExpansion || mHeadsUpManagerPhone.hasNotifications()) - && pulsing + var visible = mNotificationsVisibleForExpansion || mHeadsUpManagerPhone.hasNotifications() + var canShow = pulsing + if (bypassController.bypassEnabled) { + // We also allow pulsing on the lock screen! + canShow = canShow || (mWakingUp || willWakeUp || fullyAwake) + && mStatusBarStateController.state == StatusBarState.KEYGUARD + } + visible = visible && canShow + if (!visible && mNotificationsVisible && (mWakingUp || willWakeUp) && mDozeAmount != 0.0f) { // let's not make notifications invisible while waking up, otherwise the animation // is strange @@ -173,7 +181,7 @@ class NotificationWakeUpCoordinator @Inject constructor( } private fun updateDozeAmountIfBypass(): Boolean { - if (mBypassController.bypassEnabled) { + if (bypassController.bypassEnabled) { var amount = 1.0f; if (mStatusBarStateController.state == StatusBarState.SHADE || mStatusBarStateController.state == StatusBarState.SHADE_LOCKED) { @@ -247,7 +255,8 @@ class NotificationWakeUpCoordinator @Inject constructor( fun setWakingUp(wakingUp: Boolean) { willWakeUp = false mWakingUp = wakingUp - if (wakingUp && mNotificationsVisible && !mNotificationsVisibleForExpansion) { + if (wakingUp && mNotificationsVisible && !mNotificationsVisibleForExpansion + && !bypassController.bypassEnabled) { // We're waking up while pulsing, let's make sure the animation looks nice mStackScroller.wakeUpFromPulse(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index abcdc7a2925fd..9184dec7c8c86 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -660,6 +660,10 @@ public final class NotificationEntry { return row != null && row.isHeadsUp(); } + public boolean showingPulsing() { + return row != null && row.showingPulsing(); + } + public void setHeadsUp(boolean shouldHeadsUp) { if (row != null) row.setHeadsUp(shouldHeadsUp); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java index b6ba3695b7053..bec655cc6ae4b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java @@ -472,8 +472,8 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable, Runnable removeHeadsUpRunnable = () -> { if (!mVisualStabilityManager.isReorderingAllowed() // We don't want to allow reordering while pulsing, but headsup need to - // time out if we're dozing. - && !mStatusBarStateController.isDozing()) { + // time out anyway + && !entry.showingPulsing()) { mEntriesToRemoveWhenReorderingAllowed.add(entry); mVisualStabilityManager.addReorderingAllowedCallback( HeadsUpManagerPhone.this); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index e19fe07791244..43e7a7b809075 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3621,6 +3621,7 @@ public class StatusBar extends SystemUI implements DemoMode, updateNotificationPanelTouchState(); notifyHeadsUpGoingToSleep(); dismissVolumeDialog(); + mWakeUpCoordinator.setFullyAwake(false); } @Override @@ -3643,6 +3644,7 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onFinishedWakingUp() { + mWakeUpCoordinator.setFullyAwake(true); mWakeUpCoordinator.setWakingUp(false); } };