[Android Software/Hacking General [Developers Only]] llrraa2010:
public class WindowManagerService extends IWindowManager.Stub

implements Watchdog.Monitor {

......

public int relayoutWindow(Session session, IWindow client,

WindowManager.LayoutParams attrs, int requestedWidth,

int requestedHeight, int viewVisibility, boolean insetsPending,

Rect outFrame, Rect outContentInsets, Rect outVisibleInsets,

Configuration outConfig, Surface outSurface) {

......

synchronized(mWindowMap) {

WindowState win = windowForClientLocked(session, client, false);

......

int attrChanges = 0;

int flagChanges = 0;

if (attrs != null) {

flagChanges = win.mAttrs.flags ^= attrs.flags;

attrChanges = win.mAttrs.copyFrom(attrs);

}

......

boolean imMayMove = (flagChanges&(

WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM |

WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)) != 0;

boolean focusMayChange = win.mViewVisibility != viewVisibility

|| ((flagChanges&WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) != 0)

|| (!win.mRelayoutCalled);

......

if (viewVisibility == View.VISIBLE &&

(win.mAppToken == null || !win.mAppToken.clientHidden)) {

displayed = !win.isVisibleLw();

......

if ((attrChanges&WindowManager.LayoutParams.FORMAT_CHANGED) != 0) {

// To change the format, we need to re-build the surface.

win.destroySurfaceLocked();

displayed = true;

}

......

if (win.mAttrs.type == TYPE_INPUT_METHOD

&& mInputMethodWindow == null) {

mInputMethodWindow = win;

imMayMove = true;

}

if (displayed) {

focusMayChange = true;

}

......

} else {

......

if (win.mSurface != null) {

......

// If we are not currently running the exit animation, we

// need to see about starting one.

if (!win.mExiting || win.mSurfacePendingDestroy) {

......

if (!win.mSurfacePendingDestroy && win.isWinVisibleLw() &&

applyAnimationLocked(win, transit, false)) {

focusMayChange = true;

win.mExiting = true;

} else if (win.isAnimating()) {

// Currently in a hide animation... turn this into

// an exit.

win.mExiting = true;

} else if (win == mWallpaperTarget) {

// If the wallpaper is currently behind this

// window, we need to change both of them inside

// of a transaction to avoid artifacts.

win.mExiting = true;

win.mAnimating = true;

} else {

if (mInputMethodWindow == win) {

mInputMethodWindow = null;

}

win.destroySurfaceLocked();

}

}

}

......

}

if (focusMayChange) {

......

if (updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES)) {

imMayMove = false;

}

......

}

// updateFocusedWindowLocked() already assigned layers so we only need to

// reassign them at this point if the IM window state gets shuffled

boolean assignLayers = false;

if (imMayMove) {

if (moveInputMethodWindowsIfNeededLocked(false) || displayed) {

// Little hack here -- we -should- be able to rely on the

// function to return true if the IME has moved and needs

// its layer recomputed. However, if the IME was hidden

// and isn't actually moved in the list, its layer may be

// out of data so we make sure to recompute it.

assignLayers = true;

}

}

......

if (assignLayers) {

assignLayersLocked();

}

......

}

......

return (inTouchMode ? WindowManagerImpl.RELAYOUT_IN_TOUCH_MODE : 0)

| (displayed ? WindowManagerImpl.RELAYOUT_FIRST_TIME : 0);

}

......

}