From 5c8f9b50bedd0209301af2ffdca659217bd97371 Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Wed, 27 Mar 2013 12:22:27 -0700 Subject: [PATCH] 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 --- .../src/com/android/internal/policy/impl/PhoneWindow.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 5ad305cbd2a2e..ad5e20bcab6c8 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -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,