Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 1 | // Copyright 2012 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | package com.android.server.wm; |
| 4 | |
| 5 | import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; |
Craig Mautner | f12100e | 2012-06-25 11:13:24 -0700 | [diff] [blame] | 6 | import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 7 | |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 8 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION; |
| 9 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE; |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 10 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_FORCE_HIDING_CHANGED; |
Craig Mautner | 2639da5 | 2012-07-09 09:39:06 -0700 | [diff] [blame] | 11 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_ORIENTATION_CHANGE_COMPLETE; |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 12 | |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 13 | import static com.android.server.wm.WindowManagerService.H.UPDATE_ANIM_PARAMETERS; |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 14 | |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 15 | import android.content.Context; |
| 16 | import android.os.SystemClock; |
| 17 | import android.util.Log; |
| 18 | import android.util.Slog; |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 19 | import android.util.SparseArray; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 20 | import android.util.SparseIntArray; |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 21 | import android.view.Display; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 22 | import android.view.Surface; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 23 | import android.view.WindowManagerPolicy; |
| 24 | import android.view.animation.Animation; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 25 | |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 26 | import com.android.server.wm.WindowManagerService.AppWindowAnimParams; |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 27 | import com.android.server.wm.WindowManagerService.LayoutToAnimatorParams; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 28 | |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 29 | import java.io.PrintWriter; |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 30 | import java.util.ArrayList; |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 31 | |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 32 | /** |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 33 | * Singleton class that carries out the animations and Surface operations in a separate task |
| 34 | * on behalf of WindowManagerService. |
| 35 | */ |
| 36 | public class WindowAnimator { |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 37 | private static final String TAG = "WindowAnimator"; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 38 | |
| 39 | final WindowManagerService mService; |
| 40 | final Context mContext; |
| 41 | final WindowManagerPolicy mPolicy; |
| 42 | |
| 43 | boolean mAnimating; |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 44 | |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 45 | final Runnable mAnimationRunnable; |
| 46 | |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 47 | int mAdjResult; |
| 48 | |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 49 | // Layout changes for individual Displays. Indexed by displayId. |
| 50 | SparseIntArray mPendingLayoutChanges = new SparseIntArray(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 51 | |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 52 | // TODO: Assign these from each iteration through DisplayContent. Only valid between loops. |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 53 | /** Overall window dimensions */ |
| 54 | int mDw, mDh; |
| 55 | |
| 56 | /** Interior window dimensions */ |
| 57 | int mInnerDw, mInnerDh; |
| 58 | |
| 59 | /** Time of current animation step. Reset on each iteration */ |
| 60 | long mCurrentTime; |
| 61 | |
| 62 | /** Skip repeated AppWindowTokens initialization. Note that AppWindowsToken's version of this |
| 63 | * is a long initialized to Long.MIN_VALUE so that it doesn't match this value on startup. */ |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 64 | private int mAnimTransactionSequence; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 65 | |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 66 | // Window currently running an animation that has requested it be detached |
| 67 | // from the wallpaper. This means we need to ensure the wallpaper is |
| 68 | // visible behind it in case it animates in a way that would allow it to be |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 69 | // seen. If multiple windows satisfy this, use the lowest window. |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 70 | WindowState mWindowDetachedWallpaper = null; |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 71 | |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 72 | WindowStateAnimator mUniverseBackground = null; |
| 73 | int mAboveUniverseLayer = 0; |
| 74 | |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 75 | int mBulkUpdateParams = 0; |
| 76 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 77 | SparseArray<DisplayContentsAnimator> mDisplayContentsAnimators = |
| 78 | new SparseArray<WindowAnimator.DisplayContentsAnimator>(); |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 79 | |
Craig Mautner | 4d7349b | 2012-04-20 14:52:47 -0700 | [diff] [blame] | 80 | static final int WALLPAPER_ACTION_PENDING = 1; |
| 81 | int mPendingActions; |
| 82 | |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 83 | WindowState mWallpaperTarget = null; |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 84 | AppWindowAnimator mWpAppAnimator = null; |
| 85 | WindowState mLowerWallpaperTarget = null; |
| 86 | WindowState mUpperWallpaperTarget = null; |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 87 | |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 88 | ArrayList<AppWindowAnimator> mAppAnimators = new ArrayList<AppWindowAnimator>(); |
| 89 | |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 90 | ArrayList<WindowToken> mWallpaperTokens = new ArrayList<WindowToken>(); |
| 91 | |
| 92 | /** Parameters being passed from this into mService. */ |
| 93 | static class AnimatorToLayoutParams { |
| 94 | boolean mUpdateQueued; |
| 95 | int mBulkUpdateParams; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 96 | SparseIntArray mPendingLayoutChanges; |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 97 | WindowState mWindowDetachedWallpaper; |
| 98 | } |
| 99 | /** Do not modify unless holding mService.mWindowMap or this and mAnimToLayout in that order */ |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 100 | final AnimatorToLayoutParams mAnimToLayout = new AnimatorToLayoutParams(); |
| 101 | |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 102 | boolean mInitialized = false; |
| 103 | |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 104 | // forceHiding states. |
| 105 | static final int KEYGUARD_NOT_SHOWN = 0; |
| 106 | static final int KEYGUARD_ANIMATING_IN = 1; |
| 107 | static final int KEYGUARD_SHOWN = 2; |
| 108 | static final int KEYGUARD_ANIMATING_OUT = 3; |
| 109 | int mForceHiding = KEYGUARD_NOT_SHOWN; |
| 110 | |
| 111 | private String forceHidingToString() { |
| 112 | switch (mForceHiding) { |
| 113 | case KEYGUARD_NOT_SHOWN: return "KEYGUARD_NOT_SHOWN"; |
| 114 | case KEYGUARD_ANIMATING_IN: return "KEYGUARD_ANIMATING_IN"; |
| 115 | case KEYGUARD_SHOWN: return "KEYGUARD_SHOWN"; |
| 116 | case KEYGUARD_ANIMATING_OUT:return "KEYGUARD_ANIMATING_OUT"; |
| 117 | default: return "KEYGUARD STATE UNKNOWN " + mForceHiding; |
| 118 | } |
| 119 | } |
| 120 | |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 121 | WindowAnimator(final WindowManagerService service) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 122 | mService = service; |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 123 | mContext = service.mContext; |
| 124 | mPolicy = service.mPolicy; |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 125 | |
| 126 | mAnimationRunnable = new Runnable() { |
| 127 | @Override |
| 128 | public void run() { |
| 129 | // TODO(cmautner): When full isolation is achieved for animation, the first lock |
| 130 | // goes away and only the WindowAnimator.this remains. |
| 131 | synchronized(mService.mWindowMap) { |
| 132 | synchronized(WindowAnimator.this) { |
| 133 | copyLayoutToAnimParamsLocked(); |
| 134 | animateLocked(); |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | }; |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 139 | } |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 140 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 141 | void addDisplayLocked(final int displayId) { |
| 142 | DisplayContentsAnimator displayAnimator = getDisplayContentsAnimatorLocked(displayId); |
| 143 | displayAnimator.mWindowAnimationBackgroundSurface = |
| 144 | new DimSurface(mService.mFxSession, displayId); |
| 145 | displayAnimator.mDimAnimator = new DimAnimator(mService.mFxSession, displayId); |
| 146 | if (displayId == Display.DEFAULT_DISPLAY) { |
| 147 | mInitialized = true; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | void removeDisplayLocked(final int displayId) { |
| 152 | mDisplayContentsAnimators.delete(displayId); |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 153 | } |
| 154 | |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 155 | /** Locked on mAnimToLayout */ |
| 156 | void updateAnimToLayoutLocked() { |
| 157 | final AnimatorToLayoutParams animToLayout = mAnimToLayout; |
| 158 | synchronized (animToLayout) { |
| 159 | animToLayout.mBulkUpdateParams = mBulkUpdateParams; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 160 | animToLayout.mPendingLayoutChanges = mPendingLayoutChanges.clone(); |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 161 | animToLayout.mWindowDetachedWallpaper = mWindowDetachedWallpaper; |
| 162 | |
| 163 | if (!animToLayout.mUpdateQueued) { |
| 164 | animToLayout.mUpdateQueued = true; |
| 165 | mService.mH.sendMessage(mService.mH.obtainMessage(UPDATE_ANIM_PARAMETERS)); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 170 | /** Copy all WindowManagerService params into local params here. Locked on 'this'. */ |
| 171 | private void copyLayoutToAnimParamsLocked() { |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 172 | final LayoutToAnimatorParams layoutToAnim = mService.mLayoutToAnim; |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 173 | synchronized(layoutToAnim) { |
| 174 | layoutToAnim.mAnimationScheduled = false; |
| 175 | |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 176 | if (!layoutToAnim.mParamsModified) { |
| 177 | return; |
| 178 | } |
| 179 | layoutToAnim.mParamsModified = false; |
| 180 | |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 181 | if ((layoutToAnim.mChanges & LayoutToAnimatorParams.WALLPAPER_TOKENS_CHANGED) != 0) { |
| 182 | layoutToAnim.mChanges &= ~LayoutToAnimatorParams.WALLPAPER_TOKENS_CHANGED; |
| 183 | mWallpaperTokens = new ArrayList<WindowToken>(layoutToAnim.mWallpaperTokens); |
| 184 | } |
| 185 | |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 186 | mWallpaperTarget = layoutToAnim.mWallpaperTarget; |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 187 | mWpAppAnimator = mWallpaperTarget == null |
| 188 | ? null : mWallpaperTarget.mAppToken == null |
| 189 | ? null : mWallpaperTarget.mAppToken.mAppAnimator; |
| 190 | mLowerWallpaperTarget = layoutToAnim.mLowerWallpaperTarget; |
| 191 | mUpperWallpaperTarget = layoutToAnim.mUpperWallpaperTarget; |
Craig Mautner | a76fdb7 | 2012-07-03 19:03:02 -0700 | [diff] [blame] | 192 | |
| 193 | // Set the new DimAnimator params. |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 194 | final int numDisplays = mDisplayContentsAnimators.size(); |
| 195 | for (int i = 0; i < numDisplays; i++) { |
| 196 | final int displayId = mDisplayContentsAnimators.keyAt(i); |
| 197 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i); |
Craig Mautner | a76fdb7 | 2012-07-03 19:03:02 -0700 | [diff] [blame] | 198 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 199 | displayAnimator.mWinAnimators.clear(); |
| 200 | final WinAnimatorList winAnimators = layoutToAnim.mWinAnimatorLists.get(displayId); |
| 201 | if (winAnimators != null) { |
| 202 | displayAnimator.mWinAnimators.addAll(winAnimators); |
| 203 | } |
| 204 | |
| 205 | DimAnimator.Parameters dimParams = layoutToAnim.mDimParams.get(displayId); |
| 206 | if (dimParams == null) { |
| 207 | displayAnimator.mDimParams = null; |
| 208 | } else { |
| 209 | final WindowStateAnimator newWinAnimator = dimParams.mDimWinAnimator; |
| 210 | |
| 211 | // Only set dim params on the highest dimmed layer. |
| 212 | final WindowStateAnimator existingDimWinAnimator = |
| 213 | displayAnimator.mDimParams == null ? |
| 214 | null : displayAnimator.mDimParams.mDimWinAnimator; |
| 215 | // Don't turn on for an unshown surface, or for any layer but the highest |
| 216 | // dimmed layer. |
| 217 | if (newWinAnimator.mSurfaceShown && (existingDimWinAnimator == null |
| 218 | || !existingDimWinAnimator.mSurfaceShown |
| 219 | || existingDimWinAnimator.mAnimLayer < newWinAnimator.mAnimLayer)) { |
| 220 | displayAnimator.mDimParams = new DimAnimator.Parameters(dimParams); |
| 221 | } |
Craig Mautner | a76fdb7 | 2012-07-03 19:03:02 -0700 | [diff] [blame] | 222 | } |
| 223 | } |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 224 | |
| 225 | mAppAnimators.clear(); |
| 226 | final int N = layoutToAnim.mAppWindowAnimParams.size(); |
| 227 | for (int i = 0; i < N; i++) { |
| 228 | final AppWindowAnimParams params = layoutToAnim.mAppWindowAnimParams.get(i); |
| 229 | AppWindowAnimator appAnimator = params.mAppAnimator; |
Craig Mautner | bea12bd | 2012-08-20 10:18:34 -0700 | [diff] [blame] | 230 | appAnimator.mAllAppWinAnimators.clear(); |
| 231 | appAnimator.mAllAppWinAnimators.addAll(params.mWinAnimators); |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 232 | mAppAnimators.add(appAnimator); |
| 233 | } |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 234 | } |
| 235 | } |
| 236 | |
Craig Mautner | b9836b9 | 2012-06-11 11:40:09 -0700 | [diff] [blame] | 237 | void hideWallpapersLocked(final WindowState w) { |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 238 | if ((mWallpaperTarget == w && mLowerWallpaperTarget == null) || mWallpaperTarget == null) { |
| 239 | final int numTokens = mWallpaperTokens.size(); |
| 240 | for (int i = numTokens - 1; i >= 0; i--) { |
| 241 | final WindowToken token = mWallpaperTokens.get(i); |
| 242 | final int numWindows = token.windows.size(); |
| 243 | for (int j = numWindows - 1; j >= 0; j--) { |
| 244 | final WindowState wallpaper = token.windows.get(j); |
Craig Mautner | b9836b9 | 2012-06-11 11:40:09 -0700 | [diff] [blame] | 245 | final WindowStateAnimator winAnimator = wallpaper.mWinAnimator; |
| 246 | if (!winAnimator.mLastHidden) { |
| 247 | winAnimator.hide(); |
Craig Mautner | 507a2ee | 2012-06-13 08:39:38 -0700 | [diff] [blame] | 248 | mService.dispatchWallpaperVisibility(wallpaper, false); |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 249 | setPendingLayoutChanges(Display.DEFAULT_DISPLAY, |
| 250 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); |
Craig Mautner | b9836b9 | 2012-06-11 11:40:09 -0700 | [diff] [blame] | 251 | } |
| 252 | } |
| 253 | token.hidden = true; |
Craig Mautner | 0afddcb | 2012-05-08 15:38:00 -0700 | [diff] [blame] | 254 | } |
Craig Mautner | 0afddcb | 2012-05-08 15:38:00 -0700 | [diff] [blame] | 255 | } |
| 256 | } |
| 257 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 258 | private void updateAppWindowsLocked() { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 259 | int i; |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 260 | final int NAT = mAppAnimators.size(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 261 | for (i=0; i<NAT; i++) { |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 262 | final AppWindowAnimator appAnimator = mAppAnimators.get(i); |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 263 | final boolean wasAnimating = appAnimator.animation != null |
Craig Mautner | fbf378c | 2012-04-23 17:24:21 -0700 | [diff] [blame] | 264 | && appAnimator.animation != AppWindowAnimator.sDummyAnimation; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 265 | if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 266 | mAnimating = true; |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 267 | } else if (wasAnimating) { |
| 268 | // stopped animating, do one more pass through the layout |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 269 | setAppLayoutChanges(appAnimator, WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER, |
| 270 | "appToken " + appAnimator.mAppToken + " done"); |
Craig Mautner | 83339b4 | 2012-05-01 22:13:23 -0700 | [diff] [blame] | 271 | if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG, |
| 272 | "updateWindowsApps...: done animating " + appAnimator.mAppToken); |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 273 | } |
| 274 | } |
Craig Mautner | a2c7705 | 2012-03-26 12:14:43 -0700 | [diff] [blame] | 275 | |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 276 | final int NEAT = mService.mExitingAppTokens.size(); |
| 277 | for (i=0; i<NEAT; i++) { |
Craig Mautner | e4d8a5d | 2012-04-05 13:10:37 -0700 | [diff] [blame] | 278 | final AppWindowAnimator appAnimator = mService.mExitingAppTokens.get(i).mAppAnimator; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 279 | final boolean wasAnimating = appAnimator.animation != null |
Craig Mautner | fbf378c | 2012-04-23 17:24:21 -0700 | [diff] [blame] | 280 | && appAnimator.animation != AppWindowAnimator.sDummyAnimation; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 281 | if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) { |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 282 | mAnimating = true; |
| 283 | } else if (wasAnimating) { |
| 284 | // stopped animating, do one more pass through the layout |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 285 | setAppLayoutChanges(appAnimator, WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER, |
| 286 | "exiting appToken " + appAnimator.mAppToken + " done"); |
Craig Mautner | 83339b4 | 2012-05-01 22:13:23 -0700 | [diff] [blame] | 287 | if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG, |
| 288 | "updateWindowsApps...: done animating exiting " + appAnimator.mAppToken); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 289 | } |
| 290 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 291 | } |
| 292 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 293 | private void updateWindowsLocked(final int displayId) { |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 294 | ++mAnimTransactionSequence; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 295 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 296 | final WinAnimatorList winAnimatorList = |
| 297 | getDisplayContentsAnimatorLocked(displayId).mWinAnimators; |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 298 | ArrayList<WindowStateAnimator> unForceHiding = null; |
| 299 | boolean wallpaperInUnForceHiding = false; |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 300 | mForceHiding = KEYGUARD_NOT_SHOWN; |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 301 | |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 302 | for (int i = winAnimatorList.size() - 1; i >= 0; i--) { |
| 303 | WindowStateAnimator winAnimator = winAnimatorList.get(i); |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 304 | WindowState win = winAnimator.mWin; |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 305 | final int flags = winAnimator.mAttrFlags; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 306 | |
Craig Mautner | c2f9be0 | 2012-03-27 17:32:29 -0700 | [diff] [blame] | 307 | if (winAnimator.mSurface != null) { |
Craig Mautner | a2c7705 | 2012-03-26 12:14:43 -0700 | [diff] [blame] | 308 | final boolean wasAnimating = winAnimator.mWasAnimating; |
| 309 | final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 310 | |
| 311 | if (WindowManagerService.DEBUG_WALLPAPER) { |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 312 | Slog.v(TAG, win + ": wasAnimating=" + wasAnimating + |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 313 | ", nowAnimating=" + nowAnimating); |
| 314 | } |
| 315 | |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 316 | if (wasAnimating && !winAnimator.mAnimating && mWallpaperTarget == win) { |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 317 | mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 318 | setPendingLayoutChanges(Display.DEFAULT_DISPLAY, |
| 319 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 320 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 321 | mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2", |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 322 | mPendingLayoutChanges.get(Display.DEFAULT_DISPLAY)); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 323 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 324 | } |
| 325 | |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 326 | if (mPolicy.doesForceHide(win, win.mAttrs)) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 327 | if (!wasAnimating && nowAnimating) { |
Craig Mautner | 83339b4 | 2012-05-01 22:13:23 -0700 | [diff] [blame] | 328 | if (WindowManagerService.DEBUG_ANIM || |
| 329 | WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, |
| 330 | "Animation started that could impact force hide: " + win); |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 331 | mBulkUpdateParams |= SET_FORCE_HIDING_CHANGED; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 332 | setPendingLayoutChanges(displayId, |
| 333 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 334 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 335 | mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 3", |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 336 | mPendingLayoutChanges.get(displayId)); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 337 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 338 | mService.mFocusMayChange = true; |
Dianne Hackborn | ac92087 | 2012-05-22 11:49:49 -0700 | [diff] [blame] | 339 | } |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 340 | if (win.isReadyForDisplay()) { |
| 341 | if (nowAnimating) { |
| 342 | if (winAnimator.mAnimationIsEntrance) { |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 343 | mForceHiding = KEYGUARD_ANIMATING_IN; |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 344 | } else { |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 345 | mForceHiding = KEYGUARD_ANIMATING_OUT; |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 346 | } |
| 347 | } else { |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 348 | mForceHiding = KEYGUARD_SHOWN; |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 349 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 350 | } |
Dianne Hackborn | ac92087 | 2012-05-22 11:49:49 -0700 | [diff] [blame] | 351 | if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 352 | "Force hide " + mForceHiding |
Dianne Hackborn | ac92087 | 2012-05-22 11:49:49 -0700 | [diff] [blame] | 353 | + " hasSurface=" + win.mHasSurface |
| 354 | + " policyVis=" + win.mPolicyVisibility |
| 355 | + " destroying=" + win.mDestroying |
| 356 | + " attHidden=" + win.mAttachedHidden |
| 357 | + " vis=" + win.mViewVisibility |
| 358 | + " hidden=" + win.mRootToken.hidden |
| 359 | + " anim=" + win.mWinAnimator.mAnimation); |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 360 | } else if (mPolicy.canBeForceHidden(win, win.mAttrs)) { |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 361 | final boolean hideWhenLocked = |
| 362 | (winAnimator.mAttrFlags & FLAG_SHOW_WHEN_LOCKED) == 0; |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 363 | final boolean changed; |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 364 | if (((mForceHiding == KEYGUARD_ANIMATING_IN) |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 365 | && (!winAnimator.isAnimating() || hideWhenLocked)) |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 366 | || ((mForceHiding == KEYGUARD_SHOWN) && hideWhenLocked)) { |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 367 | changed = win.hideLw(false, false); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 368 | if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG, |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 369 | "Now policy hidden: " + win); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 370 | } else { |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 371 | changed = win.showLw(false, false); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 372 | if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG, |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 373 | "Now policy shown: " + win); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 374 | if (changed) { |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 375 | if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0 |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 376 | && win.isVisibleNow() /*w.isReadyForDisplay()*/) { |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 377 | if (unForceHiding == null) { |
| 378 | unForceHiding = new ArrayList<WindowStateAnimator>(); |
| 379 | } |
| 380 | unForceHiding.add(winAnimator); |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 381 | if ((flags & FLAG_SHOW_WALLPAPER) != 0) { |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 382 | wallpaperInUnForceHiding = true; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 383 | } |
| 384 | } |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 385 | if (mCurrentFocus == null || mCurrentFocus.mLayer < win.mLayer) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 386 | // We are showing on to of the current |
| 387 | // focus, so re-evaluate focus to make |
| 388 | // sure it is correct. |
| 389 | mService.mFocusMayChange = true; |
| 390 | } |
| 391 | } |
| 392 | } |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 393 | if (changed && (flags & FLAG_SHOW_WALLPAPER) != 0) { |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 394 | mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 395 | setPendingLayoutChanges(Display.DEFAULT_DISPLAY, |
| 396 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 397 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 398 | mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4", |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 399 | mPendingLayoutChanges.get(Display.DEFAULT_DISPLAY)); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 400 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 401 | } |
| 402 | } |
| 403 | } |
| 404 | |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 405 | final AppWindowToken atoken = win.mAppToken; |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 406 | if (winAnimator.mDrawState == WindowStateAnimator.READY_TO_SHOW) { |
| 407 | if (atoken == null || atoken.allDrawn) { |
| 408 | if (winAnimator.performShowLocked()) { |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 409 | mPendingLayoutChanges.put(displayId, |
| 410 | WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 411 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
| 412 | mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 5", |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 413 | mPendingLayoutChanges.get(displayId)); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 414 | } |
| 415 | } |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 416 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 417 | } |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 418 | final AppWindowAnimator appAnimator = winAnimator.mAppAnimator; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 419 | if (appAnimator != null && appAnimator.thumbnail != null) { |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 420 | if (appAnimator.thumbnailTransactionSeq != mAnimTransactionSequence) { |
| 421 | appAnimator.thumbnailTransactionSeq = mAnimTransactionSequence; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 422 | appAnimator.thumbnailLayer = 0; |
Dianne Hackborn | 8078d8c | 2012-03-20 11:11:26 -0700 | [diff] [blame] | 423 | } |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 424 | if (appAnimator.thumbnailLayer < winAnimator.mAnimLayer) { |
| 425 | appAnimator.thumbnailLayer = winAnimator.mAnimLayer; |
Dianne Hackborn | 8078d8c | 2012-03-20 11:11:26 -0700 | [diff] [blame] | 426 | } |
| 427 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 428 | } // end forall windows |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 429 | |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 430 | // If we have windows that are being show due to them no longer |
| 431 | // being force-hidden, apply the appropriate animation to them. |
| 432 | if (unForceHiding != null) { |
| 433 | for (int i=unForceHiding.size()-1; i>=0; i--) { |
| 434 | Animation a = mPolicy.createForceHideEnterAnimation(wallpaperInUnForceHiding); |
| 435 | if (a != null) { |
| 436 | final WindowStateAnimator winAnimator = unForceHiding.get(i); |
| 437 | winAnimator.setAnimation(a); |
| 438 | winAnimator.mAnimationIsEntrance = true; |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | } |
| 443 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 444 | private void updateWallpaperLocked(int displayId) { |
| 445 | final DisplayContentsAnimator displayAnimator = |
| 446 | getDisplayContentsAnimatorLocked(displayId); |
| 447 | final WinAnimatorList winAnimatorList = displayAnimator.mWinAnimators; |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 448 | WindowStateAnimator windowAnimationBackground = null; |
| 449 | int windowAnimationBackgroundColor = 0; |
| 450 | WindowState detachedWallpaper = null; |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 451 | final DimSurface windowAnimationBackgroundSurface = |
| 452 | displayAnimator.mWindowAnimationBackgroundSurface; |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 453 | |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 454 | for (int i = winAnimatorList.size() - 1; i >= 0; i--) { |
| 455 | WindowStateAnimator winAnimator = winAnimatorList.get(i); |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 456 | if (winAnimator.mSurface == null) { |
| 457 | continue; |
| 458 | } |
| 459 | |
| 460 | final int flags = winAnimator.mAttrFlags; |
| 461 | final WindowState win = winAnimator.mWin; |
| 462 | |
| 463 | // If this window is animating, make a note that we have |
| 464 | // an animating window and take care of a request to run |
| 465 | // a detached wallpaper animation. |
| 466 | if (winAnimator.mAnimating) { |
| 467 | if (winAnimator.mAnimation != null) { |
| 468 | if ((flags & FLAG_SHOW_WALLPAPER) != 0 |
| 469 | && winAnimator.mAnimation.getDetachWallpaper()) { |
| 470 | detachedWallpaper = win; |
| 471 | } |
| 472 | final int backgroundColor = winAnimator.mAnimation.getBackgroundColor(); |
| 473 | if (backgroundColor != 0) { |
| 474 | if (windowAnimationBackground == null || (winAnimator.mAnimLayer < |
| 475 | windowAnimationBackground.mAnimLayer)) { |
| 476 | windowAnimationBackground = winAnimator; |
| 477 | windowAnimationBackgroundColor = backgroundColor; |
| 478 | } |
| 479 | } |
| 480 | } |
| 481 | mAnimating = true; |
| 482 | } |
| 483 | |
| 484 | // If this window's app token is running a detached wallpaper |
| 485 | // animation, make a note so we can ensure the wallpaper is |
| 486 | // displayed behind it. |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 487 | final AppWindowAnimator appAnimator = winAnimator.mAppAnimator; |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 488 | if (appAnimator != null && appAnimator.animation != null |
| 489 | && appAnimator.animating) { |
| 490 | if ((flags & FLAG_SHOW_WALLPAPER) != 0 |
| 491 | && appAnimator.animation.getDetachWallpaper()) { |
| 492 | detachedWallpaper = win; |
| 493 | } |
| 494 | |
| 495 | final int backgroundColor = appAnimator.animation.getBackgroundColor(); |
| 496 | if (backgroundColor != 0) { |
| 497 | if (windowAnimationBackground == null || (winAnimator.mAnimLayer < |
| 498 | windowAnimationBackground.mAnimLayer)) { |
| 499 | windowAnimationBackground = winAnimator; |
| 500 | windowAnimationBackgroundColor = backgroundColor; |
| 501 | } |
| 502 | } |
| 503 | } |
| 504 | } // end forall windows |
| 505 | |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 506 | if (mWindowDetachedWallpaper != detachedWallpaper) { |
| 507 | if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG, |
| 508 | "Detached wallpaper changed from " + mWindowDetachedWallpaper |
| 509 | + " to " + detachedWallpaper); |
| 510 | mWindowDetachedWallpaper = detachedWallpaper; |
| 511 | mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; |
| 512 | } |
| 513 | |
| 514 | if (windowAnimationBackgroundColor != 0) { |
| 515 | // If the window that wants black is the current wallpaper |
| 516 | // target, then the black goes *below* the wallpaper so we |
| 517 | // don't cause the wallpaper to suddenly disappear. |
| 518 | int animLayer = windowAnimationBackground.mAnimLayer; |
| 519 | WindowState win = windowAnimationBackground.mWin; |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 520 | if (mWallpaperTarget == win |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 521 | || mLowerWallpaperTarget == win || mUpperWallpaperTarget == win) { |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 522 | final int N = winAnimatorList.size(); |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 523 | for (int i = 0; i < N; i++) { |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 524 | WindowStateAnimator winAnimator = winAnimatorList.get(i); |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 525 | if (winAnimator.mIsWallpaper) { |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 526 | animLayer = winAnimator.mAnimLayer; |
| 527 | break; |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 532 | windowAnimationBackgroundSurface.show(mDw, mDh, |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 533 | animLayer - WindowManagerService.LAYER_OFFSET_DIM, |
| 534 | windowAnimationBackgroundColor); |
| 535 | } else { |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 536 | windowAnimationBackgroundSurface.hide(); |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 537 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 538 | } |
| 539 | |
| 540 | private void testTokenMayBeDrawnLocked() { |
| 541 | // See if any windows have been drawn, so they (and others |
| 542 | // associated with them) can now be shown. |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 543 | final int NT = mAppAnimators.size(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 544 | for (int i=0; i<NT; i++) { |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 545 | AppWindowAnimator appAnimator = mAppAnimators.get(i); |
| 546 | AppWindowToken wtoken = appAnimator.mAppToken; |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 547 | final boolean allDrawn = wtoken.allDrawn; |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 548 | if (allDrawn != appAnimator.allDrawn) { |
| 549 | appAnimator.allDrawn = allDrawn; |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 550 | if (allDrawn) { |
| 551 | // The token has now changed state to having all |
| 552 | // windows shown... what to do, what to do? |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 553 | if (appAnimator.freezingScreen) { |
| 554 | appAnimator.showAllWindowsLocked(); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 555 | mService.unsetAppFreezingScreenLocked(wtoken, false, true); |
| 556 | if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(TAG, |
| 557 | "Setting mOrientationChangeComplete=true because wtoken " |
| 558 | + wtoken + " numInteresting=" + wtoken.numInterestingWindows |
| 559 | + " numDrawn=" + wtoken.numDrawnWindows); |
| 560 | // This will set mOrientationChangeComplete and cause a pass through layout. |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 561 | setAppLayoutChanges(appAnimator, |
| 562 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER, |
| 563 | "testTokenMayBeDrawnLocked: freezingScreen"); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 564 | } else { |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 565 | setAppLayoutChanges(appAnimator, |
| 566 | WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM, |
| 567 | "testTokenMayBeDrawnLocked"); |
| 568 | |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 569 | // We can now show all of the drawn windows! |
| 570 | if (!mService.mOpeningApps.contains(wtoken)) { |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 571 | mAnimating |= appAnimator.showAllWindowsLocked(); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 572 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 573 | } |
| 574 | } |
| 575 | } |
| 576 | } |
| 577 | } |
| 578 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 579 | private void performAnimationsLocked(final int displayId) { |
| 580 | updateWindowsLocked(displayId); |
| 581 | updateWallpaperLocked(displayId); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 582 | } |
| 583 | |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 584 | // TODO(cmautner): Change the following comment when no longer locked on mWindowMap */ |
| 585 | /** Locked on mService.mWindowMap and this. */ |
| 586 | private void animateLocked() { |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 587 | if (!mInitialized) { |
| 588 | return; |
| 589 | } |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 590 | |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 591 | mPendingLayoutChanges.clear(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 592 | mCurrentTime = SystemClock.uptimeMillis(); |
Craig Mautner | 2639da5 | 2012-07-09 09:39:06 -0700 | [diff] [blame] | 593 | mBulkUpdateParams = SET_ORIENTATION_CHANGE_COMPLETE; |
Chet Haase | 198e564 | 2012-05-10 09:55:15 -0700 | [diff] [blame] | 594 | boolean wasAnimating = mAnimating; |
Craig Mautner | 7d8df39 | 2012-04-06 15:26:23 -0700 | [diff] [blame] | 595 | mAnimating = false; |
| 596 | if (WindowManagerService.DEBUG_WINDOW_TRACE) { |
| 597 | Slog.i(TAG, "!!! animate: entry time=" + mCurrentTime); |
| 598 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 599 | |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 600 | if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i( |
| 601 | TAG, ">>> OPEN TRANSACTION animateLocked"); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 602 | Surface.openTransaction(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 603 | try { |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 604 | updateAppWindowsLocked(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 605 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 606 | final int numDisplays = mDisplayContentsAnimators.size(); |
| 607 | for (int i = 0; i < numDisplays; i++) { |
| 608 | final int displayId = mDisplayContentsAnimators.keyAt(i); |
| 609 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i); |
| 610 | |
| 611 | final ScreenRotationAnimation screenRotationAnimation = |
| 612 | displayAnimator.mScreenRotationAnimation; |
| 613 | if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) { |
| 614 | if (screenRotationAnimation.stepAnimationLocked(mCurrentTime)) { |
| 615 | mAnimating = true; |
| 616 | } else { |
| 617 | mBulkUpdateParams |= SET_UPDATE_ROTATION; |
| 618 | screenRotationAnimation.kill(); |
| 619 | displayAnimator.mScreenRotationAnimation = null; |
| 620 | } |
| 621 | } |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 622 | |
| 623 | // Update animations of all applications, including those |
| 624 | // associated with exiting/removed apps |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 625 | performAnimationsLocked(displayId); |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 626 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 627 | final WinAnimatorList winAnimatorList = displayAnimator.mWinAnimators; |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 628 | final int N = winAnimatorList.size(); |
| 629 | for (int j = 0; j < N; j++) { |
| 630 | winAnimatorList.get(j).prepareSurfaceLocked(true); |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | testTokenMayBeDrawnLocked(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 635 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 636 | for (int i = 0; i < numDisplays; i++) { |
| 637 | final int displayId = mDisplayContentsAnimators.keyAt(i); |
| 638 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 639 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 640 | final ScreenRotationAnimation screenRotationAnimation = |
| 641 | displayAnimator.mScreenRotationAnimation; |
| 642 | if (screenRotationAnimation != null) { |
| 643 | screenRotationAnimation.updateSurfacesInTransaction(); |
| 644 | } |
| 645 | |
| 646 | final DimAnimator.Parameters dimParams = displayAnimator.mDimParams; |
| 647 | final DimAnimator dimAnimator = displayAnimator.mDimAnimator; |
| 648 | if (dimParams != null) { |
| 649 | dimAnimator.updateParameters( |
| 650 | mContext.getResources(), dimParams, mCurrentTime); |
| 651 | } |
| 652 | if (dimAnimator != null && dimAnimator.mDimShown) { |
| 653 | mAnimating |= dimAnimator.updateSurface(isDimmingLocked(displayId), |
| 654 | mCurrentTime, !mService.okToDisplay()); |
| 655 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 656 | } |
| 657 | |
Craig Mautner | 7358fbf | 2012-04-12 21:06:33 -0700 | [diff] [blame] | 658 | if (mService.mWatermark != null) { |
| 659 | mService.mWatermark.drawIfNeeded(); |
| 660 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 661 | } catch (RuntimeException e) { |
| 662 | Log.wtf(TAG, "Unhandled exception in Window Manager", e); |
| 663 | } finally { |
| 664 | Surface.closeTransaction(); |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 665 | if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i( |
| 666 | TAG, "<<< CLOSE TRANSACTION animateLocked"); |
| 667 | } |
| 668 | |
| 669 | for (int i = mPendingLayoutChanges.size() - 1; i >= 0; i--) { |
| 670 | if ((mPendingLayoutChanges.valueAt(i) |
| 671 | & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) { |
| 672 | mPendingActions |= WALLPAPER_ACTION_PENDING; |
| 673 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 674 | } |
Craig Mautner | c2f9be0 | 2012-03-27 17:32:29 -0700 | [diff] [blame] | 675 | |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 676 | if (mBulkUpdateParams != 0 || mPendingLayoutChanges.size() > 0) { |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 677 | updateAnimToLayoutLocked(); |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 678 | } |
Craig Mautner | 7d8df39 | 2012-04-06 15:26:23 -0700 | [diff] [blame] | 679 | |
| 680 | if (mAnimating) { |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 681 | synchronized (mService.mLayoutToAnim) { |
| 682 | mService.scheduleAnimationLocked(); |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 683 | } |
Chet Haase | 198e564 | 2012-05-10 09:55:15 -0700 | [diff] [blame] | 684 | } else if (wasAnimating) { |
| 685 | mService.requestTraversalLocked(); |
Craig Mautner | 7d8df39 | 2012-04-06 15:26:23 -0700 | [diff] [blame] | 686 | } |
| 687 | if (WindowManagerService.DEBUG_WINDOW_TRACE) { |
| 688 | Slog.i(TAG, "!!! animate: exit mAnimating=" + mAnimating |
| 689 | + " mBulkUpdateParams=" + Integer.toHexString(mBulkUpdateParams) |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 690 | + " mPendingLayoutChanges(DEFAULT_DISPLAY)=" |
| 691 | + Integer.toHexString(mPendingLayoutChanges.get(Display.DEFAULT_DISPLAY))); |
Craig Mautner | 7d8df39 | 2012-04-06 15:26:23 -0700 | [diff] [blame] | 692 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 693 | } |
| 694 | |
| 695 | WindowState mCurrentFocus; |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 696 | void setCurrentFocus(final WindowState currentFocus) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 697 | mCurrentFocus = currentFocus; |
| 698 | } |
| 699 | |
| 700 | void setDisplayDimensions(final int curWidth, final int curHeight, |
| 701 | final int appWidth, final int appHeight) { |
| 702 | mDw = curWidth; |
| 703 | mDh = curHeight; |
| 704 | mInnerDw = appWidth; |
| 705 | mInnerDh = appHeight; |
| 706 | } |
| 707 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 708 | boolean isDimmingLocked(int displayId) { |
| 709 | return getDisplayContentsAnimatorLocked(displayId).mDimParams != null; |
Craig Mautner | f8d4fbb | 2012-04-11 09:25:53 -0700 | [diff] [blame] | 710 | } |
| 711 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 712 | boolean isDimmingLocked(final WindowStateAnimator winAnimator) { |
| 713 | DimAnimator.Parameters dimParams = |
| 714 | getDisplayContentsAnimatorLocked(winAnimator.mWin.getDisplayId()).mDimParams; |
| 715 | return dimParams != null && dimParams.mDimWinAnimator == winAnimator; |
Craig Mautner | acafd19 | 2012-05-10 10:41:02 -0700 | [diff] [blame] | 716 | } |
| 717 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 718 | public void dumpLocked(PrintWriter pw, String prefix, boolean dumpAll) { |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 719 | if (dumpAll) { |
| 720 | if (mWindowDetachedWallpaper != null) { |
| 721 | pw.print(prefix); pw.print("mWindowDetachedWallpaper="); |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 722 | pw.println(mWindowDetachedWallpaper); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 723 | } |
| 724 | pw.print(prefix); pw.print("mAnimTransactionSequence="); |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame^] | 725 | pw.print(mAnimTransactionSequence); |
| 726 | pw.println(" mForceHiding=" + forceHidingToString()); |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 727 | for (int i = 0; i < mDisplayContentsAnimators.size(); i++) { |
| 728 | pw.print(prefix); pw.print("DisplayContentsAnimator #"); |
| 729 | pw.println(mDisplayContentsAnimators.keyAt(i)); |
| 730 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i); |
| 731 | final String subPrefix = " " + prefix; |
| 732 | final String subSubPrefix = " " + subPrefix; |
| 733 | if (displayAnimator.mWindowAnimationBackgroundSurface != null) { |
| 734 | pw.println(subPrefix + "mWindowAnimationBackgroundSurface:"); |
| 735 | displayAnimator.mWindowAnimationBackgroundSurface.printTo(subSubPrefix, pw); |
| 736 | } |
| 737 | if (displayAnimator.mDimAnimator != null) { |
| 738 | pw.println(subPrefix + "mDimAnimator:"); |
| 739 | displayAnimator.mDimAnimator.printTo(subSubPrefix, pw); |
| 740 | } else { |
| 741 | pw.println(subPrefix + "no DimAnimator "); |
| 742 | } |
| 743 | if (displayAnimator.mDimParams != null) { |
| 744 | pw.println(subPrefix + "mDimParams:"); |
| 745 | displayAnimator.mDimParams.printTo(subSubPrefix, pw); |
| 746 | } else { |
| 747 | pw.println(subPrefix + "no DimParams "); |
| 748 | } |
| 749 | if (displayAnimator.mScreenRotationAnimation != null) { |
| 750 | pw.println(subPrefix + "mScreenRotationAnimation:"); |
| 751 | displayAnimator.mScreenRotationAnimation.printTo(subSubPrefix, pw); |
| 752 | } else { |
| 753 | pw.print(subPrefix + "no ScreenRotationAnimation "); |
| 754 | } |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 755 | } |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 756 | pw.println(); |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 757 | } |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 758 | } |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 759 | |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 760 | void clearPendingActions() { |
| 761 | synchronized (this) { |
| 762 | mPendingActions = 0; |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | void setPendingLayoutChanges(final int displayId, final int changes) { |
| 767 | mPendingLayoutChanges.put(displayId, mPendingLayoutChanges.get(displayId) | changes); |
| 768 | } |
| 769 | |
| 770 | void setAppLayoutChanges(final AppWindowAnimator appAnimator, final int changes, String s) { |
| 771 | // Used to track which displays layout changes have been done. |
| 772 | SparseIntArray displays = new SparseIntArray(); |
| 773 | for (int i = appAnimator.mAllAppWinAnimators.size() - 1; i >= 0; i--) { |
| 774 | WindowStateAnimator winAnimator = appAnimator.mAllAppWinAnimators.get(i); |
| 775 | final int displayId = winAnimator.mWin.mDisplayContent.getDisplayId(); |
| 776 | if (displays.indexOfKey(displayId) < 0) { |
| 777 | setPendingLayoutChanges(displayId, changes); |
| 778 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
| 779 | mService.debugLayoutRepeats(s, mPendingLayoutChanges.get(displayId)); |
| 780 | } |
| 781 | // Keep from processing this display again. |
| 782 | displays.put(displayId, changes); |
| 783 | } |
| 784 | } |
Craig Mautner | 4d7349b | 2012-04-20 14:52:47 -0700 | [diff] [blame] | 785 | } |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 786 | |
| 787 | private DisplayContentsAnimator getDisplayContentsAnimatorLocked(int displayId) { |
| 788 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.get(displayId); |
| 789 | if (displayAnimator == null) { |
| 790 | displayAnimator = new DisplayContentsAnimator(); |
| 791 | mDisplayContentsAnimators.put(displayId, displayAnimator); |
| 792 | } |
| 793 | return displayAnimator; |
| 794 | } |
| 795 | |
| 796 | void setScreenRotationAnimationLocked(int displayId, ScreenRotationAnimation animation) { |
| 797 | getDisplayContentsAnimatorLocked(displayId).mScreenRotationAnimation = animation; |
| 798 | } |
| 799 | |
| 800 | ScreenRotationAnimation getScreenRotationAnimationLocked(int displayId) { |
| 801 | return getDisplayContentsAnimatorLocked(displayId).mScreenRotationAnimation; |
| 802 | } |
| 803 | |
| 804 | private static class DisplayContentsAnimator { |
| 805 | WinAnimatorList mWinAnimators = new WinAnimatorList(); |
| 806 | DimAnimator mDimAnimator = null; |
| 807 | DimAnimator.Parameters mDimParams = null; |
| 808 | DimSurface mWindowAnimationBackgroundSurface = null; |
| 809 | ScreenRotationAnimation mScreenRotationAnimation = null; |
| 810 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 811 | } |