// Is this window now (or just being) removed?
boolean mRemoved;
+ // For debugging, this is the last information given to the surface flinger.
+ boolean mSurfaceShown;
+ int mSurfaceX, mSurfaceY, mSurfaceW, mSurfaceH;
+ int mSurfaceLayer;
+ float mSurfaceAlpha;
+
WindowState(Session s, IWindow c, WindowToken token,
WindowState attachedWindow, WindowManager.LayoutParams a,
int viewVisibility) {
if (w <= 0) w = 1;
if (h <= 0) h = 1;
+ mSurfaceShown = false;
+ mSurfaceLayer = 0;
+ mSurfaceAlpha = 1;
+ mSurfaceX = 0;
+ mSurfaceY = 0;
+ mSurfaceW = w;
+ mSurfaceH = h;
try {
mSurface = new Surface(
mSession.mSurfaceSession, mSession.mPid,
Surface.openTransaction();
try {
try {
- mSurface.setPosition(mFrame.left + mXOffset,
- mFrame.top + mYOffset);
+ mSurfaceX = mFrame.left + mXOffset;
+ mSurfaceY = mFrame.top = mYOffset;
+ mSurface.setPosition(mSurfaceX, mSurfaceY);
+ mSurfaceLayer = mAnimLayer;
mSurface.setLayer(mAnimLayer);
+ mSurfaceShown = false;
mSurface.hide();
if ((mAttrs.flags&WindowManager.LayoutParams.FLAG_DITHER) != 0) {
if (SHOW_TRANSACTIONS) logSurface(this, "DITHER", null);
+ ": " + e.toString());
}
+ mSurfaceShown = false;
mSurface = null;
}
}
mDestroySurface.add(this);
mDestroying = true;
if (SHOW_TRANSACTIONS) logSurface(this, "HIDE (finishExit)", null);
+ mSurfaceShown = false;
try {
mSurface.hide();
} catch (RuntimeException e) {
pw.print(" mLastLayer="); pw.println(mLastLayer);
if (mSurface != null) {
pw.print(prefix); pw.print("mSurface="); pw.println(mSurface);
+ pw.print(prefix); pw.print("Surface: shown="); pw.print(mSurfaceShown);
+ pw.print(" layer="); pw.print(mSurfaceLayer);
+ pw.print(" alpha="); pw.print(mSurfaceAlpha);
+ pw.print(" rect=("); pw.print(mSurfaceX);
+ pw.print(","); pw.print(mSurfaceY);
+ pw.print(") "); pw.print(mSurfaceW);
+ pw.print(" x "); pw.println(mSurfaceH);
}
pw.print(prefix); pw.print("mToken="); pw.println(mToken);
pw.print(prefix); pw.print("mRootToken="); pw.println(mRootToken);
}
}
+ int adjResult = 0;
+
if (!animating && mAppTransitionRunning) {
// We have finished the animation of an app transition. To do
// this, we have delayed a lot of operations like showing and
rebuildAppWindowListLocked();
changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT;
+ adjResult |= ADJUST_WALLPAPER_LAYERS_CHANGED;
moveInputMethodWindowsIfNeededLocked(false);
wallpaperMayChange = true;
// Since the window list has been rebuilt, focus might
mFocusMayChange = true;
}
- int adjResult = 0;
-
if (wallpaperForceHidingChanged && changes == 0 && !mAppTransitionReady) {
// At this point, there was a window with a wallpaper that
// was force hiding other windows behind it, but now it
changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_ANIM;
}
}
- adjResult = adjustWallpaperWindowsLocked();
+ adjResult |= adjustWallpaperWindowsLocked();
wallpaperMayChange = false;
wallpaperForceHidingChanged = false;
if (DEBUG_WALLPAPER) Slog.v(TAG, "****** OLD: " + oldWallpaper
if (wallpaperMayChange) {
if (DEBUG_WALLPAPER) Slog.v(TAG,
"Wallpaper may change! Adjusting");
- adjResult = adjustWallpaperWindowsLocked();
+ adjResult |= adjustWallpaperWindowsLocked();
}
if ((adjResult&ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) {
if (SHOW_TRANSACTIONS) logSurface(w,
"POS " + w.mShownFrame.left
+ ", " + w.mShownFrame.top, null);
+ w.mSurfaceX = w.mShownFrame.left;
+ w.mSurfaceY = w.mShownFrame.top;
w.mSurface.setPosition(w.mShownFrame.left, w.mShownFrame.top);
} catch (RuntimeException e) {
Slog.w(TAG, "Error positioning surface in " + w, e);
+ w.mShownFrame.width() + "x"
+ w.mShownFrame.height(), null);
w.mSurfaceResized = true;
+ w.mSurfaceW = width;
+ w.mSurfaceH = height;
w.mSurface.setSize(width, height);
+ w.mSurfaceX = w.mShownFrame.left;
+ w.mSurfaceY = w.mShownFrame.top;
w.mSurface.setPosition(w.mShownFrame.left,
w.mShownFrame.top);
} catch (RuntimeException e) {
if (SHOW_TRANSACTIONS) logSurface(w,
"HIDE (performLayout)", null);
if (w.mSurface != null) {
+ w.mSurfaceShown = false;
try {
w.mSurface.hide();
} catch (RuntimeException e) {
+ "," + (w.mDtDy*w.mVScale) + "]", null);
if (w.mSurface != null) {
try {
+ w.mSurfaceAlpha = w.mShownAlpha;
w.mSurface.setAlpha(w.mShownAlpha);
+ w.mSurfaceLayer = w.mAnimLayer;
w.mSurface.setLayer(w.mAnimLayer);
w.mSurface.setMatrix(
w.mDsDx*w.mHScale, w.mDtDx*w.mVScale,
mDimAnimator = new DimAnimator(mFxSession);
}
mDimAnimator.show(dw, dh);
+ mDimAnimator.updateParameters(w, currentTime);
}
- mDimAnimator.updateParameters(w, currentTime);
}
if ((attrFlags&FLAG_BLUR_BEHIND) != 0) {
if (!blurring) {
//Slog.i(TAG, "BLUR BEHIND: " + w);
blurring = true;
- mBlurShown = true;
if (mBlurSurface == null) {
if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
+ mBlurSurface + ": CREATE");
Slog.e(TAG, "Exception creating Blur surface", e);
}
}
- if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
- + mBlurSurface + ": SHOW pos=(0,0) (" +
- dw + "x" + dh + "), layer=" + (w.mAnimLayer-1));
if (mBlurSurface != null) {
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
+ + mBlurSurface + ": pos=(0,0) (" +
+ dw + "x" + dh + "), layer=" + (w.mAnimLayer-1));
mBlurSurface.setPosition(0, 0);
mBlurSurface.setSize(dw, dh);
- try {
- mBlurSurface.show();
- } catch (RuntimeException e) {
- Slog.w(TAG, "Failure showing blur surface", e);
+ mBlurSurface.setLayer(w.mAnimLayer-2);
+ if (!mBlurShown) {
+ try {
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
+ + mBlurSurface + ": SHOW");
+ mBlurSurface.show();
+ } catch (RuntimeException e) {
+ Slog.w(TAG, "Failure showing blur surface", e);
+ }
+ mBlurShown = true;
}
}
}
- mBlurSurface.setLayer(w.mAnimLayer-2);
}
}
}
mAppTransitionRunning = false;
needRelayout = true;
rebuildAppWindowListLocked();
+ assignLayersLocked();
// Clear information about apps that were moving.
mToBottomApps.clear();
}
boolean showSurfaceRobustlyLocked(WindowState win) {
try {
if (win.mSurface != null) {
+ win.mSurfaceShown = true;
win.mSurface.show();
if (win.mTurnOnScreen) {
if (DEBUG_VISIBILITY) Slog.v(TAG,
+ " pid=" + ws.mSession.mPid
+ " uid=" + ws.mSession.mUid);
ws.mSurface.destroy();
+ ws.mSurfaceShown = false;
ws.mSurface = null;
mForceRemoves.add(ws);
i--;
+ ws + " surface=" + ws.mSurface
+ " token=" + win.mAppToken);
ws.mSurface.destroy();
+ ws.mSurfaceShown = false;
ws.mSurface = null;
leakedSurface = true;
}
Slog.w(TAG, "Looks like we have reclaimed some memory, clearing surface for retry.");
if (surface != null) {
surface.destroy();
+ win.mSurfaceShown = false;
win.mSurface = null;
}
* Show the dim surface.
*/
void show(int dw, int dh) {
- if (SHOW_TRANSACTIONS) Slog.i(TAG, " DIM " + mDimSurface + ": SHOW pos=(0,0) (" +
- dw + "x" + dh + ")");
- mDimShown = true;
- try {
- mDimSurface.setPosition(0, 0);
- mDimSurface.setSize(dw, dh);
- mDimSurface.show();
- } catch (RuntimeException e) {
- Slog.w(TAG, "Failure showing dim surface", e);
+ if (!mDimShown) {
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " DIM " + mDimSurface + ": SHOW pos=(0,0) (" +
+ dw + "x" + dh + ")");
+ mDimShown = true;
+ try {
+ mDimSurface.setPosition(0, 0);
+ mDimSurface.setSize(dw, dh);
+ mDimSurface.show();
+ } catch (RuntimeException e) {
+ Slog.w(TAG, "Failure showing dim surface", e);
+ }
}
}