am 6d90862f: am d65825ab: Merge "Private flags are masked in correct variable" into klp-dev

* commit '6d90862f2387d24c28e9d1c8f080cb9a4ff15011':
  Private flags are masked in correct variable
This commit is contained in:
Adam Lesinski
2013-10-03 15:38:44 -07:00
committed by Android Git Automerger
18 changed files with 74 additions and 46 deletions

View File

@@ -478,7 +478,8 @@ public class SurfaceView extends View {
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
;
if (!getContext().getResources().getCompatibilityInfo().supportsScreen()) {
mLayout.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
mLayout.privateFlags |=
WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
}
mLayout.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;

View File

@@ -467,7 +467,7 @@ public final class ViewRootImpl implements ViewParent,
if (DEBUG_LAYOUT) Log.d(TAG, "WindowLayout in setView:" + attrs);
if (!compatibilityInfo.supportsScreen()) {
attrs.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
mLastInCompatMode = true;
}
@@ -748,8 +748,8 @@ public final class ViewRootImpl implements ViewParent,
// Keep track of the actual window flags supplied by the client.
mClientWindowLayoutFlags = attrs.flags;
// preserve compatible window flag if exists.
int compatibleWindowFlag =
mWindowAttributes.flags & WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
int compatibleWindowFlag = mWindowAttributes.privateFlags
& WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
// transfer over system UI visibility values as they carry current state.
attrs.systemUiVisibility = mWindowAttributes.systemUiVisibility;
attrs.subtreeSystemUiVisibility = mWindowAttributes.subtreeSystemUiVisibility;
@@ -757,7 +757,7 @@ public final class ViewRootImpl implements ViewParent,
if (mWindowAttributes.packageName == null) {
mWindowAttributes.packageName = mBasePackageName;
}
mWindowAttributes.flags |= compatibleWindowFlag;
mWindowAttributes.privateFlags |= compatibleWindowFlag;
applyKeepScreenOnFlag(mWindowAttributes);
@@ -1146,10 +1146,10 @@ public final class ViewRootImpl implements ViewParent,
mFullRedrawNeeded = true;
mLayoutRequested = true;
if (mLastInCompatMode) {
params.flags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
params.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
mLastInCompatMode = false;
} else {
params.flags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
mLastInCompatMode = true;
}
}

View File

@@ -708,6 +708,11 @@ public abstract class Window {
public void addFlags(int flags) {
setFlags(flags, flags);
}
/** @hide */
public void addPrivateFlags(int flags) {
setPrivateFlags(flags, flags);
}
/**
* Convenience function to clear the flag bits as specified in flags, as
@@ -751,6 +756,14 @@ public abstract class Window {
}
}
private void setPrivateFlags(int flags, int mask) {
final WindowManager.LayoutParams attrs = getAttributes();
attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask);
if (mCallback != null) {
mCallback.onWindowAttributesChanged(attrs);
}
}
/**
* Set the amount of dim behind the window when using
* {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}. This overrides

View File

@@ -1754,6 +1754,9 @@ public interface WindowManager extends ViewManager {
sb.append(" fl=#");
sb.append(Integer.toHexString(flags));
if (privateFlags != 0) {
if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
sb.append(" compatible=true");
}
sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
}
if (format != PixelFormat.OPAQUE) {
@@ -1784,9 +1787,6 @@ public interface WindowManager extends ViewManager {
sb.append(" rotAnim=");
sb.append(rotationAnimation);
}
if ((flags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
sb.append(" compatible=true");
}
if (systemUiVisibility != 0) {
sb.append(" sysui=0x");
sb.append(Integer.toHexString(systemUiVisibility));

View File

@@ -399,8 +399,8 @@ public interface WindowManagerPolicy {
*/
public FakeWindow addFakeWindow(Looper looper,
InputEventReceiver.Factory inputEventReceiverFactory,
String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys,
boolean hasFocus, boolean touchFullscreen);
String name, int windowType, int layoutParamsFlags, int layoutParamsPrivateFlags,
boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen);
/**
* Returns a code that describes the current state of the lid switch.

View File

@@ -1620,10 +1620,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
if (!compatInfo.supportsScreen()) {
win.addFlags(WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW);
}
win.setDefaultIcon(icon);
win.setDefaultLogo(logo);
@@ -1638,6 +1634,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
params.privateFlags |=
WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED;
params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
if (!compatInfo.supportsScreen()) {
params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
}
params.setTitle("Starting " + packageName);
wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
@@ -2706,7 +2707,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} else if (mHideNavFakeWindow == null) {
mHideNavFakeWindow = mWindowManagerFuncs.addFakeWindow(
mHandler.getLooper(), mHideNavInputEventReceiverFactory,
"hidden nav", WindowManager.LayoutParams.TYPE_HIDDEN_NAV_CONSUMER,
"hidden nav", WindowManager.LayoutParams.TYPE_HIDDEN_NAV_CONSUMER, 0,
0, false, false, true);
}

View File

@@ -474,6 +474,7 @@ sp<InputWindowHandle> InputDispatcher::findTouchedWindowAtLocked(int32_t display
const InputWindowInfo* windowInfo = windowHandle->getInfo();
if (windowInfo->displayId == displayId) {
int32_t flags = windowInfo->layoutParamsFlags;
int32_t privateFlags = windowInfo->layoutParamsPrivateFlags;
if (windowInfo->visible) {
if (!(flags & InputWindowInfo::FLAG_NOT_TOUCHABLE)) {
@@ -486,7 +487,7 @@ sp<InputWindowHandle> InputDispatcher::findTouchedWindowAtLocked(int32_t display
}
}
if (flags & InputWindowInfo::FLAG_SYSTEM_ERROR) {
if (privateFlags & InputWindowInfo::PRIVATE_FLAG_SYSTEM_ERROR) {
// Error window is on top but not visible, so touch is dropped.
return NULL;
}
@@ -1215,13 +1216,14 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
continue; // wrong display
}
int32_t flags = windowInfo->layoutParamsFlags;
if (flags & InputWindowInfo::FLAG_SYSTEM_ERROR) {
int32_t privateFlags = windowInfo->layoutParamsPrivateFlags;
if (privateFlags & InputWindowInfo::PRIVATE_FLAG_SYSTEM_ERROR) {
if (topErrorWindowHandle == NULL) {
topErrorWindowHandle = windowHandle;
}
}
int32_t flags = windowInfo->layoutParamsFlags;
if (windowInfo->visible) {
if (! (flags & InputWindowInfo::FLAG_NOT_TOUCHABLE)) {
isTouchModal = (flags & (InputWindowInfo::FLAG_NOT_FOCUSABLE

View File

@@ -59,13 +59,13 @@ struct InputWindowInfo {
FLAG_TURN_SCREEN_ON = 0x00200000,
FLAG_DISMISS_KEYGUARD = 0x00400000,
FLAG_SPLIT_TOUCH = 0x00800000,
FLAG_HARDWARE_ACCELERATED = 0x01000000,
FLAG_HARDWARE_ACCELERATED_SYSTEM = 0x02000000,
FLAG_SLIPPERY = 0x04000000,
FLAG_NEEDS_MENU_KEY = 0x08000000,
FLAG_KEEP_SURFACE_WHILE_ANIMATING = 0x10000000,
FLAG_COMPATIBLE_WINDOW = 0x20000000,
FLAG_SYSTEM_ERROR = 0x40000000,
FLAG_SLIPPERY = 0x20000000,
FLAG_NEEDS_MENU_KEY = 0x40000000,
};
// Private Window flags from WindowManager.LayoutParams
enum {
PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100,
};
// Window types from WindowManager.LayoutParams
@@ -117,6 +117,7 @@ struct InputWindowInfo {
sp<InputChannel> inputChannel;
String8 name;
int32_t layoutParamsFlags;
int32_t layoutParamsPrivateFlags;
int32_t layoutParamsType;
nsecs_t dispatchingTimeout;
int32_t frameLeft;

View File

@@ -16,8 +16,6 @@
package com.android.server.am;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_ERROR;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
@@ -72,10 +70,10 @@ final class AppErrorDialog extends BaseErrorDialog {
}
setTitle(res.getText(com.android.internal.R.string.aerr_title));
getWindow().addFlags(PRIVATE_FLAG_SYSTEM_ERROR);
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.setTitle("Application Error: " + app.info.processName);
attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_ERROR
| WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
getWindow().setAttributes(attrs);
if (app.persistent) {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);

View File

@@ -16,8 +16,6 @@
package com.android.server.am;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_ERROR;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
@@ -94,10 +92,10 @@ final class AppNotRespondingDialog extends BaseErrorDialog {
if (aboveSystem) {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
}
getWindow().addFlags(PRIVATE_FLAG_SYSTEM_ERROR);
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.setTitle("Application Not Responding: " + app.info.processName);
attrs.privateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
attrs.privateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_ERROR |
WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
getWindow().setAttributes(attrs);
}

View File

@@ -74,7 +74,7 @@ final class StrictModeViolationDialog extends BaseErrorDialog {
}
setTitle(res.getText(com.android.internal.R.string.aerr_title));
getWindow().addFlags(PRIVATE_FLAG_SYSTEM_ERROR);
getWindow().addPrivateFlags(PRIVATE_FLAG_SYSTEM_ERROR);
getWindow().setTitle("Strict Mode Violation: " + app.info.processName);
// After the timeout, pretend the user clicked the quit button

View File

@@ -44,6 +44,7 @@ public final class InputWindowHandle {
// Window layout params attributes. (WindowManager.LayoutParams)
public int layoutParamsFlags;
public int layoutParamsPrivateFlags;
public int layoutParamsType;
// Dispatching timeout.

View File

@@ -115,6 +115,7 @@ class DragState {
mDragWindowHandle.inputChannel = mServerChannel;
mDragWindowHandle.layer = getDragLayerLw();
mDragWindowHandle.layoutParamsFlags = 0;
mDragWindowHandle.layoutParamsPrivateFlags = 0;
mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
mDragWindowHandle.dispatchingTimeoutNanos =
WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;

View File

@@ -40,8 +40,8 @@ public final class FakeWindowImpl implements WindowManagerPolicy.FakeWindow {
public FakeWindowImpl(WindowManagerService service,
Looper looper, InputEventReceiver.Factory inputEventReceiverFactory,
String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys,
boolean hasFocus, boolean touchFullscreen) {
String name, int windowType, int layoutParamsFlags, int layoutParamsPrivateFlags,
boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen) {
mService = service;
InputChannel[] channels = InputChannel.openInputChannelPair(name);
@@ -63,6 +63,7 @@ public final class FakeWindowImpl implements WindowManagerPolicy.FakeWindow {
mWindowLayer = getLayerLw(windowType);
mWindowHandle.layer = mWindowLayer;
mWindowHandle.layoutParamsFlags = layoutParamsFlags;
mWindowHandle.layoutParamsPrivateFlags = layoutParamsPrivateFlags;
mWindowHandle.layoutParamsType = windowType;
mWindowHandle.dispatchingTimeoutNanos =
WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;

View File

@@ -166,7 +166,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
}
private void addInputWindowHandleLw(final InputWindowHandle inputWindowHandle,
final WindowState child, int flags, final int type,
final WindowState child, int flags, int privateFlags, final int type,
final boolean isVisible, final boolean hasFocus, final boolean hasWallpaper) {
// Add a window to our list of input windows.
inputWindowHandle.name = child.toString();
@@ -181,6 +181,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
child.getTouchableRegion(inputWindowHandle.touchableRegion);
}
inputWindowHandle.layoutParamsFlags = flags;
inputWindowHandle.layoutParamsPrivateFlags = privateFlags;
inputWindowHandle.layoutParamsType = type;
inputWindowHandle.dispatchingTimeoutNanos = child.getInputDispatchingTimeoutNanos();
inputWindowHandle.visible = isVisible;
@@ -274,6 +275,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
}
final int flags = child.mAttrs.flags;
final int privateFlags = child.mAttrs.privateFlags;
final int type = child.mAttrs.type;
final boolean hasFocus = (child == mInputFocus);
@@ -293,13 +295,14 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
final WindowState u = universeBackground.mWin;
if (u.mInputChannel != null && u.mInputWindowHandle != null) {
addInputWindowHandleLw(u.mInputWindowHandle, u, u.mAttrs.flags,
u.mAttrs.type, true, u == mInputFocus, false);
u.mAttrs.privateFlags, u.mAttrs.type,
true, u == mInputFocus, false);
}
addedUniverse = true;
}
if (child.mWinAnimator != universeBackground) {
addInputWindowHandleLw(inputWindowHandle, child, flags, type,
addInputWindowHandleLw(inputWindowHandle, child, flags, privateFlags, type,
isVisible, hasFocus, hasWallpaper);
}
}

View File

@@ -2794,7 +2794,8 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility
+ " req=" + requestedWidth + "x" + requestedHeight + " " + win.mAttrs);
win.mEnforceSizeCompat = (win.mAttrs.flags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0;
win.mEnforceSizeCompat =
(win.mAttrs.privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0;
if ((attrChanges & WindowManager.LayoutParams.ALPHA_CHANGED) != 0) {
winAnimator.mAlpha = attrs.alpha;
@@ -10123,12 +10124,13 @@ public class WindowManagerService extends IWindowManager.Stub
@Override
public FakeWindow addFakeWindow(Looper looper,
InputEventReceiver.Factory inputEventReceiverFactory,
String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys,
boolean hasFocus, boolean touchFullscreen) {
String name, int windowType, int layoutParamsFlags, int layoutParamsPrivateFlags,
boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen) {
synchronized (mWindowMap) {
FakeWindowImpl fw = new FakeWindowImpl(this, looper, inputEventReceiverFactory,
name, windowType,
layoutParamsFlags, canReceiveKeys, hasFocus, touchFullscreen);
layoutParamsFlags, layoutParamsPrivateFlags, canReceiveKeys,
hasFocus, touchFullscreen);
int i=0;
while (i<mFakeWindows.size()) {
if (mFakeWindows.get(i).mWindowLayer <= fw.mWindowLayer) {

View File

@@ -332,7 +332,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
mContext = mService.mContext;
DeathRecipient deathRecipient = new DeathRecipient();
mSeq = seq;
mEnforceSizeCompat = (mAttrs.flags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0;
mEnforceSizeCompat = (mAttrs.privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0;
if (WindowManagerService.localLOGV) Slog.v(
TAG, "Window " + this + " client=" + c.asBinder()
+ " token=" + token + " (" + mAttrs.token + ")" + " params=" + a);

View File

@@ -35,6 +35,7 @@ static struct {
jfieldID inputChannel;
jfieldID name;
jfieldID layoutParamsFlags;
jfieldID layoutParamsPrivateFlags;
jfieldID layoutParamsType;
jfieldID dispatchingTimeoutNanos;
jfieldID frameLeft;
@@ -109,6 +110,8 @@ bool NativeInputWindowHandle::updateInfo() {
mInfo->layoutParamsFlags = env->GetIntField(obj,
gInputWindowHandleClassInfo.layoutParamsFlags);
mInfo->layoutParamsPrivateFlags = env->GetIntField(obj,
gInputWindowHandleClassInfo.layoutParamsPrivateFlags);
mInfo->layoutParamsType = env->GetIntField(obj,
gInputWindowHandleClassInfo.layoutParamsType);
mInfo->dispatchingTimeout = env->GetLongField(obj,
@@ -244,6 +247,9 @@ int register_android_server_InputWindowHandle(JNIEnv* env) {
GET_FIELD_ID(gInputWindowHandleClassInfo.layoutParamsFlags, clazz,
"layoutParamsFlags", "I");
GET_FIELD_ID(gInputWindowHandleClassInfo.layoutParamsPrivateFlags, clazz,
"layoutParamsPrivateFlags", "I");
GET_FIELD_ID(gInputWindowHandleClassInfo.layoutParamsType, clazz,
"layoutParamsType", "I");