blob: 26f4d0d663f0be8269db42d1331507a78d97da8f [file] [log] [blame]
Craig Mautner764983d2012-03-22 11:37:36 -07001// Copyright 2012 Google Inc. All Rights Reserved.
2
3package com.android.server.wm;
4
5import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
6
Craig Mautnera608b882012-03-30 13:03:49 -07007import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION;
8import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE;
9
Craig Mautner764983d2012-03-22 11:37:36 -070010import android.content.Context;
11import android.os.SystemClock;
12import android.util.Log;
13import android.util.Slog;
14import android.view.Surface;
15import android.view.WindowManager;
Craig Mautner764983d2012-03-22 11:37:36 -070016import android.view.WindowManagerPolicy;
17import android.view.animation.Animation;
Craig Mautner764983d2012-03-22 11:37:36 -070018
19import com.android.internal.policy.impl.PhoneWindowManager;
20
Craig Mautnere7ae2502012-03-26 17:11:19 -070021import java.io.PrintWriter;
22
Craig Mautner764983d2012-03-22 11:37:36 -070023/**
24 * @author cmautner@google.com (Craig Mautner)
25 * Singleton class that carries out the animations and Surface operations in a separate task
26 * on behalf of WindowManagerService.
27 */
28public class WindowAnimator {
Craig Mautnerbb1449b2012-03-23 16:11:14 -070029 private static final String TAG = "WindowAnimator";
Craig Mautner764983d2012-03-22 11:37:36 -070030
31 final WindowManagerService mService;
32 final Context mContext;
33 final WindowManagerPolicy mPolicy;
34
35 boolean mAnimating;
Craig Mautner764983d2012-03-22 11:37:36 -070036 boolean mTokenMayBeDrawn;
37 boolean mForceHiding;
38 WindowState mWindowAnimationBackground;
39 int mWindowAnimationBackgroundColor;
40 int mAdjResult;
41
42 int mPendingLayoutChanges;
43
44 /** Overall window dimensions */
45 int mDw, mDh;
46
47 /** Interior window dimensions */
48 int mInnerDw, mInnerDh;
49
50 /** Time of current animation step. Reset on each iteration */
51 long mCurrentTime;
52
53 /** Skip repeated AppWindowTokens initialization. Note that AppWindowsToken's version of this
54 * is a long initialized to Long.MIN_VALUE so that it doesn't match this value on startup. */
55 private int mTransactionSequence;
56
57 /** The one and only screen rotation if one is happening */
58 ScreenRotationAnimation mScreenRotationAnimation = null;
59
Craig Mautnere7ae2502012-03-26 17:11:19 -070060 // Window currently running an animation that has requested it be detached
61 // from the wallpaper. This means we need to ensure the wallpaper is
62 // visible behind it in case it animates in a way that would allow it to be
63 // seen.
64 WindowState mWindowDetachedWallpaper = null;
65 WindowState mDetachedWallpaper = null;
Craig Mautnere7ae2502012-03-26 17:11:19 -070066 DimSurface mWindowAnimationBackgroundSurface = null;
67
Craig Mautnera608b882012-03-30 13:03:49 -070068 int mBulkUpdateParams = 0;
69
Craig Mautner764983d2012-03-22 11:37:36 -070070 WindowAnimator(final WindowManagerService service, final Context context,
71 final WindowManagerPolicy policy) {
72 mService = service;
73 mContext = context;
74 mPolicy = policy;
75 }
76
Craig Mautnere7ae2502012-03-26 17:11:19 -070077 private void testWallpaperAndBackgroundLocked() {
78 if (mWindowDetachedWallpaper != mDetachedWallpaper) {
79 if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG,
80 "Detached wallpaper changed from " + mWindowDetachedWallpaper
81 + " to " + mDetachedWallpaper);
82 mWindowDetachedWallpaper = mDetachedWallpaper;
Craig Mautnera608b882012-03-30 13:03:49 -070083 mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE;
Craig Mautnere7ae2502012-03-26 17:11:19 -070084 }
85
86 if (mWindowAnimationBackgroundColor != 0) {
87 // If the window that wants black is the current wallpaper
88 // target, then the black goes *below* the wallpaper so we
89 // don't cause the wallpaper to suddenly disappear.
90 WindowState target = mWindowAnimationBackground;
91 if (mService.mWallpaperTarget == target
92 || mService.mLowerWallpaperTarget == target
93 || mService.mUpperWallpaperTarget == target) {
94 for (int i=0; i<mService.mWindows.size(); i++) {
95 WindowState w = mService.mWindows.get(i);
96 if (w.mIsWallpaper) {
97 target = w;
98 break;
99 }
100 }
101 }
102 if (mWindowAnimationBackgroundSurface == null) {
103 mWindowAnimationBackgroundSurface = new DimSurface(mService.mFxSession);
104 }
105 final int dw = mDw;
106 final int dh = mDh;
107 mWindowAnimationBackgroundSurface.show(dw, dh,
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700108 target.mWinAnimator.mAnimLayer - WindowManagerService.LAYER_OFFSET_DIM,
Craig Mautnere7ae2502012-03-26 17:11:19 -0700109 mWindowAnimationBackgroundColor);
110 } else if (mWindowAnimationBackgroundSurface != null) {
111 mWindowAnimationBackgroundSurface.hide();
112 }
113 }
114
Craig Mautner764983d2012-03-22 11:37:36 -0700115 private void updateWindowsAppsAndRotationAnimationsLocked() {
116 int i;
117 final int NAT = mService.mAppTokens.size();
118 for (i=0; i<NAT; i++) {
119 final AppWindowToken appToken = mService.mAppTokens.get(i);
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700120 final boolean wasAnimating = appToken.animation != null
121 && appToken.animation != WindowManagerService.sDummyAnimation;
Craig Mautner764983d2012-03-22 11:37:36 -0700122 if (appToken.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
123 mAnimating = true;
Craig Mautnerbb1449b2012-03-23 16:11:14 -0700124 } else if (wasAnimating) {
125 // stopped animating, do one more pass through the layout
126 mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700127 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
128 mService.debugLayoutRepeats("appToken " + appToken + " done");
129 }
Craig Mautnerbb1449b2012-03-23 16:11:14 -0700130 }
131 }
Craig Mautnera2c77052012-03-26 12:14:43 -0700132
Craig Mautnerbb1449b2012-03-23 16:11:14 -0700133 final int NEAT = mService.mExitingAppTokens.size();
134 for (i=0; i<NEAT; i++) {
135 final AppWindowToken appToken = mService.mExitingAppTokens.get(i);
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700136 final boolean wasAnimating = appToken.animation != null
137 && appToken.animation != WindowManagerService.sDummyAnimation;
Craig Mautnerbb1449b2012-03-23 16:11:14 -0700138 if (appToken.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
139 mAnimating = true;
140 } else if (wasAnimating) {
141 // stopped animating, do one more pass through the layout
142 mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700143 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
144 mService.debugLayoutRepeats("exiting appToken " + appToken + " done");
145 }
Craig Mautner764983d2012-03-22 11:37:36 -0700146 }
147 }
148
149 if (mScreenRotationAnimation != null &&
150 (mScreenRotationAnimation.isAnimating() ||
151 mScreenRotationAnimation.mFinishAnimReady)) {
152 if (mScreenRotationAnimation.stepAnimationLocked(mCurrentTime)) {
Craig Mautner764983d2012-03-22 11:37:36 -0700153 mAnimating = true;
154 } else {
Craig Mautnera608b882012-03-30 13:03:49 -0700155 mBulkUpdateParams |= SET_UPDATE_ROTATION;
Craig Mautner764983d2012-03-22 11:37:36 -0700156 mScreenRotationAnimation.kill();
157 mScreenRotationAnimation = null;
158 }
159 }
160 }
161
162 private void updateWindowsAndWallpaperLocked() {
163 ++mTransactionSequence;
164
165 for (int i = mService.mWindows.size() - 1; i >= 0; i--) {
166 WindowState w = mService.mWindows.get(i);
Craig Mautnera2c77052012-03-26 12:14:43 -0700167 WindowStateAnimator winAnimator = w.mWinAnimator;
Craig Mautner764983d2012-03-22 11:37:36 -0700168 final WindowManager.LayoutParams attrs = w.mAttrs;
169
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700170 if (winAnimator.mSurface != null) {
Craig Mautnera2c77052012-03-26 12:14:43 -0700171 final boolean wasAnimating = winAnimator.mWasAnimating;
172 final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime);
Craig Mautner764983d2012-03-22 11:37:36 -0700173
174 if (WindowManagerService.DEBUG_WALLPAPER) {
175 Slog.v(TAG, w + ": wasAnimating=" + wasAnimating +
176 ", nowAnimating=" + nowAnimating);
177 }
178
179 // If this window is animating, make a note that we have
180 // an animating window and take care of a request to run
181 // a detached wallpaper animation.
182 if (nowAnimating) {
Craig Mautnera2c77052012-03-26 12:14:43 -0700183 if (winAnimator.mAnimation != null) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700184 if ((attrs.flags&FLAG_SHOW_WALLPAPER) != 0
Craig Mautnera2c77052012-03-26 12:14:43 -0700185 && winAnimator.mAnimation.getDetachWallpaper()) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700186 mDetachedWallpaper = w;
Craig Mautner764983d2012-03-22 11:37:36 -0700187 }
Craig Mautnera2c77052012-03-26 12:14:43 -0700188 if (winAnimator.mAnimation.getBackgroundColor() != 0) {
Craig Mautner764983d2012-03-22 11:37:36 -0700189 if (mWindowAnimationBackground == null
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700190 || (winAnimator.mAnimLayer <
191 mWindowAnimationBackground.mWinAnimator.mAnimLayer)) {
Craig Mautner764983d2012-03-22 11:37:36 -0700192 mWindowAnimationBackground = w;
193 mWindowAnimationBackgroundColor =
Craig Mautnera2c77052012-03-26 12:14:43 -0700194 winAnimator.mAnimation.getBackgroundColor();
Craig Mautner764983d2012-03-22 11:37:36 -0700195 }
196 }
197 }
198 mAnimating = true;
199 }
200
201 // If this window's app token is running a detached wallpaper
202 // animation, make a note so we can ensure the wallpaper is
203 // displayed behind it.
204 if (w.mAppToken != null && w.mAppToken.animation != null
205 && w.mAppToken.animating) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700206 if ((attrs.flags&FLAG_SHOW_WALLPAPER) != 0
Craig Mautner764983d2012-03-22 11:37:36 -0700207 && w.mAppToken.animation.getDetachWallpaper()) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700208 mDetachedWallpaper = w;
Craig Mautner764983d2012-03-22 11:37:36 -0700209 }
210 if (w.mAppToken.animation.getBackgroundColor() != 0) {
211 if (mWindowAnimationBackground == null
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700212 || (winAnimator.mAnimLayer <
213 mWindowAnimationBackground.mWinAnimator.mAnimLayer)) {
Craig Mautner764983d2012-03-22 11:37:36 -0700214 mWindowAnimationBackground = w;
215 mWindowAnimationBackgroundColor =
216 w.mAppToken.animation.getBackgroundColor();
217 }
218 }
219 }
220
Craig Mautnera2c77052012-03-26 12:14:43 -0700221 if (wasAnimating && !winAnimator.mAnimating && mService.mWallpaperTarget == w) {
Craig Mautnera608b882012-03-30 13:03:49 -0700222 mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE;
Craig Mautner764983d2012-03-22 11:37:36 -0700223 mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700224 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
225 mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2");
226 }
Craig Mautner764983d2012-03-22 11:37:36 -0700227 }
228
229 if (mPolicy.doesForceHide(w, attrs)) {
230 if (!wasAnimating && nowAnimating) {
231 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
232 "Animation started that could impact force hide: "
233 + w);
234 mService.mInnerFields.mWallpaperForceHidingChanged = true;
235 mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700236 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
237 mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 3");
238 }
Craig Mautner764983d2012-03-22 11:37:36 -0700239 mService.mFocusMayChange = true;
Craig Mautnera2c77052012-03-26 12:14:43 -0700240 } else if (w.isReadyForDisplay() && winAnimator.mAnimation == null) {
Craig Mautner764983d2012-03-22 11:37:36 -0700241 mForceHiding = true;
242 }
243 } else if (mPolicy.canBeForceHidden(w, attrs)) {
244 boolean changed;
245 if (mForceHiding) {
246 changed = w.hideLw(false, false);
247 if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG,
248 "Now policy hidden: " + w);
249 } else {
250 changed = w.showLw(false, false);
251 if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG,
252 "Now policy shown: " + w);
253 if (changed) {
254 if (mService.mInnerFields.mWallpaperForceHidingChanged
255 && w.isVisibleNow() /*w.isReadyForDisplay()*/) {
256 // Assume we will need to animate. If
257 // we don't (because the wallpaper will
258 // stay with the lock screen), then we will
259 // clean up later.
260 Animation a = mPolicy.createForceHideEnterAnimation();
261 if (a != null) {
Craig Mautnera2c77052012-03-26 12:14:43 -0700262 winAnimator.setAnimation(a);
Craig Mautner764983d2012-03-22 11:37:36 -0700263 }
264 }
265 if (mCurrentFocus == null || mCurrentFocus.mLayer < w.mLayer) {
266 // We are showing on to of the current
267 // focus, so re-evaluate focus to make
268 // sure it is correct.
269 mService.mFocusMayChange = true;
270 }
271 }
272 }
273 if (changed && (attrs.flags
274 & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
Craig Mautnera608b882012-03-30 13:03:49 -0700275 mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE;
Craig Mautner764983d2012-03-22 11:37:36 -0700276 mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700277 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
278 mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4");
279 }
Craig Mautner764983d2012-03-22 11:37:36 -0700280 }
281 }
282 }
283
284 final AppWindowToken atoken = w.mAppToken;
285 if (atoken != null && (!atoken.allDrawn || atoken.freezingScreen)) {
286 if (atoken.lastTransactionSequence != mTransactionSequence) {
287 atoken.lastTransactionSequence = mTransactionSequence;
288 atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
289 atoken.startingDisplayed = false;
290 }
291 if ((w.isOnScreen() || w.mAttrs.type
292 == WindowManager.LayoutParams.TYPE_BASE_APPLICATION)
293 && !w.mExiting && !w.mDestroying) {
294 if (WindowManagerService.DEBUG_VISIBILITY ||
295 WindowManagerService.DEBUG_ORIENTATION) {
296 Slog.v(TAG, "Eval win " + w + ": isDrawn="
297 + w.isDrawnLw()
Craig Mautnera2c77052012-03-26 12:14:43 -0700298 + ", isAnimating=" + winAnimator.isAnimating());
Craig Mautner764983d2012-03-22 11:37:36 -0700299 if (!w.isDrawnLw()) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700300 Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurface
Craig Mautner764983d2012-03-22 11:37:36 -0700301 + " pv=" + w.mPolicyVisibility
Craig Mautnera608b882012-03-30 13:03:49 -0700302 + " dp=" + winAnimator.mDrawPending
303 + " cdp=" + winAnimator.mCommitDrawPending
Craig Mautner764983d2012-03-22 11:37:36 -0700304 + " ah=" + w.mAttachedHidden
305 + " th=" + atoken.hiddenRequested
Craig Mautnera2c77052012-03-26 12:14:43 -0700306 + " a=" + winAnimator.mAnimating);
Craig Mautner764983d2012-03-22 11:37:36 -0700307 }
308 }
309 if (w != atoken.startingWindow) {
310 if (!atoken.freezingScreen || !w.mAppFreezing) {
311 atoken.numInterestingWindows++;
312 if (w.isDrawnLw()) {
313 atoken.numDrawnWindows++;
314 if (WindowManagerService.DEBUG_VISIBILITY ||
315 WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
316 "tokenMayBeDrawn: " + atoken
317 + " freezingScreen=" + atoken.freezingScreen
318 + " mAppFreezing=" + w.mAppFreezing);
319 mTokenMayBeDrawn = true;
320 }
321 }
322 } else if (w.isDrawnLw()) {
323 atoken.startingDisplayed = true;
324 }
325 }
326 } else if (w.mReadyToShow) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700327 if (winAnimator.performShowLocked()) {
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700328 mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
329 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
330 mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 5");
331 }
332 }
Craig Mautner764983d2012-03-22 11:37:36 -0700333 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700334 if (atoken != null && atoken.thumbnail != null) {
335 if (atoken.thumbnailTransactionSeq != mTransactionSequence) {
336 atoken.thumbnailTransactionSeq = mTransactionSequence;
337 atoken.thumbnailLayer = 0;
338 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700339 if (atoken.thumbnailLayer < winAnimator.mAnimLayer) {
340 atoken.thumbnailLayer = winAnimator.mAnimLayer;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700341 }
342 }
Craig Mautner764983d2012-03-22 11:37:36 -0700343 } // end forall windows
344 }
345
346 private void testTokenMayBeDrawnLocked() {
347 // See if any windows have been drawn, so they (and others
348 // associated with them) can now be shown.
349 final int NT = mService.mAppTokens.size();
350 for (int i=0; i<NT; i++) {
351 AppWindowToken wtoken = mService.mAppTokens.get(i);
352 if (wtoken.freezingScreen) {
353 int numInteresting = wtoken.numInterestingWindows;
354 if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
355 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
356 "allDrawn: " + wtoken
357 + " interesting=" + numInteresting
358 + " drawn=" + wtoken.numDrawnWindows);
359 wtoken.showAllWindowsLocked();
360 mService.unsetAppFreezingScreenLocked(wtoken, false, true);
361 if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(TAG,
362 "Setting mOrientationChangeComplete=true because wtoken "
363 + wtoken + " numInteresting=" + numInteresting
364 + " numDrawn=" + wtoken.numDrawnWindows);
365 mService.mInnerFields.mOrientationChangeComplete = true;
366 }
367 } else if (!wtoken.allDrawn) {
368 int numInteresting = wtoken.numInterestingWindows;
369 if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
370 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
371 "allDrawn: " + wtoken
372 + " interesting=" + numInteresting
373 + " drawn=" + wtoken.numDrawnWindows);
374 wtoken.allDrawn = true;
375 mPendingLayoutChanges |= PhoneWindowManager.FINISH_LAYOUT_REDO_ANIM;
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700376 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
377 mService.debugLayoutRepeats("testTokenMayBeDrawnLocked");
378 }
Craig Mautner764983d2012-03-22 11:37:36 -0700379
380 // We can now show all of the drawn windows!
381 if (!mService.mOpeningApps.contains(wtoken)) {
382 mAnimating |= wtoken.showAllWindowsLocked();
383 }
384 }
385 }
386 }
387 }
388
389 private void performAnimationsLocked() {
Craig Mautner764983d2012-03-22 11:37:36 -0700390 mTokenMayBeDrawn = false;
Craig Mautner764983d2012-03-22 11:37:36 -0700391 mForceHiding = false;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700392 mDetachedWallpaper = null;
Craig Mautner764983d2012-03-22 11:37:36 -0700393 mWindowAnimationBackground = null;
394 mWindowAnimationBackgroundColor = 0;
395
396 updateWindowsAndWallpaperLocked();
397
398 if (mTokenMayBeDrawn) {
399 testTokenMayBeDrawnLocked();
400 }
Craig Mautner764983d2012-03-22 11:37:36 -0700401 }
402
Craig Mautner764983d2012-03-22 11:37:36 -0700403 void animate() {
Craig Mautnerbb1449b2012-03-23 16:11:14 -0700404 mPendingLayoutChanges = 0;
Craig Mautner764983d2012-03-22 11:37:36 -0700405 mCurrentTime = SystemClock.uptimeMillis();
Craig Mautnera608b882012-03-30 13:03:49 -0700406 mBulkUpdateParams = 0;
Craig Mautner764983d2012-03-22 11:37:36 -0700407
408 // Update animations of all applications, including those
409 // associated with exiting/removed apps
410 Surface.openTransaction();
411
412 try {
Craig Mautnere7ae2502012-03-26 17:11:19 -0700413 testWallpaperAndBackgroundLocked();
Craig Mautner764983d2012-03-22 11:37:36 -0700414 updateWindowsAppsAndRotationAnimationsLocked();
415 performAnimationsLocked();
416
417 // THIRD LOOP: Update the surfaces of all windows.
418
419 if (mScreenRotationAnimation != null) {
420 mScreenRotationAnimation.updateSurfaces();
421 }
422
423 final int N = mService.mWindows.size();
424 for (int i=N-1; i>=0; i--) {
425 WindowState w = mService.mWindows.get(i);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700426 w.mWinAnimator.prepareSurfaceLocked(true);
Craig Mautner764983d2012-03-22 11:37:36 -0700427 }
428
429 if (mService.mDimAnimator != null && mService.mDimAnimator.mDimShown) {
430 mAnimating |= mService.mDimAnimator.updateSurface(mService.mInnerFields.mDimming,
431 mCurrentTime, !mService.okToDisplay());
432 }
433
434 if (mService.mBlackFrame != null) {
435 if (mScreenRotationAnimation != null) {
436 mService.mBlackFrame.setMatrix(
437 mScreenRotationAnimation.getEnterTransformation().getMatrix());
438 } else {
439 mService.mBlackFrame.clearMatrix();
440 }
441 }
442 } catch (RuntimeException e) {
443 Log.wtf(TAG, "Unhandled exception in Window Manager", e);
444 } finally {
445 Surface.closeTransaction();
446 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700447
Craig Mautnera608b882012-03-30 13:03:49 -0700448 if (mBulkUpdateParams != 0) {
449 mService.bulkSetParameters(mBulkUpdateParams);
Craig Mautnere7ae2502012-03-26 17:11:19 -0700450 }
Craig Mautner764983d2012-03-22 11:37:36 -0700451 }
452
453 WindowState mCurrentFocus;
454 void setCurrentFocus(WindowState currentFocus) {
455 mCurrentFocus = currentFocus;
456 }
457
458 void setDisplayDimensions(final int curWidth, final int curHeight,
459 final int appWidth, final int appHeight) {
460 mDw = curWidth;
461 mDh = curHeight;
462 mInnerDw = appWidth;
463 mInnerDh = appHeight;
464 }
465
Craig Mautnere7ae2502012-03-26 17:11:19 -0700466 public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
467 if (mWindowDetachedWallpaper != null) {
468 pw.print(" mWindowDetachedWallpaper="); pw.println(mWindowDetachedWallpaper);
469 }
470 if (mWindowAnimationBackgroundSurface != null) {
471 pw.println(" mWindowAnimationBackgroundSurface:");
472 mWindowAnimationBackgroundSurface.printTo(" ", pw);
473 }
474 }
Craig Mautner764983d2012-03-22 11:37:36 -0700475}