public void dump(PrintWriter pw, String prefix, boolean dumpAll) { if (dumpAll) { if (mWindowDetachedWallpaper != null) { pw.print(prefix); pw.print("mWindowDetachedWallpaper="); pw.println(mWindowDetachedWallpaper); } pw.print(prefix); pw.print("mAnimTransactionSequence="); pw.println(mAnimTransactionSequence); if (mWindowAnimationBackgroundSurface != null) { pw.print(prefix); pw.print("mWindowAnimationBackgroundSurface:"); mWindowAnimationBackgroundSurface.printTo(prefix + " ", pw); } if (mDimAnimator != null) { pw.print(prefix); pw.print("mDimAnimator:"); mDimAnimator.printTo(prefix + " ", pw); } else { pw.print(prefix); pw.print("no DimAnimator "); } } }
void startDimming( final WindowStateAnimator winAnimator, final float target, final int width, final int height) { if (mDimAnimator == null) { mDimAnimator = new DimAnimator(mService.mFxSession); } // Only set dim params on the highest dimmed layer. final WindowStateAnimator dimWinAnimator = mDimParams == null ? null : mDimParams.mDimWinAnimator; // Don't turn on for an unshown surface, or for any layer but the highest dimmed one. if (winAnimator.mSurfaceShown && (dimWinAnimator == null || !dimWinAnimator.mSurfaceShown || dimWinAnimator.mAnimLayer < winAnimator.mAnimLayer)) { /** * Author: Onskreen Date: 21/12/2012 * * <p>Sets the dimming rect and position as per panel(main or either of cornerstone panels)'s * current position in which this window is running. */ if (winAnimator.mWin != null) { if (winAnimator.mWin.mAppToken != null) { IBinder token = winAnimator.mWin.mAppToken.token; if (token != null) { WindowPanel wp = mService.findWindowPanel(token); if (wp != null) { Rect dimRect = new Rect(); dimRect.set(wp.getPos()); mDimAnimator.mDimX = dimRect.left; mDimAnimator.mDimY = dimRect.top; mService.mH.sendMessage( mService.mH.obtainMessage( SET_DIM_PARAMETERS, new DimAnimator.Parameters( winAnimator, dimRect.width(), dimRect.height(), target))); } else { mService.mH.sendMessage( mService.mH.obtainMessage( SET_DIM_PARAMETERS, new DimAnimator.Parameters(winAnimator, width, height, target))); } } else { mService.mH.sendMessage( mService.mH.obtainMessage( SET_DIM_PARAMETERS, new DimAnimator.Parameters(winAnimator, width, height, target))); } } else { mService.mH.sendMessage( mService.mH.obtainMessage( SET_DIM_PARAMETERS, new DimAnimator.Parameters(winAnimator, width, height, target))); } } else { mService.mH.sendMessage( mService.mH.obtainMessage( SET_DIM_PARAMETERS, new DimAnimator.Parameters(winAnimator, width, height, target))); } } }
synchronized void animate() { mPendingLayoutChanges = 0; mCurrentTime = SystemClock.uptimeMillis(); mBulkUpdateParams = 0; boolean wasAnimating = mAnimating; mAnimating = false; if (WindowManagerService.DEBUG_WINDOW_TRACE) { Slog.i(TAG, "!!! animate: entry time=" + mCurrentTime); } // Update animations of all applications, including those // associated with exiting/removed apps Surface.openTransaction(); try { updateWindowsAppsAndRotationAnimationsLocked(); performAnimationsLocked(); testWallpaperAndBackgroundLocked(); // THIRD LOOP: Update the surfaces of all windows. if (mScreenRotationAnimation != null) { mScreenRotationAnimation.updateSurfaces(); } final int N = mWinAnimators.size(); for (int i = 0; i < N; i++) { mWinAnimators.get(i).prepareSurfaceLocked(true); } if (mDimParams != null) { mDimAnimator.updateParameters(mContext.getResources(), mDimParams, mCurrentTime); } if (mDimAnimator != null && mDimAnimator.mDimShown) { mAnimating |= mDimAnimator.updateSurface(isDimming(), mCurrentTime, !mService.okToDisplay()); } if (mService.mBlackFrame != null) { if (mScreenRotationAnimation != null) { mService.mBlackFrame.setMatrix( mScreenRotationAnimation.getEnterTransformation().getMatrix()); } else { mService.mBlackFrame.clearMatrix(); } } if (mService.mWatermark != null) { mService.mWatermark.drawIfNeeded(); } } catch (RuntimeException e) { Log.wtf(TAG, "Unhandled exception in Window Manager", e); } finally { Surface.closeTransaction(); } mService.bulkSetParameters(mBulkUpdateParams, mPendingLayoutChanges); if (mAnimating) { mService.scheduleAnimationLocked(); } else if (wasAnimating) { mService.requestTraversalLocked(); } if (WindowManagerService.DEBUG_WINDOW_TRACE) { Slog.i( TAG, "!!! animate: exit mAnimating=" + mAnimating + " mBulkUpdateParams=" + Integer.toHexString(mBulkUpdateParams) + " mPendingLayoutChanges=" + Integer.toHexString(mPendingLayoutChanges)); } }