Skip to content

Commit 748ee2e

Browse files
committed
ActivityChooser view not handling its removal and relayout properly.
1. ActivityChooserView did not hide the popup window when detached. bug:6544220 2. ActivityChooserView was calling show popup when it was already showing it resulting in an incrrect update and losing one item per rotation. bug:6522041 Change-Id: Iec1682ca5d27e38caf57214fa86060edf82a2166
1 parent 53d003f commit 748ee2e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

core/java/android/widget/ActivityChooserView.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,9 @@ protected void onDetachedFromWindow() {
400400
if (viewTreeObserver.isAlive()) {
401401
viewTreeObserver.removeOnGlobalLayoutListener(mOnGlobalLayoutListener);
402402
}
403+
if (isShowingPopup()) {
404+
dismissPopup();
405+
}
403406
mIsAttachedToWindow = false;
404407
}
405408

@@ -420,9 +423,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
420423
@Override
421424
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
422425
mActivityChooserContent.layout(0, 0, right - left, bottom - top);
423-
if (getListPopupWindow().isShowing()) {
424-
showPopupUnchecked(mAdapter.getMaxActivityCount());
425-
} else {
426+
if (!isShowingPopup()) {
426427
dismissPopup();
427428
}
428429
}

0 commit comments

Comments
 (0)