summaryrefslogtreecommitdiffstats
path: root/policy/src
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-07-27 11:55:29 -0700
committerAdam Powell <adamp@google.com>2011-07-27 15:37:58 -0700
commit89b09da7b3b1e69264d9ec710c66eb2f891b313e (patch)
treeb5a0e4a7453fdb71720cb15148ec84bd007100d2 /policy/src
parent804b3d76c39eca09cbbd8b7c3fa1718e7ad094cc (diff)
downloadframeworks_base-89b09da7b3b1e69264d9ec710c66eb2f891b313e.zip
frameworks_base-89b09da7b3b1e69264d9ec710c66eb2f891b313e.tar.gz
frameworks_base-89b09da7b3b1e69264d9ec710c66eb2f891b313e.tar.bz2
Bug 5076788 - Optimize the building and invalidation of menus
Fix cases that weren't batching menu presenter changes correctly. Have FragmentManager invalidate the options menu less often. Change-Id: Ia66fcd09ada8b0a084ad6b08d4340a8fa0c8fc5d
Diffstat (limited to 'policy/src')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index bfc3cdd..a4e94ef 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -374,13 +374,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
st.menu.startDispatchingItemsChanged();
return false;
}
- st.menu.startDispatchingItemsChanged();
// Set the proper keymap
KeyCharacterMap kmap = KeyCharacterMap.load(
event != null ? event.getDeviceId() : KeyCharacterMap.VIRTUAL_KEYBOARD);
st.qwertyMode = kmap.getKeyboardType() != KeyCharacterMap.NUMERIC;
st.menu.setQwertyMode(st.qwertyMode);
+ st.menu.startDispatchingItemsChanged();
}
// Set other state
@@ -454,8 +454,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (featureId == FEATURE_OPTIONS_PANEL && mActionBar != null &&
mActionBar.isOverflowReserved()) {
if (mActionBar.getVisibility() == View.VISIBLE) {
- // Invalidate the options menu, we want a prepare event that the app can respond to.
- invalidatePanelMenu(FEATURE_OPTIONS_PANEL);
mActionBar.showOverflowMenu();
}
} else {
@@ -664,6 +662,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (savedActionViewStates.size() > 0) {
st.frozenActionViewState = savedActionViewStates;
}
+ // This will be started again when the panel is prepared.
+ st.menu.stopDispatchingItemsChanged();
st.menu.clear();
}
st.refreshMenuContent = true;
@@ -2657,7 +2657,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
// being called in the middle of onCreate or similar.
mDecor.post(new Runnable() {
public void run() {
- if (!isDestroyed()) {
+ // Invalidate if the panel menu hasn't been created before this.
+ PanelFeatureState st = getPanelState(FEATURE_OPTIONS_PANEL, false);
+ if (!isDestroyed() && (st == null || st.menu == null)) {
invalidatePanelMenu(FEATURE_ACTION_BAR);
}
}