diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 1c1ae26d18d4b..f80630b6317b6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -551,8 +551,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { protected void onFinishInflate() { super.onFinishInflate(); mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic); + mPublicLayout.setContainingNotification(this); mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded); mPrivateLayout.setExpandClickListener(mExpandClickListener); + mPrivateLayout.setContainingNotification(this); mPublicLayout.setExpandClickListener(mExpandClickListener); mGutsStub = (ViewStub) findViewById(R.id.notification_guts_stub); mGutsStub.setOnInflateListener(new ViewStub.OnInflateListener() { @@ -860,6 +862,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } } + @Override + public void notifyHeightChanged(boolean needsAnimation) { + super.notifyHeightChanged(needsAnimation); + getShowingLayout().requestSelectLayout(needsAnimation || isUserLocked()); + } + public void setSensitive(boolean sensitive) { mSensitive = sensitive; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 5da0e9ce7bc67..36cf906c4aa7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -111,6 +111,7 @@ public class NotificationContentView extends FrameLayout { private boolean mBeforeN; private boolean mExpandable; private boolean mClipToActualHeight = true; + private ExpandableNotificationRow mContainingNotification; public NotificationContentView(Context context, AttributeSet attrs) { super(context, attrs); @@ -468,7 +469,8 @@ public class NotificationContentView extends FrameLayout { private int calculateVisibleType() { boolean noExpandedChild = mExpandedChild == null; - if (!noExpandedChild && mContentHeight == mExpandedChild.getHeight()) { + int viewHeight = Math.min(mContentHeight, mContainingNotification.getIntrinsicHeight()); + if (!noExpandedChild && viewHeight == mExpandedChild.getHeight()) { return VISIBLE_TYPE_EXPANDED; } if (mIsChildInGroup && !isGroupExpanded()) { @@ -476,13 +478,13 @@ public class NotificationContentView extends FrameLayout { } if (mIsHeadsUp && mHeadsUpChild != null) { - if (mContentHeight <= mHeadsUpChild.getHeight() || noExpandedChild) { + if (viewHeight <= mHeadsUpChild.getHeight() || noExpandedChild) { return VISIBLE_TYPE_HEADSUP; } else { return VISIBLE_TYPE_EXPANDED; } } else { - if (mContentHeight <= mContractedChild.getHeight() || noExpandedChild) { + if (viewHeight <= mContractedChild.getHeight() || noExpandedChild) { return VISIBLE_TYPE_CONTRACTED; } else { return VISIBLE_TYPE_EXPANDED; @@ -666,4 +668,12 @@ public class NotificationContentView extends FrameLayout { } return header; } + + public void setContainingNotification(ExpandableNotificationRow containingNotification) { + mContainingNotification = containingNotification; + } + + public void requestSelectLayout(boolean needsAnimation) { + selectLayout(needsAnimation, false); + } }