diff options
| author | 2017-03-30 15:11:43 -0700 | |
|---|---|---|
| committer | 2017-04-04 13:21:35 -0700 | |
| commit | 7d062c4549ac03d4d16953c3b800830c555a2ed4 (patch) | |
| tree | 31f03e409604917f6478f93b7cd838eae7be719d | |
| parent | d83e9999f73f479da14e716c825da4dbf169b657 (diff) | |
AOD: Only show actually pulsing entries
Fixes an issue where swiping away a notification on AOD2 would
expose the next notification.
Bug: 34716110
Test: receive notification while phone is off, swipe away notification, verify that the next notification does not become visible
Change-Id: I2f8cab37912e6b1edcc129c994a7138c80da7af9
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | 14 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java | 37 |
2 files changed, 36 insertions, 15 deletions
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 992d63291bcf..84089b13d356 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -5014,23 +5014,25 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onPulseStarted() { callback.onPulseStarted(); - if (!mHeadsUpManager.getAllEntries().isEmpty()) { + Collection<HeadsUpManager.HeadsUpEntry> pulsingEntries = + mHeadsUpManager.getAllEntries(); + if (!pulsingEntries.isEmpty()) { // Only pulse the stack scroller if there's actually something to show. // Otherwise just show the always-on screen. - setPulsing(true); + setPulsing(pulsingEntries); } } @Override public void onPulseFinished() { callback.onPulseFinished(); - setPulsing(false); + setPulsing(null); } - private void setPulsing(boolean pulsing) { + private void setPulsing(Collection<HeadsUpManager.HeadsUpEntry> pulsing) { mStackScroller.setPulsing(pulsing); - mNotificationPanel.setPulsing(pulsing); - mVisualStabilityManager.setPulsing(pulsing); + mNotificationPanel.setPulsing(pulsing != null); + mVisualStabilityManager.setPulsing(pulsing != null); } }, reason); } 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 5bead730fcf1..15fcb38ccf6c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -72,6 +72,7 @@ import com.android.systemui.statusbar.DismissView; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.ExpandableView; +import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.NotificationGuts; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StackScrollerDecorView; @@ -86,6 +87,7 @@ import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.ScrollAdapter; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; @@ -331,7 +333,7 @@ public class NotificationStackScrollLayout extends ViewGroup } }; private PorterDuffXfermode mSrcMode = new PorterDuffXfermode(PorterDuff.Mode.SRC); - private boolean mPulsing; + private Collection<HeadsUpManager.HeadsUpEntry> mPulsing; private boolean mDrawBackgroundAsSrc; private boolean mFadingOut; private boolean mParentNotFullyVisible; @@ -1917,15 +1919,19 @@ public class NotificationStackScrollLayout extends ViewGroup int numShownItems = 0; boolean finish = false; int maxDisplayedNotifications = mAmbientState.isDark() - ? (mPulsing ? 1 : 0) + ? (isPulsing() ? 1 : 0) : mMaxDisplayedNotifications; for (int i = 0; i < getChildCount(); i++) { ExpandableView expandableView = (ExpandableView) getChildAt(i); if (expandableView.getVisibility() != View.GONE && !expandableView.hasNoContentHeight()) { - if (maxDisplayedNotifications != -1 - && numShownItems >= maxDisplayedNotifications) { + boolean limitReached = maxDisplayedNotifications != -1 + && numShownItems >= maxDisplayedNotifications; + boolean notificationOnAmbientThatIsNotPulsing = isPulsing() + && expandableView instanceof ExpandableNotificationRow + && !isPulsing(((ExpandableNotificationRow) expandableView).getEntry()); + if (limitReached || notificationOnAmbientThatIsNotPulsing) { expandableView = mShelf; finish = true; } @@ -1971,6 +1977,19 @@ public class NotificationStackScrollLayout extends ViewGroup mAmbientState.setLayoutMaxHeight(mContentHeight); } + private boolean isPulsing(NotificationData.Entry entry) { + for (HeadsUpManager.HeadsUpEntry e : mPulsing) { + if (e.entry == entry) { + return true; + } + } + return false; + } + + private boolean isPulsing() { + return mPulsing != null; + } + private void updateScrollability() { boolean scrollable = getScrollRange() > 0; if (scrollable != mScrollable) { @@ -2784,7 +2803,7 @@ public class NotificationStackScrollLayout extends ViewGroup } private void updateNotificationAnimationStates() { - boolean running = mAnimationsEnabled || mPulsing; + boolean running = mAnimationsEnabled || isPulsing(); mShelf.setAnimationsEnabled(running); int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { @@ -2795,7 +2814,7 @@ public class NotificationStackScrollLayout extends ViewGroup } private void updateAnimationState(View child) { - updateAnimationState((mAnimationsEnabled || mPulsing) + updateAnimationState((mAnimationsEnabled || isPulsing()) && (mIsExpanded || isPinnedHeadsUp(child)), child); } @@ -4055,12 +4074,12 @@ public class NotificationStackScrollLayout extends ViewGroup return mIsExpanded; } - public void setPulsing(boolean pulsing) { - if (mPulsing == pulsing) { + public void setPulsing(Collection<HeadsUpManager.HeadsUpEntry> pulsing) { + if (mPulsing == null && pulsing == null) { return; } mPulsing = pulsing; - mAmbientState.setPulsing(pulsing); + mAmbientState.setPulsing(isPulsing()); updateNotificationAnimationStates(); updateContentHeight(); notifyHeightChangeListener(mShelf); |