From 5fbc632fefa8e4826d42a2ba43772f9f906153ff Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 15 Jan 2016 17:17:58 -0800 Subject: [PATCH] Fixed a bug where the wrong number of notifications were visible Since the calculation of the number of notifications is dynamic now it strongly depends on the notification min heights which are only calculated once it is laid out. This is now properly done. Bug: 26480961 Change-Id: Ic7b270af826c28b4a9d2c08021605a5c9ae78860 --- .../com/android/systemui/statusbar/BaseStatusBar.java | 10 +++++++--- .../android/systemui/statusbar/phone/PanelView.java | 6 +----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 62a217254c407..2592486cde7cf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1265,13 +1265,17 @@ public abstract class BaseStatusBar extends SystemUI implements } /** - * Called when the size of the notification panel changes + * Called when the notification panel layouts */ - public void onPanelHeightChanged() { + public void onPanelLaidOut() { if (mState == StatusBarState.KEYGUARD) { // Since the number of notifications is determined based on the height of the view, we // need to update them. - updateRowStates(); + int maxBefore = getMaxKeyguardNotifications(false /* recompute */); + int maxNotifications = getMaxKeyguardNotifications(true /* recompute */); + if (maxBefore != maxNotifications) { + updateRowStates(); + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index aa01bf2488538..f0b78944c1fbc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -81,7 +81,6 @@ public abstract class PanelView extends FrameLayout { private boolean mMotionAborted; private boolean mUpwardsWhenTresholdReached; private boolean mAnimatingOnDown; - private int mLayoutHeight = 0; private ValueAnimator mHeightAnimator; private ObjectAnimator mPeekAnimator; @@ -715,10 +714,7 @@ public abstract class PanelView extends FrameLayout { @Override protected void onLayout (boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - if (mLayoutHeight != getHeight()) { - mLayoutHeight = getHeight(); - mStatusBar.onPanelHeightChanged(); - } + mStatusBar.onPanelLaidOut(); requestPanelHeightUpdate(); mHasLayoutedSinceDown = true; if (mUpdateFlingOnLayout) {