diff options
| author | Craig Mautner <cmautner@google.com> | 2012-05-17 13:13:56 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-17 13:13:56 -0700 |
| commit | a978d9bfefa8f7cb1591a1789effa955d902a9cf (patch) | |
| tree | 669fd0c85608d0cc4f0db214a9128a721b58c53c | |
| parent | 0ddb5d3b5d91ed0b891476e834de5ec4ffafece8 (diff) | |
| parent | d51a68b3d2d347be989b53af1777454f97ad9b46 (diff) | |
| download | frameworks_base-a978d9bfefa8f7cb1591a1789effa955d902a9cf.zip frameworks_base-a978d9bfefa8f7cb1591a1789effa955d902a9cf.tar.gz frameworks_base-a978d9bfefa8f7cb1591a1789effa955d902a9cf.tar.bz2 | |
am d51a68b3: Merge "Eliminate deferred surface destruction." into jb-dev
* commit 'd51a68b3d2d347be989b53af1777454f97ad9b46':
Eliminate deferred surface destruction.
5 files changed, 17 insertions, 59 deletions
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index d62f513..d94275b 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -691,13 +691,6 @@ public interface WindowManager extends ViewManager { */ public static final int FLAG_NEEDS_MENU_KEY = 0x08000000; - /** Window flag: *sigh* The lock screen wants to continue running its - * animation while it is fading. A kind-of hack to allow this. Maybe - * in the future we just make this the default behavior. - * - * {@hide} */ - public static final int FLAG_KEEP_SURFACE_WHILE_ANIMATING = 0x10000000; - /** Window flag: special flag to limit the size of the window to be * original size ([320x480] x density). Used to create window for applications * running under compatibility mode. diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java index 7f432bf..504bb63 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java @@ -117,7 +117,6 @@ public class KeyguardViewManager implements KeyguardWindowController { final int stretch = ViewGroup.LayoutParams.MATCH_PARENT; int flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER - | WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING | WindowManager.LayoutParams.FLAG_SLIPPERY /*| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR*/ ; diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index b3ac6f1..f460f9b 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -1173,8 +1173,7 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_INPUT_METHOD) { Slog.i(TAG, "isVisibleOrAdding " + w + ": " + w.isVisibleOrAdding()); if (!w.isVisibleOrAdding()) { - Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurface + " reportDestroy=" - + w.mWinAnimator.mReportDestroySurface + Slog.i(TAG, " mSurface=" + w.mWinAnimator.mSurface + " relayoutCalled=" + w.mRelayoutCalled + " viewVis=" + w.mViewVisibility + " policyVis=" + w.mPolicyVisibility + " attachHid=" + w.mAttachedHidden + " exiting=" + w.mExiting + " destroying=" + w.mDestroying); @@ -2651,7 +2650,7 @@ public class WindowManagerService extends IWindowManager.Stub int requestedHeight, int viewVisibility, int flags, Rect outFrame, Rect outContentInsets, Rect outVisibleInsets, Configuration outConfig, Surface outSurface) { - boolean displayed = false; + boolean toBeDisplayed = false; boolean inTouchMode; boolean configChanged; boolean surfaceChanged = false; @@ -2754,7 +2753,7 @@ public class WindowManagerService extends IWindowManager.Stub } if (viewVisibility == View.VISIBLE && (win.mAppToken == null || !win.mAppToken.clientHidden)) { - displayed = !win.isVisibleLw(); + toBeDisplayed = !win.isVisibleLw(); if (win.mExiting) { winAnimator.cancelExitAnimationForNextAnimationLocked(); win.mExiting = false; @@ -2766,7 +2765,7 @@ public class WindowManagerService extends IWindowManager.Stub if (oldVisibility == View.GONE) { winAnimator.mEnterAnimationPending = true; } - if (displayed) { + if (toBeDisplayed) { if (win.isDrawnLw() && okToDisplay()) { winAnimator.applyEnterAnimationLocked(); } @@ -2792,7 +2791,7 @@ public class WindowManagerService extends IWindowManager.Stub if ((attrChanges&WindowManager.LayoutParams.FORMAT_CHANGED) != 0) { // To change the format, we need to re-build the surface. winAnimator.destroySurfaceLocked(); - displayed = true; + toBeDisplayed = true; surfaceChanged = true; } try { @@ -2802,8 +2801,6 @@ public class WindowManagerService extends IWindowManager.Stub Surface surface = winAnimator.createSurfaceLocked(); if (surface != null) { outSurface.copyFrom(surface); - winAnimator.mReportDestroySurface = false; - winAnimator.mSurfacePendingDestroy = false; if (SHOW_TRANSACTIONS) Slog.i(TAG, " OUT SURFACE " + outSurface + ": copied"); } else { @@ -2820,7 +2817,7 @@ public class WindowManagerService extends IWindowManager.Stub Binder.restoreCallingIdentity(origId); return 0; } - if (displayed) { + if (toBeDisplayed) { focusMayChange = true; } if (win.mAttrs.type == TYPE_INPUT_METHOD @@ -2845,11 +2842,10 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.mEnterAnimationPending = false; if (winAnimator.mSurface != null) { if (DEBUG_VISIBILITY) Slog.i(TAG, "Relayout invis " + win - + ": mExiting=" + win.mExiting - + " mSurfacePendingDestroy=" + winAnimator.mSurfacePendingDestroy); + + ": mExiting=" + win.mExiting); // If we are not currently running the exit animation, we // need to see about starting one. - if (!win.mExiting || winAnimator.mSurfacePendingDestroy) { + if (!win.mExiting) { surfaceChanged = true; // Try starting an animation; if there isn't one, we // can destroy the surface right away. @@ -2857,7 +2853,7 @@ public class WindowManagerService extends IWindowManager.Stub if (win.mAttrs.type == TYPE_APPLICATION_STARTING) { transit = WindowManagerPolicy.TRANSIT_PREVIEW_DONE; } - if (!winAnimator.mSurfacePendingDestroy && win.isWinVisibleLw() && + if (win.isWinVisibleLw() && winAnimator.applyAnimationLocked(transit, false)) { focusMayChange = true; win.mExiting = true; @@ -2880,22 +2876,8 @@ public class WindowManagerService extends IWindowManager.Stub } } - if (winAnimator.mSurface == null || (win.getAttrs().flags - & WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING) == 0 - || winAnimator.mSurfacePendingDestroy) { - // We could be called from a local process, which - // means outSurface holds its current surface. Ensure the - // surface object is cleared, but we don't necessarily want - // it actually destroyed at this point. - winAnimator.mSurfacePendingDestroy = false; - outSurface.release(); - if (DEBUG_VISIBILITY) Slog.i(TAG, "Releasing surface in: " + win); - } else if (winAnimator.mSurface != null) { - if (DEBUG_VISIBILITY) Slog.i(TAG, - "Keeping surface, will report destroy: " + win); - winAnimator.mReportDestroySurface = true; - outSurface.copyFrom(winAnimator.mSurface); - } + outSurface.release(); + if (DEBUG_VISIBILITY) Slog.i(TAG, "Releasing surface in: " + win); } if (focusMayChange) { @@ -2912,7 +2894,7 @@ public class WindowManagerService extends IWindowManager.Stub boolean assignLayers = false; if (imMayMove) { - if (moveInputMethodWindowsIfNeededLocked(false) || displayed) { + if (moveInputMethodWindowsIfNeededLocked(false) || toBeDisplayed) { // 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 @@ -2934,7 +2916,7 @@ public class WindowManagerService extends IWindowManager.Stub } configChanged = updateOrientationFromAppTokensLocked(false); performLayoutAndPlaceSurfacesLocked(); - if (displayed && win.mIsWallpaper) { + if (toBeDisplayed && win.mIsWallpaper) { updateWallpaperOffsetLocked(win, mAppDisplayWidth, mAppDisplayHeight, false); } if (win.mAppToken != null) { @@ -2970,7 +2952,7 @@ public class WindowManagerService extends IWindowManager.Stub Binder.restoreCallingIdentity(origId); return (inTouchMode ? WindowManagerImpl.RELAYOUT_RES_IN_TOUCH_MODE : 0) - | (displayed ? WindowManagerImpl.RELAYOUT_RES_FIRST_TIME : 0) + | (toBeDisplayed ? WindowManagerImpl.RELAYOUT_RES_FIRST_TIME : 0) | (surfaceChanged ? WindowManagerImpl.RELAYOUT_RES_SURFACE_CHANGED : 0) | (animating ? WindowManagerImpl.RELAYOUT_RES_ANIMATING : 0); } diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index 1fd80c2..e2a904f 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -679,8 +679,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { */ boolean isVisibleOrAdding() { final AppWindowToken atoken = mAppToken; - return ((mHasSurface && !mWinAnimator.mReportDestroySurface) - || (!mRelayoutCalled && mViewVisibility == View.VISIBLE)) + return (mHasSurface || (!mRelayoutCalled && mViewVisibility == View.VISIBLE)) && mPolicyVisibility && !mAttachedHidden && (atoken == null || !atoken.hiddenRequested) && !mExiting && !mDestroying; diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java index 5516dea..355db6e 100644 --- a/services/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/java/com/android/server/wm/WindowStateAnimator.java @@ -71,8 +71,6 @@ class WindowStateAnimator { Surface mSurface; Surface mPendingDestroySurface; - boolean mReportDestroySurface; - boolean mSurfacePendingDestroy; /** * Set when we have changed the size of the surface, to know that @@ -561,8 +559,6 @@ class WindowStateAnimator { Surface createSurfaceLocked() { if (mSurface == null) { - mReportDestroySurface = false; - mSurfacePendingDestroy = false; if (DEBUG_ANIM || DEBUG_ORIENTATION) Slog.i(TAG, "createSurface " + this + ": mDrawState=DRAW_PENDING"); mDrawState = DRAW_PENDING; @@ -694,7 +690,6 @@ class WindowStateAnimator { mWin.mAppToken.startingDisplayed = false; } - mDrawState = NO_SURFACE; if (mSurface != null) { int i = mWin.mChildWindows.size(); @@ -704,17 +699,6 @@ class WindowStateAnimator { c.mAttachedHidden = true; } - if (mReportDestroySurface) { - mReportDestroySurface = false; - mSurfacePendingDestroy = true; - try { - mWin.mClient.dispatchGetNewSurface(); - // We'll really destroy on the next time around. - return; - } catch (RemoteException e) { - } - } - try { if (DEBUG_VISIBILITY) { RuntimeException e = null; @@ -760,6 +744,7 @@ class WindowStateAnimator { mSurfaceShown = false; mSurface = null; mWin.mHasSurface =false; + mDrawState = NO_SURFACE; } } @@ -1147,7 +1132,7 @@ class WindowStateAnimator { } } else { if (DEBUG_ANIM) { - Slog.v(TAG, "prepareSurface: No changes in animation for " + mWin); + // Slog.v(TAG, "prepareSurface: No changes in animation for " + mWin); } displayed = true; } |
