From 73ab6a49db2b834ce1d56c7a1164938b409ee6fc Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 13 Dec 2011 11:16:23 -0800 Subject: Fix issue #5755172: Soft menu key disappears when menu is open We need to work more like before in determining whether the menu key is needed -- in some cases look back in the window list to determine this if we don't know the value from the current window. This requires adding a new private flag indicating whether the compat menu state is known for a window, which is set by PhoneWindow as part of its existing process of computing the flag for its own windows. Now we can have a new API on WindowState to determine the value of this flag for a window, which if needed walks back in the window list to find a window the value is known for (or stops at what the policy has determined is the top full-screen window, so we stop like we used to at things like the lock screen or the bottom of an application). Change-Id: I829de6d629b5af8bcb422cb85249ee4041c7205e --- policy/src/com/android/internal/policy/impl/KeyguardViewManager.java | 1 + policy/src/com/android/internal/policy/impl/PhoneWindow.java | 2 ++ policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'policy') diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java index 0499cfa..ff8d5ac 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java @@ -138,6 +138,7 @@ public class KeyguardViewManager implements KeyguardWindowController { lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED; } + lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY; lp.setTitle("Keyguard"); mWindowLayoutParams = lp; diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 535f039..f1fe43b 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -2582,6 +2582,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (targetPreHoneycomb || (targetPreIcs && targetHcNeedsOptions && noActionBar)) { addFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY); + } else { + clearFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY); } if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 7510e04..0b223c1 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -3707,8 +3707,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { & ~mResettingSystemUiFlags & ~mForceClearedSystemUiFlags; int diff = visibility ^ mLastSystemUiFlags; - final boolean needsMenu = (mFocusedWindow.getAttrs().flags - & WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0; + final boolean needsMenu = mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState); if (diff == 0 && mLastFocusNeedsMenu == needsMenu && mFocusedApp == mFocusedWindow.getAppToken()) { return 0; -- cgit v1.1