Loading services/java/com/android/server/wm/AppWindowToken.java +2 −2 Original line number Diff line number Diff line Loading @@ -393,8 +393,8 @@ class AppWindowToken extends WindowToken { if (!win.isDrawnLw()) { Slog.v(WindowManagerService.TAG, "Not displayed: s=" + win.mWinAnimator.mSurface + " pv=" + win.mPolicyVisibility + " dp=" + win.mDrawPending + " cdp=" + win.mCommitDrawPending + " dp=" + win.mWinAnimator.mDrawPending + " cdp=" + win.mWinAnimator.mCommitDrawPending + " ah=" + win.mAttachedHidden + " th=" + (win.mAppToken != null Loading services/java/com/android/server/wm/WindowAnimator.java +14 −14 Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE; import android.content.Context; import android.os.SystemClock; import android.util.Log; Loading @@ -30,7 +33,6 @@ public class WindowAnimator { final WindowManagerPolicy mPolicy; boolean mAnimating; boolean mUpdateRotation; boolean mTokenMayBeDrawn; boolean mForceHiding; WindowState mWindowAnimationBackground; Loading Loading @@ -61,9 +63,10 @@ public class WindowAnimator { // seen. WindowState mWindowDetachedWallpaper = null; WindowState mDetachedWallpaper = null; boolean mWallpaperMayChange; DimSurface mWindowAnimationBackgroundSurface = null; int mBulkUpdateParams = 0; WindowAnimator(final WindowManagerService service, final Context context, final WindowManagerPolicy policy) { mService = service; Loading @@ -77,7 +80,7 @@ public class WindowAnimator { "Detached wallpaper changed from " + mWindowDetachedWallpaper + " to " + mDetachedWallpaper); mWindowDetachedWallpaper = mDetachedWallpaper; mWallpaperMayChange = true; mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; } if (mWindowAnimationBackgroundColor != 0) { Loading Loading @@ -147,10 +150,9 @@ public class WindowAnimator { (mScreenRotationAnimation.isAnimating() || mScreenRotationAnimation.mFinishAnimReady)) { if (mScreenRotationAnimation.stepAnimationLocked(mCurrentTime)) { mUpdateRotation = false; mAnimating = true; } else { mUpdateRotation = true; mBulkUpdateParams |= SET_UPDATE_ROTATION; mScreenRotationAnimation.kill(); mScreenRotationAnimation = null; } Loading Loading @@ -217,7 +219,7 @@ public class WindowAnimator { } if (wasAnimating && !winAnimator.mAnimating && mService.mWallpaperTarget == w) { mWallpaperMayChange = true; mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2"); Loading Loading @@ -270,7 +272,7 @@ public class WindowAnimator { } if (changed && (attrs.flags & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) { mWallpaperMayChange = true; mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4"); Loading @@ -297,8 +299,8 @@ public class WindowAnimator { if (!w.isDrawnLw()) { Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurface + " pv=" + w.mPolicyVisibility + " dp=" + w.mDrawPending + " cdp=" + w.mCommitDrawPending + " dp=" + winAnimator.mDrawPending + " cdp=" + winAnimator.mCommitDrawPending + " ah=" + w.mAttachedHidden + " th=" + atoken.hiddenRequested + " a=" + winAnimator.mAnimating); Loading Loading @@ -386,7 +388,6 @@ public class WindowAnimator { private void performAnimationsLocked() { mTokenMayBeDrawn = false; mService.mInnerFields.mWallpaperMayChange = false; mForceHiding = false; mDetachedWallpaper = null; mWindowAnimationBackground = null; Loading @@ -399,11 +400,10 @@ public class WindowAnimator { } } void animate() { mPendingLayoutChanges = 0; mWallpaperMayChange = false; mCurrentTime = SystemClock.uptimeMillis(); mBulkUpdateParams = 0; // Update animations of all applications, including those // associated with exiting/removed apps Loading Loading @@ -445,8 +445,8 @@ public class WindowAnimator { Surface.closeTransaction(); } if (mWallpaperMayChange) { mService.notifyWallpaperMayChange(); if (mBulkUpdateParams != 0) { mService.bulkSetParameters(mBulkUpdateParams); } } Loading services/java/com/android/server/wm/WindowManagerService.java +46 −25 Original line number Diff line number Diff line Loading @@ -589,7 +589,10 @@ public class WindowManagerService extends IWindowManager.Stub /** Pulled out of performLayoutAndPlaceSurfacesLockedInner in order to refactor into multiple * methods. */ class LayoutAndSurfaceFields { class LayoutFields { static final int SET_UPDATE_ROTATION = 1 << 0; static final int SET_WALLPAPER_MAY_CHANGE = 1 << 1; boolean mWallpaperForceHidingChanged = false; boolean mWallpaperMayChange = false; boolean mOrientationChangeComplete = true; Loading @@ -600,8 +603,9 @@ public class WindowManagerService extends IWindowManager.Stub private boolean mSyswin = false; private float mScreenBrightness = -1; private float mButtonBrightness = -1; private boolean mUpdateRotation = false; } LayoutAndSurfaceFields mInnerFields = new LayoutAndSurfaceFields(); LayoutFields mInnerFields = new LayoutFields(); /** Only do a maximum of 6 repeated layouts. After that quit */ private int mLayoutRepeatCount; Loading Loading @@ -1547,6 +1551,7 @@ public class WindowManagerService extends IWindowManager.Stub static final int ADJUST_WALLPAPER_VISIBILITY_CHANGED = 1<<2; int adjustWallpaperWindowsLocked() { mInnerFields.mWallpaperMayChange = false; int changed = 0; final int dw = mAppDisplayWidth; Loading Loading @@ -1584,8 +1589,8 @@ public class WindowManagerService extends IWindowManager.Stub } } if (DEBUG_WALLPAPER) Slog.v(TAG, "Win " + w + ": readyfordisplay=" + w.isReadyForDisplay() + " drawpending=" + w.mDrawPending + " commitdrawpending=" + w.mCommitDrawPending); + w.isReadyForDisplay() + " drawpending=" + w.mWinAnimator.mDrawPending + " commitdrawpending=" + w.mWinAnimator.mCommitDrawPending); if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0 && w.isReadyForDisplay() && (mWallpaperTarget == w || w.isDrawnLw())) { if (DEBUG_WALLPAPER) Slog.v(TAG, Loading Loading @@ -2944,7 +2949,7 @@ public class WindowManagerService extends IWindowManager.Stub final long origId = Binder.clearCallingIdentity(); synchronized(mWindowMap) { WindowState win = windowForClientLocked(session, client, false); if (win != null && win.finishDrawingLocked()) { if (win != null && win.mWinAnimator.finishDrawingLocked()) { if ((win.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0) { adjustWallpaperWindowsLocked(); } Loading Loading @@ -6651,6 +6656,7 @@ public class WindowManagerService extends IWindowManager.Stub public static final int REPORT_HARD_KEYBOARD_STATUS_CHANGE = 22; public static final int BOOT_TIMEOUT = 23; public static final int WAITING_FOR_DRAWN_TIMEOUT = 24; public static final int BULK_UPDATE_PARAMETERS = 25; private Session mLastReportedHold; Loading Loading @@ -7061,6 +7067,21 @@ public class WindowManagerService extends IWindowManager.Stub } break; } case BULK_UPDATE_PARAMETERS: { synchronized (mWindowMap) { // TODO(cmautner): As the number of bits grows, use masks of bit groups to // eliminate unnecessary tests. if ((msg.arg1 & LayoutFields.SET_UPDATE_ROTATION) != 0) { mInnerFields.mUpdateRotation = true; } if ((msg.arg1 & LayoutFields.SET_WALLPAPER_MAY_CHANGE) != 0) { mInnerFields.mWallpaperMayChange = true; } requestTraversalLocked(); } } } } } Loading Loading @@ -7995,7 +8016,6 @@ public class WindowManagerService extends IWindowManager.Stub } } mInnerFields.mAdjResult |= adjustWallpaperWindowsLocked(); mInnerFields.mWallpaperMayChange = false; mInnerFields.mWallpaperForceHidingChanged = false; if (DEBUG_WALLPAPER) Slog.v(TAG, "****** OLD: " + oldWallpaper + " NEW: " + mWallpaperTarget Loading Loading @@ -8026,6 +8046,7 @@ public class WindowManagerService extends IWindowManager.Stub } private void updateResizingWindows(final WindowState w) { final WindowStateAnimator winAnimator = w.mWinAnimator; if (!w.mAppFreezing && w.mLayoutSeq == mLayoutSeq) { w.mContentInsetsChanged |= !w.mLastContentInsets.equals(w.mContentInsets); Loading @@ -8045,7 +8066,7 @@ public class WindowManagerService extends IWindowManager.Stub w.mLastFrame.set(w.mFrame); if (w.mContentInsetsChanged || w.mVisibleInsetsChanged || w.mWinAnimator.mSurfaceResized || winAnimator.mSurfaceResized || configChanged) { if (DEBUG_RESIZE || DEBUG_ORIENTATION) { Slog.v(TAG, "Resize reasons: " Loading @@ -8067,8 +8088,8 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_ORIENTATION) Slog.v(TAG, "Orientation start waiting for draw in " + w + ", surface " + w.mWinAnimator.mSurface); w.mDrawPending = true; w.mCommitDrawPending = false; winAnimator.mDrawPending = true; winAnimator.mCommitDrawPending = false; w.mReadyToShow = false; if (w.mAppToken != null) { w.mAppToken.allDrawn = false; Loading Loading @@ -8377,7 +8398,7 @@ public class WindowManagerService extends IWindowManager.Stub // Moved from updateWindowsAndWallpaperLocked(). if (winAnimator.mSurface != null) { // Take care of the window being ready to display. if (w.commitFinishDrawingLocked(currentTime)) { if (winAnimator.commitFinishDrawingLocked(currentTime)) { if ((w.mAttrs.flags & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) { if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG, Loading Loading @@ -8439,6 +8460,7 @@ public class WindowManagerService extends IWindowManager.Stub do { i--; WindowState win = mResizingWindows.get(i); final WindowStateAnimator winAnimator = win.mWinAnimator; try { if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + win + ": " + win.mCompatFrame); Loading @@ -8450,20 +8472,20 @@ public class WindowManagerService extends IWindowManager.Stub if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION) && configChanged) { Slog.i(TAG, "Sending new config to window " + win + ": " + win.mWinAnimator.mSurfaceW + "x" + win.mWinAnimator.mSurfaceH + winAnimator.mSurfaceW + "x" + winAnimator.mSurfaceH + " / " + mCurConfiguration + " / 0x" + Integer.toHexString(diff)); } win.mConfiguration = mCurConfiguration; if (DEBUG_ORIENTATION && win.mDrawPending) Slog.i( if (DEBUG_ORIENTATION && winAnimator.mDrawPending) Slog.i( TAG, "Resizing " + win + " WITH DRAW PENDING"); win.mClient.resized((int)win.mWinAnimator.mSurfaceW, (int)win.mWinAnimator.mSurfaceH, win.mLastContentInsets, win.mLastVisibleInsets, win.mDrawPending, configChanged ? win.mConfiguration : null); win.mClient.resized((int)winAnimator.mSurfaceW, (int)winAnimator.mSurfaceH, win.mLastContentInsets, win.mLastVisibleInsets, winAnimator.mDrawPending, configChanged ? win.mConfiguration : null); win.mContentInsetsChanged = false; win.mVisibleInsetsChanged = false; win.mWinAnimator.mSurfaceResized = false; winAnimator.mSurfaceResized = false; } catch (RemoteException e) { win.mOrientationChanging = false; } Loading Loading @@ -8574,17 +8596,17 @@ public class WindowManagerService extends IWindowManager.Stub mTurnOnScreen = false; } if (mAnimator.mUpdateRotation) { if (mInnerFields.mUpdateRotation) { if (DEBUG_ORIENTATION) Slog.d(TAG, "Performing post-rotate rotation"); if (updateRotationUncheckedLocked(false)) { mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION); } else { mAnimator.mUpdateRotation = false; mInnerFields.mUpdateRotation = false; } } if (mInnerFields.mOrientationChangeComplete && !mLayoutNeeded && !mAnimator.mUpdateRotation) { !mInnerFields.mUpdateRotation) { checkDrawnWindowsLocked(); } Loading Loading @@ -9646,15 +9668,14 @@ public class WindowManagerService extends IWindowManager.Stub requestTraversalLocked(); } void notifyWallpaperMayChange() { mInnerFields.mWallpaperMayChange = true; requestTraversalLocked(); } void debugLayoutRepeats(final String msg) { if (mLayoutRepeatCount >= LAYOUT_REPEAT_THRESHOLD) { Slog.v(TAG, "Layouts looping: " + msg); Slog.v(TAG, "mPendingLayoutChanges = 0x" + Integer.toHexString(mPendingLayoutChanges)); } } void bulkSetParameters(final int bulkUpdateParams) { mH.sendMessage(mH.obtainMessage(H.BULK_UPDATE_PARAMETERS, bulkUpdateParams, 0)); } } services/java/com/android/server/wm/WindowState.java +3 −43 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW; import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; Loading Loading @@ -207,15 +206,6 @@ final class WindowState implements WindowManagerPolicy.WindowState { // when in that case until the layout is done. boolean mLayoutNeeded; // This is set after the Surface has been created but before the // window has been drawn. During this time the surface is hidden. boolean mDrawPending; // This is set after the window has finished drawing for the first // time but before its surface is shown. The surface will be // displayed when the next layout is run. boolean mCommitDrawPending; // This is set during the time after the window's drawing has been // committed, and before its surface is actually shown. It is used // to delay showing the surface until all windows in a token are ready Loading Loading @@ -595,36 +585,6 @@ final class WindowState implements WindowManagerPolicy.WindowState { return mAppToken != null ? mAppToken.firstWindowDrawn : false; } // TODO(cmautner): Move to WindowStateAnimator boolean finishDrawingLocked() { if (mDrawPending) { if (SHOW_TRANSACTIONS || WindowManagerService.DEBUG_ORIENTATION) Slog.v( TAG, "finishDrawingLocked: " + this + " in " + mWinAnimator.mSurface); mCommitDrawPending = true; mDrawPending = false; return true; } return false; } // TODO(cmautner): Move to WindowStateAnimator // This must be called while inside a transaction. boolean commitFinishDrawingLocked(long currentTime) { //Slog.i(TAG, "commitFinishDrawingLocked: " + mSurface); if (!mCommitDrawPending) { return false; } mCommitDrawPending = false; mReadyToShow = true; final boolean starting = mAttrs.type == TYPE_APPLICATION_STARTING; final AppWindowToken atoken = mAppToken; if (atoken == null || atoken.allDrawn || starting) { mWinAnimator.performShowLocked(); } return true; } boolean isIdentityMatrix(float dsdx, float dtdx, float dsdy, float dtdy) { if (dsdx < .99999f || dsdx > 1.00001f) return false; if (dtdy < .99999f || dtdy > 1.00001f) return false; Loading Loading @@ -782,7 +742,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { */ public boolean isDrawnLw() { return mWinAnimator.mSurface != null && !mDestroying && !mDrawPending && !mCommitDrawPending; && !mWinAnimator.mDrawPending && !mWinAnimator.mCommitDrawPending; } /** Loading Loading @@ -1087,8 +1047,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { } mWinAnimator.dump(pw, prefix, dumpAll); if (dumpAll) { pw.print(prefix); pw.print("mDrawPending="); pw.print(mDrawPending); pw.print(" mCommitDrawPending="); pw.print(mCommitDrawPending); pw.print(prefix); pw.print("mDrawPending="); pw.print(mWinAnimator.mDrawPending); pw.print(" mCommitDrawPending="); pw.print(mWinAnimator.mCommitDrawPending); pw.print(" mReadyToShow="); pw.print(mReadyToShow); pw.print(" mHasDrawn="); pw.println(mHasDrawn); } Loading services/java/com/android/server/wm/WindowStateAnimator.java +40 −4 Original line number Diff line number Diff line Loading @@ -98,6 +98,15 @@ class WindowStateAnimator { // an enter animation. boolean mEnterAnimationPending; // This is set after the Surface has been created but before the // window has been drawn. During this time the surface is hidden. boolean mDrawPending; // This is set after the window has finished drawing for the first // time but before its surface is shown. The surface will be // displayed when the next layout is run. boolean mCommitDrawPending; public WindowStateAnimator(final WindowManagerService service, final WindowState win, final WindowState attachedWindow) { mService = service; Loading Loading @@ -347,14 +356,41 @@ class WindowStateAnimator { } } boolean finishDrawingLocked() { if (mDrawPending) { if (SHOW_TRANSACTIONS || WindowManagerService.DEBUG_ORIENTATION) Slog.v( TAG, "finishDrawingLocked: " + this + " in " + mSurface); mCommitDrawPending = true; mDrawPending = false; return true; } return false; } // This must be called while inside a transaction. boolean commitFinishDrawingLocked(long currentTime) { //Slog.i(TAG, "commitFinishDrawingLocked: " + mSurface); if (!mCommitDrawPending) { return false; } mCommitDrawPending = false; mWin.mReadyToShow = true; final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING; final AppWindowToken atoken = mWin.mAppToken; if (atoken == null || atoken.allDrawn || starting) { performShowLocked(); } return true; } Surface createSurfaceLocked() { if (mSurface == null) { mReportDestroySurface = false; mSurfacePendingDestroy = false; if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(TAG, "createSurface " + this + ": DRAW NOW PENDING"); mWin.mDrawPending = true; mWin.mCommitDrawPending = false; mDrawPending = true; mCommitDrawPending = false; mWin.mReadyToShow = false; if (mWin.mAppToken != null) { mWin.mAppToken.allDrawn = false; Loading Loading @@ -471,8 +507,8 @@ class WindowStateAnimator { } if (mSurface != null) { mWin.mDrawPending = false; mWin.mCommitDrawPending = false; mDrawPending = false; mCommitDrawPending = false; mWin.mReadyToShow = false; int i = mWin.mChildWindows.size(); Loading Loading
services/java/com/android/server/wm/AppWindowToken.java +2 −2 Original line number Diff line number Diff line Loading @@ -393,8 +393,8 @@ class AppWindowToken extends WindowToken { if (!win.isDrawnLw()) { Slog.v(WindowManagerService.TAG, "Not displayed: s=" + win.mWinAnimator.mSurface + " pv=" + win.mPolicyVisibility + " dp=" + win.mDrawPending + " cdp=" + win.mCommitDrawPending + " dp=" + win.mWinAnimator.mDrawPending + " cdp=" + win.mWinAnimator.mCommitDrawPending + " ah=" + win.mAttachedHidden + " th=" + (win.mAppToken != null Loading
services/java/com/android/server/wm/WindowAnimator.java +14 −14 Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE; import android.content.Context; import android.os.SystemClock; import android.util.Log; Loading @@ -30,7 +33,6 @@ public class WindowAnimator { final WindowManagerPolicy mPolicy; boolean mAnimating; boolean mUpdateRotation; boolean mTokenMayBeDrawn; boolean mForceHiding; WindowState mWindowAnimationBackground; Loading Loading @@ -61,9 +63,10 @@ public class WindowAnimator { // seen. WindowState mWindowDetachedWallpaper = null; WindowState mDetachedWallpaper = null; boolean mWallpaperMayChange; DimSurface mWindowAnimationBackgroundSurface = null; int mBulkUpdateParams = 0; WindowAnimator(final WindowManagerService service, final Context context, final WindowManagerPolicy policy) { mService = service; Loading @@ -77,7 +80,7 @@ public class WindowAnimator { "Detached wallpaper changed from " + mWindowDetachedWallpaper + " to " + mDetachedWallpaper); mWindowDetachedWallpaper = mDetachedWallpaper; mWallpaperMayChange = true; mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; } if (mWindowAnimationBackgroundColor != 0) { Loading Loading @@ -147,10 +150,9 @@ public class WindowAnimator { (mScreenRotationAnimation.isAnimating() || mScreenRotationAnimation.mFinishAnimReady)) { if (mScreenRotationAnimation.stepAnimationLocked(mCurrentTime)) { mUpdateRotation = false; mAnimating = true; } else { mUpdateRotation = true; mBulkUpdateParams |= SET_UPDATE_ROTATION; mScreenRotationAnimation.kill(); mScreenRotationAnimation = null; } Loading Loading @@ -217,7 +219,7 @@ public class WindowAnimator { } if (wasAnimating && !winAnimator.mAnimating && mService.mWallpaperTarget == w) { mWallpaperMayChange = true; mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2"); Loading Loading @@ -270,7 +272,7 @@ public class WindowAnimator { } if (changed && (attrs.flags & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) { mWallpaperMayChange = true; mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4"); Loading @@ -297,8 +299,8 @@ public class WindowAnimator { if (!w.isDrawnLw()) { Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurface + " pv=" + w.mPolicyVisibility + " dp=" + w.mDrawPending + " cdp=" + w.mCommitDrawPending + " dp=" + winAnimator.mDrawPending + " cdp=" + winAnimator.mCommitDrawPending + " ah=" + w.mAttachedHidden + " th=" + atoken.hiddenRequested + " a=" + winAnimator.mAnimating); Loading Loading @@ -386,7 +388,6 @@ public class WindowAnimator { private void performAnimationsLocked() { mTokenMayBeDrawn = false; mService.mInnerFields.mWallpaperMayChange = false; mForceHiding = false; mDetachedWallpaper = null; mWindowAnimationBackground = null; Loading @@ -399,11 +400,10 @@ public class WindowAnimator { } } void animate() { mPendingLayoutChanges = 0; mWallpaperMayChange = false; mCurrentTime = SystemClock.uptimeMillis(); mBulkUpdateParams = 0; // Update animations of all applications, including those // associated with exiting/removed apps Loading Loading @@ -445,8 +445,8 @@ public class WindowAnimator { Surface.closeTransaction(); } if (mWallpaperMayChange) { mService.notifyWallpaperMayChange(); if (mBulkUpdateParams != 0) { mService.bulkSetParameters(mBulkUpdateParams); } } Loading
services/java/com/android/server/wm/WindowManagerService.java +46 −25 Original line number Diff line number Diff line Loading @@ -589,7 +589,10 @@ public class WindowManagerService extends IWindowManager.Stub /** Pulled out of performLayoutAndPlaceSurfacesLockedInner in order to refactor into multiple * methods. */ class LayoutAndSurfaceFields { class LayoutFields { static final int SET_UPDATE_ROTATION = 1 << 0; static final int SET_WALLPAPER_MAY_CHANGE = 1 << 1; boolean mWallpaperForceHidingChanged = false; boolean mWallpaperMayChange = false; boolean mOrientationChangeComplete = true; Loading @@ -600,8 +603,9 @@ public class WindowManagerService extends IWindowManager.Stub private boolean mSyswin = false; private float mScreenBrightness = -1; private float mButtonBrightness = -1; private boolean mUpdateRotation = false; } LayoutAndSurfaceFields mInnerFields = new LayoutAndSurfaceFields(); LayoutFields mInnerFields = new LayoutFields(); /** Only do a maximum of 6 repeated layouts. After that quit */ private int mLayoutRepeatCount; Loading Loading @@ -1547,6 +1551,7 @@ public class WindowManagerService extends IWindowManager.Stub static final int ADJUST_WALLPAPER_VISIBILITY_CHANGED = 1<<2; int adjustWallpaperWindowsLocked() { mInnerFields.mWallpaperMayChange = false; int changed = 0; final int dw = mAppDisplayWidth; Loading Loading @@ -1584,8 +1589,8 @@ public class WindowManagerService extends IWindowManager.Stub } } if (DEBUG_WALLPAPER) Slog.v(TAG, "Win " + w + ": readyfordisplay=" + w.isReadyForDisplay() + " drawpending=" + w.mDrawPending + " commitdrawpending=" + w.mCommitDrawPending); + w.isReadyForDisplay() + " drawpending=" + w.mWinAnimator.mDrawPending + " commitdrawpending=" + w.mWinAnimator.mCommitDrawPending); if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0 && w.isReadyForDisplay() && (mWallpaperTarget == w || w.isDrawnLw())) { if (DEBUG_WALLPAPER) Slog.v(TAG, Loading Loading @@ -2944,7 +2949,7 @@ public class WindowManagerService extends IWindowManager.Stub final long origId = Binder.clearCallingIdentity(); synchronized(mWindowMap) { WindowState win = windowForClientLocked(session, client, false); if (win != null && win.finishDrawingLocked()) { if (win != null && win.mWinAnimator.finishDrawingLocked()) { if ((win.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0) { adjustWallpaperWindowsLocked(); } Loading Loading @@ -6651,6 +6656,7 @@ public class WindowManagerService extends IWindowManager.Stub public static final int REPORT_HARD_KEYBOARD_STATUS_CHANGE = 22; public static final int BOOT_TIMEOUT = 23; public static final int WAITING_FOR_DRAWN_TIMEOUT = 24; public static final int BULK_UPDATE_PARAMETERS = 25; private Session mLastReportedHold; Loading Loading @@ -7061,6 +7067,21 @@ public class WindowManagerService extends IWindowManager.Stub } break; } case BULK_UPDATE_PARAMETERS: { synchronized (mWindowMap) { // TODO(cmautner): As the number of bits grows, use masks of bit groups to // eliminate unnecessary tests. if ((msg.arg1 & LayoutFields.SET_UPDATE_ROTATION) != 0) { mInnerFields.mUpdateRotation = true; } if ((msg.arg1 & LayoutFields.SET_WALLPAPER_MAY_CHANGE) != 0) { mInnerFields.mWallpaperMayChange = true; } requestTraversalLocked(); } } } } } Loading Loading @@ -7995,7 +8016,6 @@ public class WindowManagerService extends IWindowManager.Stub } } mInnerFields.mAdjResult |= adjustWallpaperWindowsLocked(); mInnerFields.mWallpaperMayChange = false; mInnerFields.mWallpaperForceHidingChanged = false; if (DEBUG_WALLPAPER) Slog.v(TAG, "****** OLD: " + oldWallpaper + " NEW: " + mWallpaperTarget Loading Loading @@ -8026,6 +8046,7 @@ public class WindowManagerService extends IWindowManager.Stub } private void updateResizingWindows(final WindowState w) { final WindowStateAnimator winAnimator = w.mWinAnimator; if (!w.mAppFreezing && w.mLayoutSeq == mLayoutSeq) { w.mContentInsetsChanged |= !w.mLastContentInsets.equals(w.mContentInsets); Loading @@ -8045,7 +8066,7 @@ public class WindowManagerService extends IWindowManager.Stub w.mLastFrame.set(w.mFrame); if (w.mContentInsetsChanged || w.mVisibleInsetsChanged || w.mWinAnimator.mSurfaceResized || winAnimator.mSurfaceResized || configChanged) { if (DEBUG_RESIZE || DEBUG_ORIENTATION) { Slog.v(TAG, "Resize reasons: " Loading @@ -8067,8 +8088,8 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_ORIENTATION) Slog.v(TAG, "Orientation start waiting for draw in " + w + ", surface " + w.mWinAnimator.mSurface); w.mDrawPending = true; w.mCommitDrawPending = false; winAnimator.mDrawPending = true; winAnimator.mCommitDrawPending = false; w.mReadyToShow = false; if (w.mAppToken != null) { w.mAppToken.allDrawn = false; Loading Loading @@ -8377,7 +8398,7 @@ public class WindowManagerService extends IWindowManager.Stub // Moved from updateWindowsAndWallpaperLocked(). if (winAnimator.mSurface != null) { // Take care of the window being ready to display. if (w.commitFinishDrawingLocked(currentTime)) { if (winAnimator.commitFinishDrawingLocked(currentTime)) { if ((w.mAttrs.flags & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) { if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG, Loading Loading @@ -8439,6 +8460,7 @@ public class WindowManagerService extends IWindowManager.Stub do { i--; WindowState win = mResizingWindows.get(i); final WindowStateAnimator winAnimator = win.mWinAnimator; try { if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + win + ": " + win.mCompatFrame); Loading @@ -8450,20 +8472,20 @@ public class WindowManagerService extends IWindowManager.Stub if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION) && configChanged) { Slog.i(TAG, "Sending new config to window " + win + ": " + win.mWinAnimator.mSurfaceW + "x" + win.mWinAnimator.mSurfaceH + winAnimator.mSurfaceW + "x" + winAnimator.mSurfaceH + " / " + mCurConfiguration + " / 0x" + Integer.toHexString(diff)); } win.mConfiguration = mCurConfiguration; if (DEBUG_ORIENTATION && win.mDrawPending) Slog.i( if (DEBUG_ORIENTATION && winAnimator.mDrawPending) Slog.i( TAG, "Resizing " + win + " WITH DRAW PENDING"); win.mClient.resized((int)win.mWinAnimator.mSurfaceW, (int)win.mWinAnimator.mSurfaceH, win.mLastContentInsets, win.mLastVisibleInsets, win.mDrawPending, configChanged ? win.mConfiguration : null); win.mClient.resized((int)winAnimator.mSurfaceW, (int)winAnimator.mSurfaceH, win.mLastContentInsets, win.mLastVisibleInsets, winAnimator.mDrawPending, configChanged ? win.mConfiguration : null); win.mContentInsetsChanged = false; win.mVisibleInsetsChanged = false; win.mWinAnimator.mSurfaceResized = false; winAnimator.mSurfaceResized = false; } catch (RemoteException e) { win.mOrientationChanging = false; } Loading Loading @@ -8574,17 +8596,17 @@ public class WindowManagerService extends IWindowManager.Stub mTurnOnScreen = false; } if (mAnimator.mUpdateRotation) { if (mInnerFields.mUpdateRotation) { if (DEBUG_ORIENTATION) Slog.d(TAG, "Performing post-rotate rotation"); if (updateRotationUncheckedLocked(false)) { mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION); } else { mAnimator.mUpdateRotation = false; mInnerFields.mUpdateRotation = false; } } if (mInnerFields.mOrientationChangeComplete && !mLayoutNeeded && !mAnimator.mUpdateRotation) { !mInnerFields.mUpdateRotation) { checkDrawnWindowsLocked(); } Loading Loading @@ -9646,15 +9668,14 @@ public class WindowManagerService extends IWindowManager.Stub requestTraversalLocked(); } void notifyWallpaperMayChange() { mInnerFields.mWallpaperMayChange = true; requestTraversalLocked(); } void debugLayoutRepeats(final String msg) { if (mLayoutRepeatCount >= LAYOUT_REPEAT_THRESHOLD) { Slog.v(TAG, "Layouts looping: " + msg); Slog.v(TAG, "mPendingLayoutChanges = 0x" + Integer.toHexString(mPendingLayoutChanges)); } } void bulkSetParameters(final int bulkUpdateParams) { mH.sendMessage(mH.obtainMessage(H.BULK_UPDATE_PARAMETERS, bulkUpdateParams, 0)); } }
services/java/com/android/server/wm/WindowState.java +3 −43 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW; import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; Loading Loading @@ -207,15 +206,6 @@ final class WindowState implements WindowManagerPolicy.WindowState { // when in that case until the layout is done. boolean mLayoutNeeded; // This is set after the Surface has been created but before the // window has been drawn. During this time the surface is hidden. boolean mDrawPending; // This is set after the window has finished drawing for the first // time but before its surface is shown. The surface will be // displayed when the next layout is run. boolean mCommitDrawPending; // This is set during the time after the window's drawing has been // committed, and before its surface is actually shown. It is used // to delay showing the surface until all windows in a token are ready Loading Loading @@ -595,36 +585,6 @@ final class WindowState implements WindowManagerPolicy.WindowState { return mAppToken != null ? mAppToken.firstWindowDrawn : false; } // TODO(cmautner): Move to WindowStateAnimator boolean finishDrawingLocked() { if (mDrawPending) { if (SHOW_TRANSACTIONS || WindowManagerService.DEBUG_ORIENTATION) Slog.v( TAG, "finishDrawingLocked: " + this + " in " + mWinAnimator.mSurface); mCommitDrawPending = true; mDrawPending = false; return true; } return false; } // TODO(cmautner): Move to WindowStateAnimator // This must be called while inside a transaction. boolean commitFinishDrawingLocked(long currentTime) { //Slog.i(TAG, "commitFinishDrawingLocked: " + mSurface); if (!mCommitDrawPending) { return false; } mCommitDrawPending = false; mReadyToShow = true; final boolean starting = mAttrs.type == TYPE_APPLICATION_STARTING; final AppWindowToken atoken = mAppToken; if (atoken == null || atoken.allDrawn || starting) { mWinAnimator.performShowLocked(); } return true; } boolean isIdentityMatrix(float dsdx, float dtdx, float dsdy, float dtdy) { if (dsdx < .99999f || dsdx > 1.00001f) return false; if (dtdy < .99999f || dtdy > 1.00001f) return false; Loading Loading @@ -782,7 +742,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { */ public boolean isDrawnLw() { return mWinAnimator.mSurface != null && !mDestroying && !mDrawPending && !mCommitDrawPending; && !mWinAnimator.mDrawPending && !mWinAnimator.mCommitDrawPending; } /** Loading Loading @@ -1087,8 +1047,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { } mWinAnimator.dump(pw, prefix, dumpAll); if (dumpAll) { pw.print(prefix); pw.print("mDrawPending="); pw.print(mDrawPending); pw.print(" mCommitDrawPending="); pw.print(mCommitDrawPending); pw.print(prefix); pw.print("mDrawPending="); pw.print(mWinAnimator.mDrawPending); pw.print(" mCommitDrawPending="); pw.print(mWinAnimator.mCommitDrawPending); pw.print(" mReadyToShow="); pw.print(mReadyToShow); pw.print(" mHasDrawn="); pw.println(mHasDrawn); } Loading
services/java/com/android/server/wm/WindowStateAnimator.java +40 −4 Original line number Diff line number Diff line Loading @@ -98,6 +98,15 @@ class WindowStateAnimator { // an enter animation. boolean mEnterAnimationPending; // This is set after the Surface has been created but before the // window has been drawn. During this time the surface is hidden. boolean mDrawPending; // This is set after the window has finished drawing for the first // time but before its surface is shown. The surface will be // displayed when the next layout is run. boolean mCommitDrawPending; public WindowStateAnimator(final WindowManagerService service, final WindowState win, final WindowState attachedWindow) { mService = service; Loading Loading @@ -347,14 +356,41 @@ class WindowStateAnimator { } } boolean finishDrawingLocked() { if (mDrawPending) { if (SHOW_TRANSACTIONS || WindowManagerService.DEBUG_ORIENTATION) Slog.v( TAG, "finishDrawingLocked: " + this + " in " + mSurface); mCommitDrawPending = true; mDrawPending = false; return true; } return false; } // This must be called while inside a transaction. boolean commitFinishDrawingLocked(long currentTime) { //Slog.i(TAG, "commitFinishDrawingLocked: " + mSurface); if (!mCommitDrawPending) { return false; } mCommitDrawPending = false; mWin.mReadyToShow = true; final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING; final AppWindowToken atoken = mWin.mAppToken; if (atoken == null || atoken.allDrawn || starting) { performShowLocked(); } return true; } Surface createSurfaceLocked() { if (mSurface == null) { mReportDestroySurface = false; mSurfacePendingDestroy = false; if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(TAG, "createSurface " + this + ": DRAW NOW PENDING"); mWin.mDrawPending = true; mWin.mCommitDrawPending = false; mDrawPending = true; mCommitDrawPending = false; mWin.mReadyToShow = false; if (mWin.mAppToken != null) { mWin.mAppToken.allDrawn = false; Loading Loading @@ -471,8 +507,8 @@ class WindowStateAnimator { } if (mSurface != null) { mWin.mDrawPending = false; mWin.mCommitDrawPending = false; mDrawPending = false; mCommitDrawPending = false; mWin.mReadyToShow = false; int i = mWin.mChildWindows.size(); Loading