From cb0128941ca741a5345372cf2d765787df7e346c Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Tue, 1 Mar 2016 00:45:06 -0500 Subject: [PATCH] Don't clear effects when the panel is fully collapsed. Otherwise, a FLAG_SHOW_WHEN_LOCKED activity would be unable to make noise (particularly in conjunction with a long sound, or FLAG_INSISTENT) because the mere presence of the status bar on screen would generate an updateVisibleToUser() call, which would in turn use onPanelRevealed() to call clearEffects(). Instead, we have to clear effects from deep in the stack scroller; that's apparently the only place right now where we know with 100% certainty that notifications are actually visible to the user. We also no longer clear effects just because the keyguard is shown. That's silly. Bug: 26863782 Change-Id: I9ec53024f4be060da203b835d31da81104e8c8e6 --- .../com/android/systemui/statusbar/BaseStatusBar.java | 7 ++++--- .../statusbar/stack/NotificationStackScrollLayout.java | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 143f1601e21a3..a6c9f267b557d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1856,15 +1856,16 @@ public abstract class BaseStatusBar extends SystemUI implements /** * The LEDs are turned off when the notification panel is shown, even just a little bit. + * See also NotificationStackScrollLayout.setIsExpanded() for another place where we + * attempt to do this. */ protected void handleVisibleToUserChanged(boolean visibleToUser) { try { if (visibleToUser) { boolean pinnedHeadsUp = mHeadsUpManager.hasPinnedHeadsUp(); boolean clearNotificationEffects = - ((mShowLockscreenNotifications && mState == StatusBarState.KEYGUARD) || - (!pinnedHeadsUp && (mState == StatusBarState.SHADE - || mState == StatusBarState.SHADE_LOCKED))); + !isPanelFullyCollapsed() && + (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED); int notificationLoad = mNotificationData.getActiveNotifications().size(); if (pinnedHeadsUp && isPanelFullyCollapsed()) { notificationLoad = 1; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index d9b78a2f09fc2..59ec6112f4e17 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -2691,6 +2691,16 @@ public class NotificationStackScrollLayout extends ViewGroup if (changed) { if (!mIsExpanded) { mGroupManager.collapseAllGroups(); + } else { + // XXX: HACK: we should not be clearing notification effects from way down here. + // But at the moment we don't have a reliable way to know when the window is + // actually exposed to the air, so + if (mPhoneStatusBar.getBarState() != StatusBarState.KEYGUARD) { + if (DEBUG) { + Log.v(TAG, "clearing notification effects from scroller"); + } + mPhoneStatusBar.clearNotificationEffects(); + } } updateNotificationAnimationStates(); updateChronometers();