summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-08-09 17:15:48 -0700
committerAdam Powell <adamp@google.com>2011-08-09 17:15:48 -0700
commit97a30017a408192aab623abf7a4edaeb71cae652 (patch)
treeea492c69a25b2f6368564f762f289f82a1857cc5 /policy
parent95b0292fb4e27a9dc273884be60dad8523b8bd7a (diff)
downloadframeworks_base-97a30017a408192aab623abf7a4edaeb71cae652.zip
frameworks_base-97a30017a408192aab623abf7a4edaeb71cae652.tar.gz
frameworks_base-97a30017a408192aab623abf7a4edaeb71cae652.tar.bz2
Fix bug 5080988 - State change to action views made in
onPrepareOptionsMenu will be lost Change the ordering of restoring action views. Restoration now comes after onCreate but before onPrepare in the menu setup rather than after both. This allows apps to mutate the restored state in onPrepare. Change-Id: I822a716415d01112eb517ac093eaf6929f041aad
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 6dd4948..3dcc297 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -392,6 +392,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
// Preparing the panel menu can involve a lot of manipulation;
// don't dispatch change events to presenters until we're done.
st.menu.stopDispatchingItemsChanged();
+
+ // Restore action view state before we prepare. This gives apps
+ // an opportunity to override frozen/restored state in onPrepare.
+ if (st.frozenActionViewState != null) {
+ st.menu.restoreActionViewStates(st.frozenActionViewState);
+ st.frozenActionViewState = null;
+ }
+
if (!cb.onPreparePanel(st.featureId, st.createdPanelView, st.menu)) {
st.menu.startDispatchingItemsChanged();
return false;
@@ -410,11 +418,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
st.isHandled = false;
mPreparedPanel = st;
- if (st.frozenActionViewState != null) {
- st.menu.restoreActionViewStates(st.frozenActionViewState);
- st.frozenActionViewState = null;
- }
-
return true;
}