blob: 789e74b46f0165270ea4ace1dab8a2ff3c88f758 [file] [log] [blame]
Craig Mautnera2c77052012-03-26 12:14:43 -07001// Copyright 2012 Google Inc. All Rights Reserved.
2
3package com.android.server.wm;
4
Craig Mautnerc2f9be02012-03-27 17:32:29 -07005import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
6import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
7
8import android.content.Context;
9import android.graphics.Matrix;
10import android.graphics.PixelFormat;
11import android.graphics.Rect;
12import android.os.RemoteException;
Craig Mautnera2c77052012-03-26 12:14:43 -070013import android.util.Slog;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070014import android.view.Surface;
Craig Mautnera2c77052012-03-26 12:14:43 -070015import android.view.WindowManager;
16import android.view.WindowManagerPolicy;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070017import android.view.WindowManager.LayoutParams;
Craig Mautnera2c77052012-03-26 12:14:43 -070018import android.view.animation.Animation;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070019import android.view.animation.AnimationUtils;
Craig Mautnera2c77052012-03-26 12:14:43 -070020import android.view.animation.Transformation;
21
22import com.android.server.wm.WindowManagerService.H;
23
24import java.io.PrintWriter;
25
26/**
Craig Mautnerc2f9be02012-03-27 17:32:29 -070027 * Keep track of animations and surface operations for a single WindowState.
28 **/
Craig Mautnera2c77052012-03-26 12:14:43 -070029class WindowStateAnimator {
Craig Mautnerc2f9be02012-03-27 17:32:29 -070030 static final boolean DEBUG_VISIBILITY = WindowManagerService.DEBUG_VISIBILITY;
31 static final boolean DEBUG_ANIM = WindowManagerService.DEBUG_ANIM;
32 static final boolean DEBUG_LAYERS = WindowManagerService.DEBUG_LAYERS;
33 static final boolean DEBUG_STARTING_WINDOW = WindowManagerService.DEBUG_STARTING_WINDOW;
34 static final boolean SHOW_TRANSACTIONS = WindowManagerService.SHOW_TRANSACTIONS;
35 static final boolean SHOW_LIGHT_TRANSACTIONS = WindowManagerService.SHOW_LIGHT_TRANSACTIONS;
36 static final boolean SHOW_SURFACE_ALLOC = WindowManagerService.SHOW_SURFACE_ALLOC;
37 static final boolean localLOGV = WindowManagerService.localLOGV;
38
39 static final String TAG = "WindowStateAnimator";
Craig Mautnera2c77052012-03-26 12:14:43 -070040
41 final WindowManagerService mService;
42 final WindowState mWin;
43 final WindowState mAttachedWindow;
Craig Mautnere7ae2502012-03-26 17:11:19 -070044 final WindowAnimator mAnimator;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070045 final Session mSession;
46 final WindowManagerPolicy mPolicy;
47 final Context mContext;
Craig Mautnera2c77052012-03-26 12:14:43 -070048
49 // Currently running animation.
50 boolean mAnimating;
51 boolean mLocalAnimating;
52 Animation mAnimation;
53 boolean mAnimationIsEntrance;
54 boolean mHasTransformation;
55 boolean mHasLocalTransformation;
56 final Transformation mTransformation = new Transformation();
57 boolean mWasAnimating; // Were we animating going into the most recent animation step?
Craig Mautnerc2f9be02012-03-27 17:32:29 -070058 int mAnimLayer;
59 int mLastLayer;
60
61 Surface mSurface;
62 Surface mPendingDestroySurface;
63 boolean mReportDestroySurface;
64 boolean mSurfacePendingDestroy;
65
66 /**
67 * Set when we have changed the size of the surface, to know that
68 * we must tell them application to resize (and thus redraw itself).
69 */
70 boolean mSurfaceResized;
71
72 /**
73 * Set if the client has asked that the destroy of its surface be delayed
74 * until it explicitly says it is okay.
75 */
76 boolean mSurfaceDestroyDeferred;
77
78 float mShownAlpha = 1;
79 float mAlpha = 1;
80 float mLastAlpha = 1;
81
82 // Used to save animation distances between the time they are calculated and when they are
83 // used.
84 int mAnimDw;
85 int mAnimDh;
86 float mDsDx=1, mDtDx=0, mDsDy=0, mDtDy=1;
87 float mLastDsDx=1, mLastDtDx=0, mLastDsDy=0, mLastDtDy=1;
88
89 boolean mHaveMatrix;
90
91 // For debugging, this is the last information given to the surface flinger.
92 boolean mSurfaceShown;
93 float mSurfaceX, mSurfaceY, mSurfaceW, mSurfaceH;
94 int mSurfaceLayer;
95 float mSurfaceAlpha;
96
97 // Set to true if, when the window gets displayed, it should perform
98 // an enter animation.
99 boolean mEnterAnimationPending;
Craig Mautnera2c77052012-03-26 12:14:43 -0700100
101 public WindowStateAnimator(final WindowManagerService service, final WindowState win,
102 final WindowState attachedWindow) {
103 mService = service;
104 mWin = win;
105 mAttachedWindow = attachedWindow;
Craig Mautnere7ae2502012-03-26 17:11:19 -0700106 mAnimator = mService.mAnimator;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700107 mSession = win.mSession;
108 mPolicy = mService.mPolicy;
109 mContext = mService.mContext;
Craig Mautnera2c77052012-03-26 12:14:43 -0700110 }
111
112 public void setAnimation(Animation anim) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700113 if (localLOGV) Slog.v(
114 TAG, "Setting animation in " + this + ": " + anim);
Craig Mautnera2c77052012-03-26 12:14:43 -0700115 mAnimating = false;
116 mLocalAnimating = false;
117 mAnimation = anim;
118 mAnimation.restrictDuration(WindowManagerService.MAX_ANIMATION_DURATION);
119 mAnimation.scaleCurrentDuration(mService.mWindowAnimationScale);
120 // Start out animation gone if window is gone, or visible if window is visible.
121 mTransformation.clear();
122 mTransformation.setAlpha(mWin.mLastHidden ? 0 : 1);
123 mHasLocalTransformation = true;
124 }
125
126 public void clearAnimation() {
127 if (mAnimation != null) {
128 mAnimating = true;
129 mLocalAnimating = false;
130 mAnimation.cancel();
131 mAnimation = null;
132 }
133 }
134
135 /** Is the window or its container currently animating? */
136 boolean isAnimating() {
137 final WindowState attached = mAttachedWindow;
138 final AppWindowToken atoken = mWin.mAppToken;
139 return mAnimation != null
140 || (attached != null && attached.mWinAnimator.mAnimation != null)
141 || (atoken != null &&
142 (atoken.animation != null
143 || atoken.inPendingTransaction));
144 }
145
146 /** Is this window currently animating? */
147 boolean isWindowAnimating() {
148 return mAnimation != null;
149 }
150
Craig Mautnera2c77052012-03-26 12:14:43 -0700151 void cancelExitAnimationForNextAnimationLocked() {
152 if (!mWin.mExiting) return;
153 if (mAnimation != null) {
154 mAnimation.cancel();
155 mAnimation = null;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700156 destroySurfaceLocked();
Craig Mautnera2c77052012-03-26 12:14:43 -0700157 }
158 mWin.mExiting = false;
159 }
160
161 private boolean stepAnimation(long currentTime) {
162 if ((mAnimation == null) || !mLocalAnimating) {
163 return false;
164 }
165 mTransformation.clear();
166 final boolean more = mAnimation.getTransformation(currentTime, mTransformation);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700167 if (DEBUG_ANIM) Slog.v(
168 TAG, "Stepped animation in " + this +
Craig Mautnera2c77052012-03-26 12:14:43 -0700169 ": more=" + more + ", xform=" + mTransformation);
170 return more;
171 }
172
173 // This must be called while inside a transaction. Returns true if
174 // there is more animation to run.
175 boolean stepAnimationLocked(long currentTime) {
176 // Save the animation state as it was before this step so WindowManagerService can tell if
177 // we just started or just stopped animating by comparing mWasAnimating with isAnimating().
178 mWasAnimating = mAnimating;
179 if (mService.okToDisplay()) {
180 // We will run animations as long as the display isn't frozen.
181
182 if (mWin.isDrawnLw() && mAnimation != null) {
183 mHasTransformation = true;
184 mHasLocalTransformation = true;
185 if (!mLocalAnimating) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700186 if (DEBUG_ANIM) Slog.v(
187 TAG, "Starting animation in " + this +
Craig Mautnera2c77052012-03-26 12:14:43 -0700188 " @ " + currentTime + ": ww=" + mWin.mFrame.width() +
189 " wh=" + mWin.mFrame.height() +
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700190 " dw=" + mAnimDw + " dh=" + mAnimDh +
Craig Mautnera2c77052012-03-26 12:14:43 -0700191 " scale=" + mService.mWindowAnimationScale);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700192 mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(),
193 mAnimDw, mAnimDh);
Craig Mautnera2c77052012-03-26 12:14:43 -0700194 mAnimation.setStartTime(currentTime);
195 mLocalAnimating = true;
196 mAnimating = true;
197 }
198 if ((mAnimation != null) && mLocalAnimating) {
199 if (stepAnimation(currentTime)) {
200 return true;
201 }
202 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700203 if (DEBUG_ANIM) Slog.v(
204 TAG, "Finished animation in " + this +
Craig Mautnera2c77052012-03-26 12:14:43 -0700205 " @ " + currentTime);
206 //WindowManagerService.this.dump();
207 }
208 mHasLocalTransformation = false;
209 if ((!mLocalAnimating || mAnimationIsEntrance) && mWin.mAppToken != null
210 && mWin.mAppToken.animation != null) {
211 // When our app token is animating, we kind-of pretend like
212 // we are as well. Note the mLocalAnimating mAnimationIsEntrance
213 // part of this check means that we will only do this if
214 // our window is not currently exiting, or it is not
215 // locally animating itself. The idea being that one that
216 // is exiting and doing a local animation should be removed
217 // once that animation is done.
218 mAnimating = true;
219 mHasTransformation = true;
220 mTransformation.clear();
221 return false;
222 } else if (mHasTransformation) {
223 // Little trick to get through the path below to act like
224 // we have finished an animation.
225 mAnimating = true;
226 } else if (isAnimating()) {
227 mAnimating = true;
228 }
229 } else if (mAnimation != null) {
230 // If the display is frozen, and there is a pending animation,
231 // clear it and make sure we run the cleanup code.
232 mAnimating = true;
233 mLocalAnimating = true;
234 mAnimation.cancel();
235 mAnimation = null;
236 }
237
238 if (!mAnimating && !mLocalAnimating) {
239 return false;
240 }
241
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700242 // Done animating, clean up.
243 if (DEBUG_ANIM) Slog.v(
244 TAG, "Animation done in " + this + ": exiting=" + mWin.mExiting
Craig Mautnera2c77052012-03-26 12:14:43 -0700245 + ", reportedVisible="
246 + (mWin.mAppToken != null ? mWin.mAppToken.reportedVisible : false));
247
248 mAnimating = false;
249 mLocalAnimating = false;
250 if (mAnimation != null) {
251 mAnimation.cancel();
252 mAnimation = null;
253 }
Craig Mautnere7ae2502012-03-26 17:11:19 -0700254 if (mAnimator.mWindowDetachedWallpaper == mWin) {
255 mAnimator.mWindowDetachedWallpaper = null;
Craig Mautnera2c77052012-03-26 12:14:43 -0700256 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700257 mAnimLayer = mWin.mLayer;
Craig Mautnera2c77052012-03-26 12:14:43 -0700258 if (mWin.mIsImWindow) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700259 mAnimLayer += mService.mInputMethodAnimLayerAdjustment;
Craig Mautnera2c77052012-03-26 12:14:43 -0700260 } else if (mWin.mIsWallpaper) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700261 mAnimLayer += mService.mWallpaperAnimLayerAdjustment;
Craig Mautnera2c77052012-03-26 12:14:43 -0700262 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700263 if (DEBUG_LAYERS) Slog.v(TAG, "Stepping win " + this
264 + " anim layer: " + mAnimLayer);
Craig Mautnera2c77052012-03-26 12:14:43 -0700265 mHasTransformation = false;
266 mHasLocalTransformation = false;
267 if (mWin.mPolicyVisibility != mWin.mPolicyVisibilityAfterAnim) {
268 if (WindowState.DEBUG_VISIBILITY) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700269 Slog.v(TAG, "Policy visibility changing after anim in " + this + ": "
Craig Mautnera2c77052012-03-26 12:14:43 -0700270 + mWin.mPolicyVisibilityAfterAnim);
271 }
272 mWin.mPolicyVisibility = mWin.mPolicyVisibilityAfterAnim;
273 mService.mLayoutNeeded = true;
274 if (!mWin.mPolicyVisibility) {
275 if (mService.mCurrentFocus == mWin) {
276 mService.mFocusMayChange = true;
277 }
278 // Window is no longer visible -- make sure if we were waiting
279 // for it to be displayed before enabling the display, that
280 // we allow the display to be enabled now.
281 mService.enableScreenIfNeededLocked();
282 }
283 }
284 mTransformation.clear();
285 if (mWin.mHasDrawn
286 && mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING
287 && mWin.mAppToken != null
288 && mWin.mAppToken.firstWindowDrawn
289 && mWin.mAppToken.startingData != null) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700290 if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Finish starting "
Craig Mautnera2c77052012-03-26 12:14:43 -0700291 + mWin.mToken + ": first real window done animating");
292 mService.mFinishedStarting.add(mWin.mAppToken);
293 mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
294 }
295
296 finishExit();
297 mService.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
298 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) mService.debugLayoutRepeats("WindowState");
299
300 if (mWin.mAppToken != null) {
301 mWin.mAppToken.updateReportedVisibilityLocked();
302 }
303
304 return false;
305 }
306
307 void finishExit() {
308 if (WindowManagerService.DEBUG_ANIM) Slog.v(
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700309 TAG, "finishExit in " + this
Craig Mautnera2c77052012-03-26 12:14:43 -0700310 + ": exiting=" + mWin.mExiting
311 + " remove=" + mWin.mRemoveOnExit
312 + " windowAnimating=" + isWindowAnimating());
313
314 final int N = mWin.mChildWindows.size();
315 for (int i=0; i<N; i++) {
316 mWin.mChildWindows.get(i).mWinAnimator.finishExit();
317 }
318
319 if (!mWin.mExiting) {
320 return;
321 }
322
323 if (isWindowAnimating()) {
324 return;
325 }
326
327 if (WindowManagerService.localLOGV) Slog.v(
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700328 TAG, "Exit animation finished in " + this
Craig Mautnera2c77052012-03-26 12:14:43 -0700329 + ": remove=" + mWin.mRemoveOnExit);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700330 if (mSurface != null) {
Craig Mautnera2c77052012-03-26 12:14:43 -0700331 mService.mDestroySurface.add(mWin);
332 mWin.mDestroying = true;
333 if (WindowState.SHOW_TRANSACTIONS) WindowManagerService.logSurface(
334 mWin, "HIDE (finishExit)", null);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700335 mSurfaceShown = false;
Craig Mautnera2c77052012-03-26 12:14:43 -0700336 try {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700337 mSurface.hide();
Craig Mautnera2c77052012-03-26 12:14:43 -0700338 } catch (RuntimeException e) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700339 Slog.w(TAG, "Error hiding surface in " + this, e);
Craig Mautnera2c77052012-03-26 12:14:43 -0700340 }
341 mWin.mLastHidden = true;
342 }
343 mWin.mExiting = false;
344 if (mWin.mRemoveOnExit) {
345 mService.mPendingRemove.add(mWin);
346 mWin.mRemoveOnExit = false;
347 }
348 }
349
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700350 Surface createSurfaceLocked() {
351 if (mSurface == null) {
352 mReportDestroySurface = false;
353 mSurfacePendingDestroy = false;
354 if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(TAG,
355 "createSurface " + this + ": DRAW NOW PENDING");
356 mWin.mDrawPending = true;
357 mWin.mCommitDrawPending = false;
358 mWin.mReadyToShow = false;
359 if (mWin.mAppToken != null) {
360 mWin.mAppToken.allDrawn = false;
361 }
362
363 mService.makeWindowFreezingScreenIfNeededLocked(mWin);
364
365 int flags = 0;
366 final WindowManager.LayoutParams attrs = mWin.mAttrs;
367
368 if ((attrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) {
369 flags |= Surface.SECURE;
370 }
371 if (WindowState.DEBUG_VISIBILITY) Slog.v(
372 TAG, "Creating surface in session "
373 + mSession.mSurfaceSession + " window " + this
374 + " w=" + mWin.mCompatFrame.width()
375 + " h=" + mWin.mCompatFrame.height() + " format="
376 + attrs.format + " flags=" + flags);
377
378 int w = mWin.mCompatFrame.width();
379 int h = mWin.mCompatFrame.height();
380 if ((attrs.flags & LayoutParams.FLAG_SCALED) != 0) {
381 // for a scaled surface, we always want the requested
382 // size.
383 w = mWin.mRequestedWidth;
384 h = mWin.mRequestedHeight;
385 }
386
387 // Something is wrong and SurfaceFlinger will not like this,
388 // try to revert to sane values
389 if (w <= 0) w = 1;
390 if (h <= 0) h = 1;
391
392 mSurfaceShown = false;
393 mSurfaceLayer = 0;
394 mSurfaceAlpha = 1;
395 mSurfaceX = 0;
396 mSurfaceY = 0;
397 mSurfaceW = w;
398 mSurfaceH = h;
399 try {
400 final boolean isHwAccelerated = (attrs.flags &
401 WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
402 final int format = isHwAccelerated ? PixelFormat.TRANSLUCENT : attrs.format;
403 if (!PixelFormat.formatHasAlpha(attrs.format)) {
404 flags |= Surface.OPAQUE;
405 }
406 mSurface = new Surface(
407 mSession.mSurfaceSession, mSession.mPid,
408 attrs.getTitle().toString(),
409 0, w, h, format, flags);
410 if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG,
411 " CREATE SURFACE "
412 + mSurface + " IN SESSION "
413 + mSession.mSurfaceSession
414 + ": pid=" + mSession.mPid + " format="
415 + attrs.format + " flags=0x"
416 + Integer.toHexString(flags)
417 + " / " + this);
418 } catch (Surface.OutOfResourcesException e) {
419 Slog.w(TAG, "OutOfResourcesException creating surface");
420 mService.reclaimSomeSurfaceMemoryLocked(this, "create", true);
421 return null;
422 } catch (Exception e) {
423 Slog.e(TAG, "Exception creating surface", e);
424 return null;
425 }
426
427 if (WindowManagerService.localLOGV) Slog.v(
428 TAG, "Got surface: " + mSurface
429 + ", set left=" + mWin.mFrame.left + " top=" + mWin.mFrame.top
430 + ", animLayer=" + mAnimLayer);
431 if (SHOW_LIGHT_TRANSACTIONS) {
432 Slog.i(TAG, ">>> OPEN TRANSACTION createSurfaceLocked");
433 WindowManagerService.logSurface(mWin, "CREATE pos=("
434 + mWin.mFrame.left + "," + mWin.mFrame.top + ") ("
435 + mWin.mCompatFrame.width() + "x" + mWin.mCompatFrame.height()
436 + "), layer=" + mAnimLayer + " HIDE", null);
437 }
438 Surface.openTransaction();
439 try {
440 try {
441 mSurfaceX = mWin.mFrame.left + mWin.mXOffset;
442 mSurfaceY = mWin.mFrame.top + mWin.mYOffset;
443 mSurface.setPosition(mSurfaceX, mSurfaceY);
444 mSurfaceLayer = mAnimLayer;
445 mSurface.setLayer(mAnimLayer);
446 mSurfaceShown = false;
447 mSurface.hide();
448 if ((mWin.mAttrs.flags&WindowManager.LayoutParams.FLAG_DITHER) != 0) {
449 if (SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin, "DITHER", null);
450 mSurface.setFlags(Surface.SURFACE_DITHER, Surface.SURFACE_DITHER);
451 }
452 } catch (RuntimeException e) {
453 Slog.w(TAG, "Error creating surface in " + w, e);
454 mService.reclaimSomeSurfaceMemoryLocked(this, "create-init", true);
455 }
456 mWin.mLastHidden = true;
457 } finally {
458 Surface.closeTransaction();
459 if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
460 "<<< CLOSE TRANSACTION createSurfaceLocked");
461 }
462 if (WindowManagerService.localLOGV) Slog.v(
463 TAG, "Created surface " + this);
464 }
465 return mSurface;
466 }
467
468 void destroySurfaceLocked() {
469 if (mWin.mAppToken != null && mWin == mWin.mAppToken.startingWindow) {
470 mWin.mAppToken.startingDisplayed = false;
471 }
472
473 if (mSurface != null) {
474 mWin.mDrawPending = false;
475 mWin.mCommitDrawPending = false;
476 mWin.mReadyToShow = false;
477
478 int i = mWin.mChildWindows.size();
479 while (i > 0) {
480 i--;
481 WindowState c = mWin.mChildWindows.get(i);
482 c.mAttachedHidden = true;
483 }
484
485 if (mReportDestroySurface) {
486 mReportDestroySurface = false;
487 mSurfacePendingDestroy = true;
488 try {
489 mWin.mClient.dispatchGetNewSurface();
490 // We'll really destroy on the next time around.
491 return;
492 } catch (RemoteException e) {
493 }
494 }
495
496 try {
497 if (DEBUG_VISIBILITY) {
498 RuntimeException e = null;
499 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
500 e = new RuntimeException();
501 e.fillInStackTrace();
502 }
503 Slog.w(TAG, "Window " + this + " destroying surface "
504 + mSurface + ", session " + mSession, e);
505 }
506 if (mSurfaceDestroyDeferred) {
507 if (mSurface != null && mPendingDestroySurface != mSurface) {
508 if (mPendingDestroySurface != null) {
509 if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
510 RuntimeException e = null;
511 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
512 e = new RuntimeException();
513 e.fillInStackTrace();
514 }
515 WindowManagerService.logSurface(mWin, "DESTROY PENDING", e);
516 }
517 mPendingDestroySurface.destroy();
518 }
519 mPendingDestroySurface = mSurface;
520 }
521 } else {
522 if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
523 RuntimeException e = null;
524 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
525 e = new RuntimeException();
526 e.fillInStackTrace();
527 }
528 WindowManagerService.logSurface(mWin, "DESTROY", e);
529 }
530 mSurface.destroy();
531 }
532 } catch (RuntimeException e) {
533 Slog.w(TAG, "Exception thrown when destroying Window " + this
534 + " surface " + mSurface + " session " + mSession
535 + ": " + e.toString());
536 }
537
538 mSurfaceShown = false;
539 mSurface = null;
540 }
541 }
542
543 void destroyDeferredSurfaceLocked() {
544 try {
545 if (mPendingDestroySurface != null) {
546 if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
547 RuntimeException e = null;
548 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
549 e = new RuntimeException();
550 e.fillInStackTrace();
551 }
552 WindowManagerService.logSurface(mWin, "DESTROY PENDING", e);
553 }
554 mPendingDestroySurface.destroy();
555 }
556 } catch (RuntimeException e) {
557 Slog.w(WindowManagerService.TAG, "Exception thrown when destroying Window "
558 + this + " surface " + mPendingDestroySurface
559 + " session " + mSession + ": " + e.toString());
560 }
561 mSurfaceDestroyDeferred = false;
562 mPendingDestroySurface = null;
563 }
564
565 void computeShownFrameLocked() {
566 final boolean selfTransformation = mHasLocalTransformation;
567 Transformation attachedTransformation =
568 (mAttachedWindow != null && mAttachedWindow.mWinAnimator.mHasLocalTransformation)
569 ? mAttachedWindow.mWinAnimator.mTransformation : null;
570 Transformation appTransformation =
571 (mWin.mAppToken != null && mWin.mAppToken.hasTransformation)
572 ? mWin.mAppToken.transformation : null;
573
574 // Wallpapers are animated based on the "real" window they
575 // are currently targeting.
576 if (mWin.mAttrs.type == TYPE_WALLPAPER && mService.mLowerWallpaperTarget == null
577 && mService.mWallpaperTarget != null) {
578 if (mService.mWallpaperTarget.mWinAnimator.mHasLocalTransformation &&
579 mService.mWallpaperTarget.mWinAnimator.mAnimation != null &&
580 !mService.mWallpaperTarget.mWinAnimator.mAnimation.getDetachWallpaper()) {
581 attachedTransformation = mService.mWallpaperTarget.mWinAnimator.mTransformation;
582 if (WindowManagerService.DEBUG_WALLPAPER && attachedTransformation != null) {
583 Slog.v(TAG, "WP target attached xform: " + attachedTransformation);
584 }
585 }
586 if (mService.mWallpaperTarget.mAppToken != null &&
587 mService.mWallpaperTarget.mAppToken.hasTransformation &&
588 mService.mWallpaperTarget.mAppToken.animation != null &&
589 !mService.mWallpaperTarget.mAppToken.animation.getDetachWallpaper()) {
590 appTransformation = mService.mWallpaperTarget.mAppToken.transformation;
591 if (WindowManagerService.DEBUG_WALLPAPER && appTransformation != null) {
592 Slog.v(TAG, "WP target app xform: " + appTransformation);
593 }
594 }
595 }
596
597 final boolean screenAnimation = mService.mAnimator.mScreenRotationAnimation != null
598 && mService.mAnimator.mScreenRotationAnimation.isAnimating();
599 if (selfTransformation || attachedTransformation != null
600 || appTransformation != null || screenAnimation) {
601 // cache often used attributes locally
602 final Rect frame = mWin.mFrame;
603 final float tmpFloats[] = mService.mTmpFloats;
604 final Matrix tmpMatrix = mWin.mTmpMatrix;
605
606 // Compute the desired transformation.
607 if (screenAnimation) {
608 // If we are doing a screen animation, the global rotation
609 // applied to windows can result in windows that are carefully
610 // aligned with each other to slightly separate, allowing you
611 // to see what is behind them. An unsightly mess. This...
612 // thing... magically makes it call good: scale each window
613 // slightly (two pixels larger in each dimension, from the
614 // window's center).
615 final float w = frame.width();
616 final float h = frame.height();
617 if (w>=1 && h>=1) {
618 tmpMatrix.setScale(1 + 2/w, 1 + 2/h, w/2, h/2);
619 } else {
620 tmpMatrix.reset();
621 }
622 } else {
623 tmpMatrix.reset();
624 }
625 tmpMatrix.postScale(mWin.mGlobalScale, mWin.mGlobalScale);
626 if (selfTransformation) {
627 tmpMatrix.postConcat(mTransformation.getMatrix());
628 }
629 tmpMatrix.postTranslate(frame.left + mWin.mXOffset, frame.top + mWin.mYOffset);
630 if (attachedTransformation != null) {
631 tmpMatrix.postConcat(attachedTransformation.getMatrix());
632 }
633 if (appTransformation != null) {
634 tmpMatrix.postConcat(appTransformation.getMatrix());
635 }
636 if (screenAnimation) {
637 tmpMatrix.postConcat(
638 mService.mAnimator.mScreenRotationAnimation.getEnterTransformation().getMatrix());
639 }
640
641 // "convert" it into SurfaceFlinger's format
642 // (a 2x2 matrix + an offset)
643 // Here we must not transform the position of the surface
644 // since it is already included in the transformation.
645 //Slog.i(TAG, "Transform: " + matrix);
646
647 mHaveMatrix = true;
648 tmpMatrix.getValues(tmpFloats);
649 mDsDx = tmpFloats[Matrix.MSCALE_X];
650 mDtDx = tmpFloats[Matrix.MSKEW_Y];
651 mDsDy = tmpFloats[Matrix.MSKEW_X];
652 mDtDy = tmpFloats[Matrix.MSCALE_Y];
653 float x = tmpFloats[Matrix.MTRANS_X];
654 float y = tmpFloats[Matrix.MTRANS_Y];
655 int w = frame.width();
656 int h = frame.height();
657 mWin.mShownFrame.set(x, y, x+w, y+h);
658
659 // Now set the alpha... but because our current hardware
660 // can't do alpha transformation on a non-opaque surface,
661 // turn it off if we are running an animation that is also
662 // transforming since it is more important to have that
663 // animation be smooth.
664 mShownAlpha = mAlpha;
665 if (!mService.mLimitedAlphaCompositing
666 || (!PixelFormat.formatHasAlpha(mWin.mAttrs.format)
667 || (mWin.isIdentityMatrix(mDsDx, mDtDx, mDsDy, mDtDy)
668 && x == frame.left && y == frame.top))) {
669 //Slog.i(TAG, "Applying alpha transform");
670 if (selfTransformation) {
671 mShownAlpha *= mTransformation.getAlpha();
672 }
673 if (attachedTransformation != null) {
674 mShownAlpha *= attachedTransformation.getAlpha();
675 }
676 if (appTransformation != null) {
677 mShownAlpha *= appTransformation.getAlpha();
678 }
679 if (screenAnimation) {
680 mShownAlpha *=
681 mService.mAnimator.mScreenRotationAnimation.getEnterTransformation().getAlpha();
682 }
683 } else {
684 //Slog.i(TAG, "Not applying alpha transform");
685 }
686
687 if (WindowManagerService.localLOGV) Slog.v(
688 TAG, "computeShownFrameLocked: Animating " + this +
689 ": " + mWin.mShownFrame +
690 ", alpha=" + mTransformation.getAlpha() + ", mShownAlpha=" + mShownAlpha);
691 return;
692 }
693
694 if (WindowManagerService.localLOGV) Slog.v(
695 TAG, "computeShownFrameLocked: " + this +
696 " not attached, mAlpha=" + mAlpha);
697 mWin.mShownFrame.set(mWin.mFrame);
698 if (mWin.mXOffset != 0 || mWin.mYOffset != 0) {
699 mWin.mShownFrame.offset(mWin.mXOffset, mWin.mYOffset);
700 }
701 mShownAlpha = mAlpha;
702 mHaveMatrix = false;
703 mDsDx = mWin.mGlobalScale;
704 mDtDx = 0;
705 mDsDy = 0;
706 mDtDy = mWin.mGlobalScale;
707 }
708 public void prepareSurfaceLocked(final boolean recoveringMemory) {
709 final WindowState w = mWin;
710 if (mSurface == null) {
711 if (w.mOrientationChanging) {
712 if (WindowManagerService.DEBUG_ORIENTATION) {
713 Slog.v(TAG, "Orientation change skips hidden " + w);
714 }
715 w.mOrientationChanging = false;
716 }
717 return;
718 }
719
720 boolean displayed = false;
721
722 computeShownFrameLocked();
723
724 int width, height;
725 if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) {
726 // for a scaled surface, we just want to use
727 // the requested size.
728 width = w.mRequestedWidth;
729 height = w.mRequestedHeight;
730 } else {
731 width = w.mCompatFrame.width();
732 height = w.mCompatFrame.height();
733 }
734
735 if (width < 1) {
736 width = 1;
737 }
738 if (height < 1) {
739 height = 1;
740 }
741 final boolean surfaceResized = mSurfaceW != width || mSurfaceH != height;
742 if (surfaceResized) {
743 mSurfaceW = width;
744 mSurfaceH = height;
745 }
746
747 if (mSurfaceX != w.mShownFrame.left
748 || mSurfaceY != w.mShownFrame.top) {
749 try {
750 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
751 "POS " + w.mShownFrame.left
752 + ", " + w.mShownFrame.top, null);
753 mSurfaceX = w.mShownFrame.left;
754 mSurfaceY = w.mShownFrame.top;
755 mSurface.setPosition(w.mShownFrame.left, w.mShownFrame.top);
756 } catch (RuntimeException e) {
757 Slog.w(TAG, "Error positioning surface of " + w
758 + " pos=(" + w.mShownFrame.left
759 + "," + w.mShownFrame.top + ")", e);
760 if (!recoveringMemory) {
761 mService.reclaimSomeSurfaceMemoryLocked(this, "position", true);
762 }
763 }
764 }
765
766 if (surfaceResized) {
767 try {
768 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
769 "SIZE " + width + "x" + height, null);
770 mSurfaceResized = true;
771 mSurface.setSize(width, height);
772 } catch (RuntimeException e) {
773 // If something goes wrong with the surface (such
774 // as running out of memory), don't take down the
775 // entire system.
776 Slog.e(TAG, "Error resizing surface of " + w
777 + " size=(" + width + "x" + height + ")", e);
778 if (!recoveringMemory) {
779 mService.reclaimSomeSurfaceMemoryLocked(this, "size", true);
780 }
781 }
782 }
783
784 if (w.mAttachedHidden || !w.isReadyForDisplay()) {
785 if (!w.mLastHidden) {
786 //dump();
787 w.mLastHidden = true;
788 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
789 "HIDE (performLayout)", null);
790 if (mSurface != null) {
791 mSurfaceShown = false;
792 try {
793 mSurface.hide();
794 } catch (RuntimeException e) {
795 Slog.w(TAG, "Exception hiding surface in " + w);
796 }
797 }
798 }
799 // If we are waiting for this window to handle an
800 // orientation change, well, it is hidden, so
801 // doesn't really matter. Note that this does
802 // introduce a potential glitch if the window
803 // becomes unhidden before it has drawn for the
804 // new orientation.
805 if (w.mOrientationChanging) {
806 w.mOrientationChanging = false;
807 if (WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
808 "Orientation change skips hidden " + w);
809 }
810 } else if (mLastLayer != mAnimLayer
811 || mLastAlpha != mShownAlpha
812 || mLastDsDx != mDsDx
813 || mLastDtDx != mDtDx
814 || mLastDsDy != mDsDy
815 || mLastDtDy != mDtDy
816 || w.mLastHScale != w.mHScale
817 || w.mLastVScale != w.mVScale
818 || w.mLastHidden) {
819 displayed = true;
820 mLastAlpha = mShownAlpha;
821 mLastLayer = mAnimLayer;
822 mLastDsDx = mDsDx;
823 mLastDtDx = mDtDx;
824 mLastDsDy = mDsDy;
825 mLastDtDy = mDtDy;
826 w.mLastHScale = w.mHScale;
827 w.mLastVScale = w.mVScale;
828 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
829 "alpha=" + mShownAlpha + " layer=" + mAnimLayer
830 + " matrix=[" + (mDsDx*w.mHScale)
831 + "," + (mDtDx*w.mVScale)
832 + "][" + (mDsDy*w.mHScale)
833 + "," + (mDtDy*w.mVScale) + "]", null);
834 if (mSurface != null) {
835 try {
836 mSurfaceAlpha = mShownAlpha;
837 mSurface.setAlpha(mShownAlpha);
838 mSurfaceLayer = w.mWinAnimator.mAnimLayer;
839 mSurface.setLayer(w.mWinAnimator.mAnimLayer);
840 mSurface.setMatrix(
841 mDsDx*w.mHScale, mDtDx*w.mVScale,
842 mDsDy*w.mHScale, mDtDy*w.mVScale);
843 } catch (RuntimeException e) {
844 Slog.w(TAG, "Error updating surface in " + w, e);
845 if (!recoveringMemory) {
846 mService.reclaimSomeSurfaceMemoryLocked(this, "update", true);
847 }
848 }
849 }
850
851 if (w.mLastHidden && w.isDrawnLw()
852 && !w.mReadyToShow) {
853 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
854 "SHOW (performLayout)", null);
855 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + w
856 + " during relayout");
857 if (showSurfaceRobustlyLocked()) {
858 w.mHasDrawn = true;
859 w.mLastHidden = false;
860 } else {
861 w.mOrientationChanging = false;
862 }
863 }
864 if (mSurface != null) {
865 w.mToken.hasVisible = true;
866 }
867 } else {
868 displayed = true;
869 }
870
871 if (displayed) {
872 if (w.mOrientationChanging) {
873 if (!w.isDrawnLw()) {
874 mService.mInnerFields.mOrientationChangeComplete = false;
875 if (WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
876 "Orientation continue waiting for draw in " + w);
877 } else {
878 w.mOrientationChanging = false;
879 if (WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
880 "Orientation change complete in " + w);
881 }
882 }
883 w.mToken.hasVisible = true;
884 }
885 }
886
887 // This must be called while inside a transaction.
888 boolean performShowLocked() {
889 if (DEBUG_VISIBILITY) {
890 RuntimeException e = null;
891 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
892 e = new RuntimeException();
893 e.fillInStackTrace();
894 }
895 Slog.v(WindowManagerService.TAG, "performShow on " + this
896 + ": readyToShow=" + mWin.mReadyToShow + " readyForDisplay="
897 + mWin.isReadyForDisplay()
898 + " starting=" + (mWin.mAttrs.type == TYPE_APPLICATION_STARTING), e);
899 }
900 if (mWin.mReadyToShow && mWin.isReadyForDisplay()) {
901 if (SHOW_TRANSACTIONS || WindowManagerService.DEBUG_ORIENTATION)
902 WindowManagerService.logSurface(mWin, "SHOW (performShowLocked)", null);
903 if (DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "Showing " + this
904 + " during animation: policyVis=" + mWin.mPolicyVisibility
905 + " attHidden=" + mWin.mAttachedHidden
906 + " tok.hiddenRequested="
907 + (mWin.mAppToken != null ? mWin.mAppToken.hiddenRequested : false)
908 + " tok.hidden="
909 + (mWin.mAppToken != null ? mWin.mAppToken.hidden : false)
910 + " animating=" + mAnimating
911 + " tok animating="
912 + (mWin.mAppToken != null ? mWin.mAppToken.animating : false));
913 if (!showSurfaceRobustlyLocked()) {
914 return false;
915 }
916
917 mService.enableScreenIfNeededLocked();
918
919 applyEnterAnimationLocked();
920
921 mLastAlpha = -1;
922 mWin.mHasDrawn = true;
923 mWin.mLastHidden = false;
924 mWin.mReadyToShow = false;
925
926 int i = mWin.mChildWindows.size();
927 while (i > 0) {
928 i--;
929 WindowState c = mWin.mChildWindows.get(i);
930 if (c.mAttachedHidden) {
931 c.mAttachedHidden = false;
932 if (c.mWinAnimator.mSurface != null) {
933 c.mWinAnimator.performShowLocked();
934 // It hadn't been shown, which means layout not
935 // performed on it, so now we want to make sure to
936 // do a layout. If called from within the transaction
937 // loop, this will cause it to restart with a new
938 // layout.
939 mService.mLayoutNeeded = true;
940 }
941 }
942 }
943
944 if (mWin.mAttrs.type != TYPE_APPLICATION_STARTING
945 && mWin.mAppToken != null) {
946 mWin.mAppToken.firstWindowDrawn = true;
947
948 if (mWin.mAppToken.startingData != null) {
949 if (WindowManagerService.DEBUG_STARTING_WINDOW ||
950 WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
951 "Finish starting " + mWin.mToken
952 + ": first real window is shown, no animation");
953 // If this initial window is animating, stop it -- we
954 // will do an animation to reveal it from behind the
955 // starting window, so there is no need for it to also
956 // be doing its own stuff.
957 if (mAnimation != null) {
958 mAnimation.cancel();
959 mAnimation = null;
960 // Make sure we clean up the animation.
961 mAnimating = true;
962 }
963 mService.mFinishedStarting.add(mWin.mAppToken);
964 mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
965 }
966 mWin.mAppToken.updateReportedVisibilityLocked();
967 }
968
969 return true;
970 }
971
972 return false;
973 }
974
975 /**
976 * Have the surface flinger show a surface, robustly dealing with
977 * error conditions. In particular, if there is not enough memory
978 * to show the surface, then we will try to get rid of other surfaces
979 * in order to succeed.
980 *
981 * @return Returns true if the surface was successfully shown.
982 */
983 boolean showSurfaceRobustlyLocked() {
984 try {
985 if (mSurface != null) {
986 mSurfaceShown = true;
987 mSurface.show();
988 if (mWin.mTurnOnScreen) {
989 if (DEBUG_VISIBILITY) Slog.v(TAG,
990 "Show surface turning screen on: " + mWin);
991 mWin.mTurnOnScreen = false;
992 mService.mTurnOnScreen = true;
993 }
994 }
995 return true;
996 } catch (RuntimeException e) {
997 Slog.w(TAG, "Failure showing surface " + mSurface + " in " + mWin, e);
998 }
999
1000 mService.reclaimSomeSurfaceMemoryLocked(this, "show", true);
1001
1002 return false;
1003 }
1004
1005 void applyEnterAnimationLocked() {
1006 final int transit;
1007 if (mEnterAnimationPending) {
1008 mEnterAnimationPending = false;
1009 transit = WindowManagerPolicy.TRANSIT_ENTER;
1010 } else {
1011 transit = WindowManagerPolicy.TRANSIT_SHOW;
1012 }
1013
1014 applyAnimationLocked(transit, true);
1015 }
1016
1017 /**
1018 * Choose the correct animation and set it to the passed WindowState.
1019 * @param transit If WindowManagerPolicy.TRANSIT_PREVIEW_DONE and the app window has been drawn
1020 * then the animation will be app_starting_exit. Any other value loads the animation from
1021 * the switch statement below.
1022 * @param isEntrance The animation type the last time this was called. Used to keep from
1023 * loading the same animation twice.
1024 * @return true if an animation has been loaded.
1025 */
1026 boolean applyAnimationLocked(int transit, boolean isEntrance) {
1027 if (mLocalAnimating && mAnimationIsEntrance == isEntrance) {
1028 // If we are trying to apply an animation, but already running
1029 // an animation of the same type, then just leave that one alone.
1030 return true;
1031 }
1032
1033 // Only apply an animation if the display isn't frozen. If it is
1034 // frozen, there is no reason to animate and it can cause strange
1035 // artifacts when we unfreeze the display if some different animation
1036 // is running.
1037 if (mService.okToDisplay()) {
1038 int anim = mPolicy.selectAnimationLw(mWin, transit);
1039 int attr = -1;
1040 Animation a = null;
1041 if (anim != 0) {
1042 a = AnimationUtils.loadAnimation(mContext, anim);
1043 } else {
1044 switch (transit) {
1045 case WindowManagerPolicy.TRANSIT_ENTER:
1046 attr = com.android.internal.R.styleable.WindowAnimation_windowEnterAnimation;
1047 break;
1048 case WindowManagerPolicy.TRANSIT_EXIT:
1049 attr = com.android.internal.R.styleable.WindowAnimation_windowExitAnimation;
1050 break;
1051 case WindowManagerPolicy.TRANSIT_SHOW:
1052 attr = com.android.internal.R.styleable.WindowAnimation_windowShowAnimation;
1053 break;
1054 case WindowManagerPolicy.TRANSIT_HIDE:
1055 attr = com.android.internal.R.styleable.WindowAnimation_windowHideAnimation;
1056 break;
1057 }
1058 if (attr >= 0) {
1059 a = mService.loadAnimation(mWin.mAttrs, attr);
1060 }
1061 }
1062 if (WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
1063 "applyAnimation: win=" + this
1064 + " anim=" + anim + " attr=0x" + Integer.toHexString(attr)
1065 + " mAnimation=" + mAnimation
1066 + " isEntrance=" + isEntrance);
1067 if (a != null) {
1068 if (WindowManagerService.DEBUG_ANIM) {
1069 RuntimeException e = null;
1070 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
1071 e = new RuntimeException();
1072 e.fillInStackTrace();
1073 }
1074 Slog.v(WindowManagerService.TAG, "Loaded animation " + a + " for " + this, e);
1075 }
1076 setAnimation(a);
1077 mAnimationIsEntrance = isEntrance;
1078 }
1079 } else {
1080 clearAnimation();
1081 }
1082
1083 return mAnimation != null;
1084 }
1085
Craig Mautnera2c77052012-03-26 12:14:43 -07001086 public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
1087 if (mAnimating || mLocalAnimating || mAnimationIsEntrance
1088 || mAnimation != null) {
1089 pw.print(prefix); pw.print("mAnimating="); pw.print(mAnimating);
1090 pw.print(" mLocalAnimating="); pw.print(mLocalAnimating);
1091 pw.print(" mAnimationIsEntrance="); pw.print(mAnimationIsEntrance);
1092 pw.print(" mAnimation="); pw.println(mAnimation);
1093 }
1094 if (mHasTransformation || mHasLocalTransformation) {
1095 pw.print(prefix); pw.print("XForm: has=");
1096 pw.print(mHasTransformation);
1097 pw.print(" hasLocal="); pw.print(mHasLocalTransformation);
1098 pw.print(" "); mTransformation.printShortString(pw);
1099 pw.println();
1100 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001101 if (mSurface != null) {
1102 if (dumpAll) {
1103 pw.print(prefix); pw.print("mSurface="); pw.println(mSurface);
1104 }
1105 pw.print(prefix); pw.print("Surface: shown="); pw.print(mSurfaceShown);
1106 pw.print(" layer="); pw.print(mSurfaceLayer);
1107 pw.print(" alpha="); pw.print(mSurfaceAlpha);
1108 pw.print(" rect=("); pw.print(mSurfaceX);
1109 pw.print(","); pw.print(mSurfaceY);
1110 pw.print(") "); pw.print(mSurfaceW);
1111 pw.print(" x "); pw.println(mSurfaceH);
1112 }
1113 if (mPendingDestroySurface != null) {
1114 pw.print(prefix); pw.print("mPendingDestroySurface=");
1115 pw.println(mPendingDestroySurface);
1116 }
1117 if (mSurfaceResized || mSurfaceDestroyDeferred) {
1118 pw.print(prefix); pw.print("mSurfaceResized="); pw.print(mSurfaceResized);
1119 pw.print(" mSurfaceDestroyDeferred="); pw.println(mSurfaceDestroyDeferred);
1120 }
1121 if (mShownAlpha != 1 || mAlpha != 1 || mLastAlpha != 1) {
1122 pw.print(prefix); pw.print("mShownAlpha="); pw.print(mShownAlpha);
1123 pw.print(" mAlpha="); pw.print(mAlpha);
1124 pw.print(" mLastAlpha="); pw.println(mLastAlpha);
1125 }
1126 if (mHaveMatrix || mWin.mGlobalScale != 1) {
1127 pw.print(prefix); pw.print("mGlobalScale="); pw.print(mWin.mGlobalScale);
1128 pw.print(" mDsDx="); pw.print(mDsDx);
1129 pw.print(" mDtDx="); pw.print(mDtDx);
1130 pw.print(" mDsDy="); pw.print(mDsDy);
1131 pw.print(" mDtDy="); pw.println(mDtDy);
1132 }
Craig Mautnera2c77052012-03-26 12:14:43 -07001133 }
1134
1135}