Fix an action bar menu order of operations bug

As options menu invalidations in PhoneWindow are deferred, it was
possible for a call to open the overflow menu (which involves an extra
chance to prepare the menu) to happen before the pending menu
invalidation was handled. Process any pending menu invalidations
before attempting to show the overflow menu in response to one of
these events.

Bug 7209308

Change-Id: Id50f7f6ad5d3a631745207fa0bad8c356690e16c
This commit is contained in:
Adam Powell
2013-03-27 12:22:27 -07:00
parent 2e73f5b8b7
commit 5c8f9b50be

View File

@@ -989,6 +989,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
final Callback cb = getCallback();
if (!mActionBar.isOverflowMenuShowing() || !toggleMenuMode) {
if (cb != null && !isDestroyed() && mActionBar.getVisibility() == View.VISIBLE) {
// If we have a menu invalidation pending, do it now.
if (mInvalidatePanelMenuPosted &&
(mInvalidatePanelMenuFeatures & (1 << FEATURE_OPTIONS_PANEL)) != 0) {
mDecor.removeCallbacks(mInvalidatePanelMenuRunnable);
mInvalidatePanelMenuRunnable.run();
}
final PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, true);
// If we don't have a menu or we're waiting for a full content refresh,