Merge "Fix issue #5755172: Soft menu key disappears when menu is open" into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
19a06fe93c
@ -743,6 +743,9 @@ public abstract class Window {
|
|||||||
public void setFlags(int flags, int mask) {
|
public void setFlags(int flags, int mask) {
|
||||||
final WindowManager.LayoutParams attrs = getAttributes();
|
final WindowManager.LayoutParams attrs = getAttributes();
|
||||||
attrs.flags = (attrs.flags&~mask) | (flags&mask);
|
attrs.flags = (attrs.flags&~mask) | (flags&mask);
|
||||||
|
if ((mask&WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0) {
|
||||||
|
attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY;
|
||||||
|
}
|
||||||
mForcedWindowFlags |= mask;
|
mForcedWindowFlags |= mask;
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
mCallback.onWindowAttributesChanged(attrs);
|
mCallback.onWindowAttributesChanged(attrs);
|
||||||
|
@ -823,6 +823,16 @@ public interface WindowManager extends ViewManager {
|
|||||||
*/
|
*/
|
||||||
public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
|
public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is set for a window that has explicitly specified its
|
||||||
|
* FLAG_NEEDS_MENU_KEY, so we know the value on this window is the
|
||||||
|
* appropriate one to use. If this is not set, we should look at
|
||||||
|
* windows behind it to determine the appropriate value.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int PRIVATE_FLAG_SET_NEEDS_MENU_KEY = 0x00000008;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control flags that are private to the platform.
|
* Control flags that are private to the platform.
|
||||||
* @hide
|
* @hide
|
||||||
|
@ -237,6 +237,14 @@ public interface WindowManagerPolicy {
|
|||||||
*/
|
*/
|
||||||
public WindowManager.LayoutParams getAttrs();
|
public WindowManager.LayoutParams getAttrs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether this window needs the menu key shown. Must be called
|
||||||
|
* with window lock held, because it may need to traverse down through
|
||||||
|
* window list to determine the result.
|
||||||
|
* @param bottom The bottom-most window to consider when determining this.
|
||||||
|
*/
|
||||||
|
public boolean getNeedsMenuLw(WindowState bottom);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the current system UI visibility flags associated with
|
* Retrieve the current system UI visibility flags associated with
|
||||||
* this window.
|
* this window.
|
||||||
|
@ -138,6 +138,7 @@ public class KeyguardViewManager implements KeyguardWindowController {
|
|||||||
lp.privateFlags |=
|
lp.privateFlags |=
|
||||||
WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED;
|
WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED;
|
||||||
}
|
}
|
||||||
|
lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY;
|
||||||
lp.setTitle("Keyguard");
|
lp.setTitle("Keyguard");
|
||||||
mWindowLayoutParams = lp;
|
mWindowLayoutParams = lp;
|
||||||
|
|
||||||
|
@ -2582,6 +2582,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
|
|
||||||
if (targetPreHoneycomb || (targetPreIcs && targetHcNeedsOptions && noActionBar)) {
|
if (targetPreHoneycomb || (targetPreIcs && targetHcNeedsOptions && noActionBar)) {
|
||||||
addFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY);
|
addFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY);
|
||||||
|
} else {
|
||||||
|
clearFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion
|
if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion
|
||||||
|
@ -3707,8 +3707,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
& ~mResettingSystemUiFlags
|
& ~mResettingSystemUiFlags
|
||||||
& ~mForceClearedSystemUiFlags;
|
& ~mForceClearedSystemUiFlags;
|
||||||
int diff = visibility ^ mLastSystemUiFlags;
|
int diff = visibility ^ mLastSystemUiFlags;
|
||||||
final boolean needsMenu = (mFocusedWindow.getAttrs().flags
|
final boolean needsMenu = mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
|
||||||
& WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0;
|
|
||||||
if (diff == 0 && mLastFocusNeedsMenu == needsMenu
|
if (diff == 0 && mLastFocusNeedsMenu == needsMenu
|
||||||
&& mFocusedApp == mFocusedWindow.getAppToken()) {
|
&& mFocusedApp == mFocusedWindow.getAppToken()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -562,6 +562,33 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
return mAttrs;
|
return mAttrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getNeedsMenuLw(WindowManagerPolicy.WindowState bottom) {
|
||||||
|
int index = -1;
|
||||||
|
WindowState ws = this;
|
||||||
|
while (true) {
|
||||||
|
if ((ws.mAttrs.privateFlags
|
||||||
|
& WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY) != 0) {
|
||||||
|
return (ws.mAttrs.flags & WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0;
|
||||||
|
}
|
||||||
|
// If we reached the bottom of the range of windows we are considering,
|
||||||
|
// assume no menu is needed.
|
||||||
|
if (ws == bottom) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// The current window hasn't specified whether menu key is needed;
|
||||||
|
// look behind it.
|
||||||
|
// First, we may need to determine the starting position.
|
||||||
|
if (index < 0) {
|
||||||
|
index = mService.mWindows.indexOf(ws);
|
||||||
|
}
|
||||||
|
index--;
|
||||||
|
if (index < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ws = mService.mWindows.get(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getSystemUiVisibility() {
|
public int getSystemUiVisibility() {
|
||||||
return mSystemUiVisibility;
|
return mSystemUiVisibility;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user