Fixed a bug where the system could crash when expanding

am: 3e77984434

Change-Id: Icf8c8743f57a5e402275adfc645f08a10cf94a3b
This commit is contained in:
Selim Cinek
2016-10-13 00:44:16 +00:00
committed by android-build-merger

View File

@@ -1056,7 +1056,7 @@ public class NotificationStackScrollLayout extends ViewGroup
@Override @Override
public int getMaxExpandHeight(ExpandableView view) { public int getMaxExpandHeight(ExpandableView view) {
int maxContentHeight = view.getMaxContentHeight(); int maxContentHeight = view.getMaxContentHeight();
if (view.isSummaryWithChildren()) { if (view.isSummaryWithChildren() && view.getParent() == this) {
// Faking a measure with the group expanded to simulate how the group would look if // Faking a measure with the group expanded to simulate how the group would look if
// it was. Doing a calculation here would be highly non-trivial because of the // it was. Doing a calculation here would be highly non-trivial because of the
// algorithm // algorithm
@@ -1071,8 +1071,11 @@ public class NotificationStackScrollLayout extends ViewGroup
row.getStatusBarNotification()); row.getStatusBarNotification());
mGroupExpandedForMeasure = false; mGroupExpandedForMeasure = false;
row.setForceUnlocked(false); row.setForceUnlocked(false);
int height = mCurrentStackScrollState.getViewStateForView(view).height; StackViewState viewState = mCurrentStackScrollState.getViewStateForView(view);
return Math.min(height, maxContentHeight); if (viewState != null) {
// The view could have been removed
return Math.min(viewState.height, maxContentHeight);
}
} }
return maxContentHeight; return maxContentHeight;
} }