Skip to content

Commit c6d5188

Browse files
committed
Bug 5312828 - Menu button not responding
Increase tolerance for apps calling invalidateOptionsMenu at inconvenient times. Change-Id: I712b20002afd0f056c3f05b160c5fa9c2ef0b552
1 parent a6708c6 commit c6d5188

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,9 @@ public final boolean preparePanel(PanelFeatureState st, KeyEvent event) {
349349
}
350350

351351
// Already prepared (isPrepared will be reset to false later)
352-
if (st.isPrepared)
352+
if (st.isPrepared) {
353353
return true;
354+
}
354355

355356
if ((mPreparedPanel != null) && (mPreparedPanel != st)) {
356357
// Another Panel is prepared and possibly open, so close it
@@ -800,14 +801,23 @@ public final void onKeyUpPanel(int featureId, KeyEvent event) {
800801
closePanel(st, true);
801802

802803
} else if (st.isPrepared) {
804+
boolean show = true;
805+
if (st.refreshMenuContent) {
806+
// Something may have invalidated the menu since we prepared it.
807+
// Re-prepare it to refresh.
808+
st.isPrepared = false;
809+
show = preparePanel(st, event);
810+
}
803811

804-
// Write 'menu opened' to event log
805-
EventLog.writeEvent(50001, 0);
812+
if (show) {
813+
// Write 'menu opened' to event log
814+
EventLog.writeEvent(50001, 0);
806815

807-
// Show menu
808-
openPanel(st, event);
816+
// Show menu
817+
openPanel(st, event);
809818

810-
playSoundEffect = true;
819+
playSoundEffect = true;
820+
}
811821
}
812822
}
813823

0 commit comments

Comments
 (0)