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
This commit is contained in:
Selim Cinek
2019-06-14 12:27:58 -07:00
parent 03e64d649e
commit b57dd8ab17
4 changed files with 23 additions and 8 deletions

View File

@@ -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<NotificationEntry>()
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();
}

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);
}
};