Skip to content

Commit 6a5b0a3

Browse files
committed
Don't try to open action bar overflow menus from bogus events
Some monkey tests could hit a case where a posted overflow button click event was still lingering after the menu was no longer in a created state, which could lead apps to crash. Just drop open-overflow requests on the floor if the menu is in a weird state when we try. Bug 7242431 Change-Id: Ieebb1fccfeeccbf17fd7c6cff06efbcb19b11ce3
1 parent 59adf04 commit 6a5b0a3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

policy/src/com/android/internal/policy/impl/PhoneWindow.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,11 @@ private void reopenMenu(boolean toggleMenuMode) {
993993
if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
994994
if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
995995
final PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, true);
996-
if (cb.onPreparePanel(FEATURE_OPTIONS_PANEL, st.createdPanelView, st.menu)) {
996+
997+
// If we don't have a menu or we're waiting for a full content refresh,
998+
// forget it. This is a lingering event that no longer matters.
999+
if (st.menu != null && !st.refreshMenuContent &&
1000+
cb.onPreparePanel(FEATURE_OPTIONS_PANEL, st.createdPanelView, st.menu)) {
9971001
cb.onMenuOpened(FEATURE_ACTION_BAR, st.menu);
9981002
mActionBar.showOverflowMenu();
9991003
}

0 commit comments

Comments
 (0)