blob: dfa90ede2dc3c91cab2bd22263d99a429cce9871 [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
Craig Mautnerd09cc4b2012-04-04 10:23:31 -07008import static com.android.server.wm.WindowManagerService.LayoutFields.CLEAR_ORIENTATION_CHANGE_COMPLETE;
Craig Mautner7d8df392012-04-06 15:26:23 -07009import static com.android.server.wm.WindowManagerService.LayoutFields.SET_TURN_ON_SCREEN;
Craig Mautnerd09cc4b2012-04-04 10:23:31 -070010
Craig Mautnerc2f9be02012-03-27 17:32:29 -070011import android.content.Context;
12import android.graphics.Matrix;
13import android.graphics.PixelFormat;
Craig Mautner7358fbf2012-04-12 21:06:33 -070014import android.graphics.Point;
15import android.graphics.PointF;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070016import android.graphics.Rect;
Craig Mautner48ba1e72012-04-02 13:18:16 -070017import android.graphics.Region;
Craig Mautnera51a9562012-04-17 17:05:26 -070018import android.os.Debug;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070019import android.os.RemoteException;
Craig Mautnera2c77052012-03-26 12:14:43 -070020import android.util.Slog;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070021import android.view.Surface;
Craig Mautner7358fbf2012-04-12 21:06:33 -070022import android.view.SurfaceSession;
Craig Mautnera2c77052012-03-26 12:14:43 -070023import android.view.WindowManager;
24import android.view.WindowManagerPolicy;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070025import android.view.WindowManager.LayoutParams;
Craig Mautnera2c77052012-03-26 12:14:43 -070026import android.view.animation.Animation;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070027import android.view.animation.AnimationUtils;
Craig Mautnera2c77052012-03-26 12:14:43 -070028import android.view.animation.Transformation;
29
30import com.android.server.wm.WindowManagerService.H;
31
32import java.io.PrintWriter;
Craig Mautner7358fbf2012-04-12 21:06:33 -070033import java.util.ArrayList;
Craig Mautnera2c77052012-03-26 12:14:43 -070034
35/**
Craig Mautnerc2f9be02012-03-27 17:32:29 -070036 * Keep track of animations and surface operations for a single WindowState.
37 **/
Craig Mautnera2c77052012-03-26 12:14:43 -070038class WindowStateAnimator {
Craig Mautnerc2f9be02012-03-27 17:32:29 -070039 static final boolean DEBUG_VISIBILITY = WindowManagerService.DEBUG_VISIBILITY;
40 static final boolean DEBUG_ANIM = WindowManagerService.DEBUG_ANIM;
41 static final boolean DEBUG_LAYERS = WindowManagerService.DEBUG_LAYERS;
42 static final boolean DEBUG_STARTING_WINDOW = WindowManagerService.DEBUG_STARTING_WINDOW;
43 static final boolean SHOW_TRANSACTIONS = WindowManagerService.SHOW_TRANSACTIONS;
44 static final boolean SHOW_LIGHT_TRANSACTIONS = WindowManagerService.SHOW_LIGHT_TRANSACTIONS;
45 static final boolean SHOW_SURFACE_ALLOC = WindowManagerService.SHOW_SURFACE_ALLOC;
46 static final boolean localLOGV = WindowManagerService.localLOGV;
Craig Mautnerc8bc97e2012-04-02 12:54:54 -070047 static final boolean DEBUG_ORIENTATION = WindowManagerService.DEBUG_ORIENTATION;
Craig Mautner7358fbf2012-04-12 21:06:33 -070048 static final boolean DEBUG_SURFACE_TRACE = WindowManagerService.DEBUG_SURFACE_TRACE;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070049
50 static final String TAG = "WindowStateAnimator";
Craig Mautnera2c77052012-03-26 12:14:43 -070051
52 final WindowManagerService mService;
53 final WindowState mWin;
54 final WindowState mAttachedWindow;
Craig Mautnere7ae2502012-03-26 17:11:19 -070055 final WindowAnimator mAnimator;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070056 final Session mSession;
57 final WindowManagerPolicy mPolicy;
58 final Context mContext;
Craig Mautnera2c77052012-03-26 12:14:43 -070059
60 // Currently running animation.
61 boolean mAnimating;
62 boolean mLocalAnimating;
63 Animation mAnimation;
64 boolean mAnimationIsEntrance;
65 boolean mHasTransformation;
66 boolean mHasLocalTransformation;
67 final Transformation mTransformation = new Transformation();
68 boolean mWasAnimating; // Were we animating going into the most recent animation step?
Craig Mautnerc2f9be02012-03-27 17:32:29 -070069 int mAnimLayer;
70 int mLastLayer;
71
72 Surface mSurface;
73 Surface mPendingDestroySurface;
74 boolean mReportDestroySurface;
75 boolean mSurfacePendingDestroy;
76
77 /**
78 * Set when we have changed the size of the surface, to know that
79 * we must tell them application to resize (and thus redraw itself).
80 */
81 boolean mSurfaceResized;
82
83 /**
84 * Set if the client has asked that the destroy of its surface be delayed
85 * until it explicitly says it is okay.
86 */
87 boolean mSurfaceDestroyDeferred;
88
Craig Mautner7d8df392012-04-06 15:26:23 -070089 float mShownAlpha = 0;
90 float mAlpha = 0;
91 float mLastAlpha = 0;
Craig Mautnerc2f9be02012-03-27 17:32:29 -070092
93 // Used to save animation distances between the time they are calculated and when they are
94 // used.
95 int mAnimDw;
96 int mAnimDh;
97 float mDsDx=1, mDtDx=0, mDsDy=0, mDtDy=1;
98 float mLastDsDx=1, mLastDtDx=0, mLastDsDy=0, mLastDtDy=1;
99
100 boolean mHaveMatrix;
101
102 // For debugging, this is the last information given to the surface flinger.
103 boolean mSurfaceShown;
104 float mSurfaceX, mSurfaceY, mSurfaceW, mSurfaceH;
105 int mSurfaceLayer;
106 float mSurfaceAlpha;
107
108 // Set to true if, when the window gets displayed, it should perform
109 // an enter animation.
110 boolean mEnterAnimationPending;
Craig Mautnera2c77052012-03-26 12:14:43 -0700111
Craig Mautner749a7bb2012-04-02 13:49:53 -0700112 /** This is set when there is no Surface */
113 static final int NO_SURFACE = 0;
114 /** This is set after the Surface has been created but before the window has been drawn. During
115 * this time the surface is hidden. */
116 static final int DRAW_PENDING = 1;
117 /** This is set after the window has finished drawing for the first time but before its surface
118 * is shown. The surface will be displayed when the next layout is run. */
119 static final int COMMIT_DRAW_PENDING = 2;
120 /** This is set during the time after the window's drawing has been committed, and before its
121 * surface is actually shown. It is used to delay showing the surface until all windows in a
122 * token are ready to be shown. */
123 static final int READY_TO_SHOW = 3;
124 /** Set when the window has been shown in the screen the first time. */
125 static final int HAS_DRAWN = 4;
126 int mDrawState;
Craig Mautnera608b882012-03-30 13:03:49 -0700127
Craig Mautner749a7bb2012-04-02 13:49:53 -0700128 /** Was this window last hidden? */
129 boolean mLastHidden;
Craig Mautnera608b882012-03-30 13:03:49 -0700130
Craig Mautnerbec53f72012-04-05 11:49:05 -0700131 int mAttrFlags;
132 int mAttrType;
133
Craig Mautnera2c77052012-03-26 12:14:43 -0700134 public WindowStateAnimator(final WindowManagerService service, final WindowState win,
135 final WindowState attachedWindow) {
136 mService = service;
137 mWin = win;
138 mAttachedWindow = attachedWindow;
Craig Mautnere7ae2502012-03-26 17:11:19 -0700139 mAnimator = mService.mAnimator;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700140 mSession = win.mSession;
141 mPolicy = mService.mPolicy;
142 mContext = mService.mContext;
Craig Mautnerbec53f72012-04-05 11:49:05 -0700143 mAttrFlags = win.mAttrs.flags;
144 mAttrType = win.mAttrs.type;
Craig Mautnera2c77052012-03-26 12:14:43 -0700145 }
146
147 public void setAnimation(Animation anim) {
Craig Mautnerbec53f72012-04-05 11:49:05 -0700148 if (localLOGV) Slog.v(TAG, "Setting animation in " + this + ": " + anim);
Craig Mautnera2c77052012-03-26 12:14:43 -0700149 mAnimating = false;
150 mLocalAnimating = false;
151 mAnimation = anim;
152 mAnimation.restrictDuration(WindowManagerService.MAX_ANIMATION_DURATION);
153 mAnimation.scaleCurrentDuration(mService.mWindowAnimationScale);
154 // Start out animation gone if window is gone, or visible if window is visible.
155 mTransformation.clear();
Craig Mautner749a7bb2012-04-02 13:49:53 -0700156 mTransformation.setAlpha(mLastHidden ? 0 : 1);
Craig Mautnera2c77052012-03-26 12:14:43 -0700157 mHasLocalTransformation = true;
158 }
159
160 public void clearAnimation() {
161 if (mAnimation != null) {
162 mAnimating = true;
163 mLocalAnimating = false;
164 mAnimation.cancel();
165 mAnimation = null;
166 }
167 }
168
169 /** Is the window or its container currently animating? */
170 boolean isAnimating() {
171 final WindowState attached = mAttachedWindow;
172 final AppWindowToken atoken = mWin.mAppToken;
173 return mAnimation != null
174 || (attached != null && attached.mWinAnimator.mAnimation != null)
175 || (atoken != null &&
Craig Mautner59431632012-04-04 11:56:44 -0700176 (atoken.mAppAnimator.animation != null
Craig Mautnera2c77052012-03-26 12:14:43 -0700177 || atoken.inPendingTransaction));
178 }
179
Craig Mautner0afddcb2012-05-08 15:38:00 -0700180 /** Is the window animating the DummyAnimation? */
181 boolean isDummyAnimation() {
182 final AppWindowToken atoken = mWin.mAppToken;
183 return atoken != null
184 && atoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation;
185 }
186
Craig Mautnera2c77052012-03-26 12:14:43 -0700187 /** Is this window currently animating? */
188 boolean isWindowAnimating() {
189 return mAnimation != null;
190 }
191
Craig Mautnera2c77052012-03-26 12:14:43 -0700192 void cancelExitAnimationForNextAnimationLocked() {
Craig Mautnera2c77052012-03-26 12:14:43 -0700193 if (mAnimation != null) {
194 mAnimation.cancel();
195 mAnimation = null;
Craig Mautner4d7349b2012-04-20 14:52:47 -0700196 mLocalAnimating = false;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700197 destroySurfaceLocked();
Craig Mautnera2c77052012-03-26 12:14:43 -0700198 }
Craig Mautnera2c77052012-03-26 12:14:43 -0700199 }
200
201 private boolean stepAnimation(long currentTime) {
202 if ((mAnimation == null) || !mLocalAnimating) {
203 return false;
204 }
205 mTransformation.clear();
206 final boolean more = mAnimation.getTransformation(currentTime, mTransformation);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700207 if (DEBUG_ANIM) Slog.v(
208 TAG, "Stepped animation in " + this +
Craig Mautnera2c77052012-03-26 12:14:43 -0700209 ": more=" + more + ", xform=" + mTransformation);
210 return more;
211 }
212
213 // This must be called while inside a transaction. Returns true if
214 // there is more animation to run.
215 boolean stepAnimationLocked(long currentTime) {
216 // Save the animation state as it was before this step so WindowManagerService can tell if
217 // we just started or just stopped animating by comparing mWasAnimating with isAnimating().
218 mWasAnimating = mAnimating;
219 if (mService.okToDisplay()) {
220 // We will run animations as long as the display isn't frozen.
221
222 if (mWin.isDrawnLw() && mAnimation != null) {
223 mHasTransformation = true;
224 mHasLocalTransformation = true;
225 if (!mLocalAnimating) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700226 if (DEBUG_ANIM) Slog.v(
227 TAG, "Starting animation in " + this +
Craig Mautnera2c77052012-03-26 12:14:43 -0700228 " @ " + currentTime + ": ww=" + mWin.mFrame.width() +
229 " wh=" + mWin.mFrame.height() +
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700230 " dw=" + mAnimDw + " dh=" + mAnimDh +
Craig Mautnera2c77052012-03-26 12:14:43 -0700231 " scale=" + mService.mWindowAnimationScale);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700232 mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(),
233 mAnimDw, mAnimDh);
Craig Mautnera2c77052012-03-26 12:14:43 -0700234 mAnimation.setStartTime(currentTime);
235 mLocalAnimating = true;
236 mAnimating = true;
237 }
238 if ((mAnimation != null) && mLocalAnimating) {
239 if (stepAnimation(currentTime)) {
240 return true;
241 }
242 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700243 if (DEBUG_ANIM) Slog.v(
244 TAG, "Finished animation in " + this +
Craig Mautnera2c77052012-03-26 12:14:43 -0700245 " @ " + currentTime);
246 //WindowManagerService.this.dump();
247 }
248 mHasLocalTransformation = false;
249 if ((!mLocalAnimating || mAnimationIsEntrance) && mWin.mAppToken != null
Craig Mautner59431632012-04-04 11:56:44 -0700250 && mWin.mAppToken.mAppAnimator.animation != null) {
Craig Mautnera2c77052012-03-26 12:14:43 -0700251 // When our app token is animating, we kind-of pretend like
252 // we are as well. Note the mLocalAnimating mAnimationIsEntrance
253 // part of this check means that we will only do this if
254 // our window is not currently exiting, or it is not
255 // locally animating itself. The idea being that one that
256 // is exiting and doing a local animation should be removed
257 // once that animation is done.
258 mAnimating = true;
259 mHasTransformation = true;
260 mTransformation.clear();
261 return false;
262 } else if (mHasTransformation) {
263 // Little trick to get through the path below to act like
264 // we have finished an animation.
265 mAnimating = true;
266 } else if (isAnimating()) {
267 mAnimating = true;
268 }
269 } else if (mAnimation != null) {
270 // If the display is frozen, and there is a pending animation,
271 // clear it and make sure we run the cleanup code.
272 mAnimating = true;
Craig Mautnera2c77052012-03-26 12:14:43 -0700273 }
274
275 if (!mAnimating && !mLocalAnimating) {
276 return false;
277 }
278
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700279 // Done animating, clean up.
280 if (DEBUG_ANIM) Slog.v(
281 TAG, "Animation done in " + this + ": exiting=" + mWin.mExiting
Craig Mautnera2c77052012-03-26 12:14:43 -0700282 + ", reportedVisible="
283 + (mWin.mAppToken != null ? mWin.mAppToken.reportedVisible : false));
284
285 mAnimating = false;
286 mLocalAnimating = false;
287 if (mAnimation != null) {
288 mAnimation.cancel();
289 mAnimation = null;
290 }
Craig Mautnere7ae2502012-03-26 17:11:19 -0700291 if (mAnimator.mWindowDetachedWallpaper == mWin) {
292 mAnimator.mWindowDetachedWallpaper = null;
Craig Mautnera2c77052012-03-26 12:14:43 -0700293 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700294 mAnimLayer = mWin.mLayer;
Craig Mautnera2c77052012-03-26 12:14:43 -0700295 if (mWin.mIsImWindow) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700296 mAnimLayer += mService.mInputMethodAnimLayerAdjustment;
Craig Mautnera2c77052012-03-26 12:14:43 -0700297 } else if (mWin.mIsWallpaper) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700298 mAnimLayer += mService.mWallpaperAnimLayerAdjustment;
Craig Mautnera2c77052012-03-26 12:14:43 -0700299 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700300 if (DEBUG_LAYERS) Slog.v(TAG, "Stepping win " + this
301 + " anim layer: " + mAnimLayer);
Craig Mautnera2c77052012-03-26 12:14:43 -0700302 mHasTransformation = false;
303 mHasLocalTransformation = false;
304 if (mWin.mPolicyVisibility != mWin.mPolicyVisibilityAfterAnim) {
305 if (WindowState.DEBUG_VISIBILITY) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700306 Slog.v(TAG, "Policy visibility changing after anim in " + this + ": "
Craig Mautnera2c77052012-03-26 12:14:43 -0700307 + mWin.mPolicyVisibilityAfterAnim);
308 }
309 mWin.mPolicyVisibility = mWin.mPolicyVisibilityAfterAnim;
310 mService.mLayoutNeeded = true;
311 if (!mWin.mPolicyVisibility) {
312 if (mService.mCurrentFocus == mWin) {
313 mService.mFocusMayChange = true;
314 }
315 // Window is no longer visible -- make sure if we were waiting
316 // for it to be displayed before enabling the display, that
317 // we allow the display to be enabled now.
318 mService.enableScreenIfNeededLocked();
319 }
320 }
321 mTransformation.clear();
Craig Mautner749a7bb2012-04-02 13:49:53 -0700322 if (mDrawState == HAS_DRAWN
Craig Mautnera2c77052012-03-26 12:14:43 -0700323 && mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING
324 && mWin.mAppToken != null
325 && mWin.mAppToken.firstWindowDrawn
326 && mWin.mAppToken.startingData != null) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700327 if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Finish starting "
Craig Mautnera2c77052012-03-26 12:14:43 -0700328 + mWin.mToken + ": first real window done animating");
329 mService.mFinishedStarting.add(mWin.mAppToken);
330 mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
331 }
332
333 finishExit();
Craig Mautnerd09cc4b2012-04-04 10:23:31 -0700334 mAnimator.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
335 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) mService.debugLayoutRepeats(
336 "WindowStateAnimator", mAnimator.mPendingLayoutChanges);
Craig Mautnera2c77052012-03-26 12:14:43 -0700337
338 if (mWin.mAppToken != null) {
339 mWin.mAppToken.updateReportedVisibilityLocked();
340 }
341
342 return false;
343 }
344
345 void finishExit() {
346 if (WindowManagerService.DEBUG_ANIM) Slog.v(
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700347 TAG, "finishExit in " + this
Craig Mautnera2c77052012-03-26 12:14:43 -0700348 + ": exiting=" + mWin.mExiting
349 + " remove=" + mWin.mRemoveOnExit
350 + " windowAnimating=" + isWindowAnimating());
351
352 final int N = mWin.mChildWindows.size();
353 for (int i=0; i<N; i++) {
354 mWin.mChildWindows.get(i).mWinAnimator.finishExit();
355 }
356
357 if (!mWin.mExiting) {
358 return;
359 }
360
361 if (isWindowAnimating()) {
362 return;
363 }
364
365 if (WindowManagerService.localLOGV) Slog.v(
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700366 TAG, "Exit animation finished in " + this
Craig Mautnera2c77052012-03-26 12:14:43 -0700367 + ": remove=" + mWin.mRemoveOnExit);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700368 if (mSurface != null) {
Craig Mautnera2c77052012-03-26 12:14:43 -0700369 mService.mDestroySurface.add(mWin);
370 mWin.mDestroying = true;
371 if (WindowState.SHOW_TRANSACTIONS) WindowManagerService.logSurface(
372 mWin, "HIDE (finishExit)", null);
Craig Mautner0afddcb2012-05-08 15:38:00 -0700373 hide();
Craig Mautnera2c77052012-03-26 12:14:43 -0700374 }
375 mWin.mExiting = false;
376 if (mWin.mRemoveOnExit) {
377 mService.mPendingRemove.add(mWin);
378 mWin.mRemoveOnExit = false;
379 }
Craig Mautner0afddcb2012-05-08 15:38:00 -0700380 if (mService.mWallpaperTarget == mWin) {
381 mAnimator.hideWallpapersLocked();
382 }
383 }
384
385 void hide() {
386 if (!mLastHidden) {
387 //dump();
388 mLastHidden = true;
389 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
390 "HIDE (performLayout)", null);
391 if (mSurface != null) {
392 mSurfaceShown = false;
393 try {
394 mSurface.hide();
395 } catch (RuntimeException e) {
396 Slog.w(TAG, "Exception hiding surface in " + mWin);
397 }
398 }
399 }
Craig Mautnera2c77052012-03-26 12:14:43 -0700400 }
401
Craig Mautnera608b882012-03-30 13:03:49 -0700402 boolean finishDrawingLocked() {
Craig Mautner749a7bb2012-04-02 13:49:53 -0700403 if (mDrawState == DRAW_PENDING) {
Craig Mautner83339b42012-05-01 22:13:23 -0700404 if (DEBUG_ANIM || SHOW_TRANSACTIONS || DEBUG_ORIENTATION) Slog.v(
405 TAG, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING " + this + " in "
406 + mSurface);
Craig Mautner749a7bb2012-04-02 13:49:53 -0700407 mDrawState = COMMIT_DRAW_PENDING;
Craig Mautnera608b882012-03-30 13:03:49 -0700408 return true;
409 }
410 return false;
411 }
412
413 // This must be called while inside a transaction.
414 boolean commitFinishDrawingLocked(long currentTime) {
Craig Mautner749a7bb2012-04-02 13:49:53 -0700415 if (mDrawState != COMMIT_DRAW_PENDING) {
Craig Mautnera608b882012-03-30 13:03:49 -0700416 return false;
417 }
Craig Mautner83339b42012-05-01 22:13:23 -0700418 if (DEBUG_ANIM)
419 Slog.i(TAG, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW " + mSurface);
Craig Mautner749a7bb2012-04-02 13:49:53 -0700420 mDrawState = READY_TO_SHOW;
Craig Mautnera608b882012-03-30 13:03:49 -0700421 final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING;
422 final AppWindowToken atoken = mWin.mAppToken;
423 if (atoken == null || atoken.allDrawn || starting) {
424 performShowLocked();
425 }
426 return true;
427 }
428
Craig Mautner7d8df392012-04-06 15:26:23 -0700429 static class SurfaceTrace extends Surface {
430 private final static String SURFACE_TAG = "SurfaceTrace";
431 final static ArrayList<SurfaceTrace> sSurfaces = new ArrayList<SurfaceTrace>();
Craig Mautner7358fbf2012-04-12 21:06:33 -0700432
Craig Mautner7d8df392012-04-06 15:26:23 -0700433 private float mSurfaceTraceAlpha = 0;
Craig Mautner7358fbf2012-04-12 21:06:33 -0700434 private int mLayer;
435 private PointF mPosition = new PointF();
Craig Mautner7d8df392012-04-06 15:26:23 -0700436 private Point mSize;
Craig Mautner7358fbf2012-04-12 21:06:33 -0700437 private boolean mShown = false;
438 private String mName = "Not named";
439
Craig Mautner7d8df392012-04-06 15:26:23 -0700440 public SurfaceTrace(SurfaceSession s,
Craig Mautner7358fbf2012-04-12 21:06:33 -0700441 int pid, int display, int w, int h, int format, int flags) throws
442 OutOfResourcesException {
443 super(s, pid, display, w, h, format, flags);
444 mSize = new Point(w, h);
Craig Mautner7d8df392012-04-06 15:26:23 -0700445 Slog.v(SURFACE_TAG, "ctor: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700446 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700447 }
448
Craig Mautner7d8df392012-04-06 15:26:23 -0700449 public SurfaceTrace(SurfaceSession s,
Craig Mautner7358fbf2012-04-12 21:06:33 -0700450 int pid, String name, int display, int w, int h, int format, int flags)
451 throws OutOfResourcesException {
452 super(s, pid, name, display, w, h, format, flags);
453 mName = name;
454 mSize = new Point(w, h);
Craig Mautner7d8df392012-04-06 15:26:23 -0700455 Slog.v(SURFACE_TAG, "ctor: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700456 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700457 }
458
459 @Override
460 public void setAlpha(float alpha) {
461 super.setAlpha(alpha);
Craig Mautner7d8df392012-04-06 15:26:23 -0700462 mSurfaceTraceAlpha = alpha;
463 Slog.v(SURFACE_TAG, "setAlpha: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700464 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700465 }
466
467 @Override
468 public void setLayer(int zorder) {
469 super.setLayer(zorder);
470 mLayer = zorder;
Craig Mautner7d8df392012-04-06 15:26:23 -0700471 Slog.v(SURFACE_TAG, "setLayer: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700472 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700473
474 sSurfaces.remove(this);
475 int i;
476 for (i = sSurfaces.size() - 1; i >= 0; i--) {
Craig Mautner7d8df392012-04-06 15:26:23 -0700477 SurfaceTrace s = sSurfaces.get(i);
Craig Mautner7358fbf2012-04-12 21:06:33 -0700478 if (s.mLayer < zorder) {
479 break;
480 }
481 }
482 sSurfaces.add(i + 1, this);
483 }
484
485 @Override
486 public void setPosition(float x, float y) {
487 super.setPosition(x, y);
488 mPosition = new PointF(x, y);
Craig Mautner7d8df392012-04-06 15:26:23 -0700489 Slog.v(SURFACE_TAG, "setPosition: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700490 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700491 }
492
493 @Override
494 public void setSize(int w, int h) {
495 super.setSize(w, h);
496 mSize = new Point(w, h);
Craig Mautner7d8df392012-04-06 15:26:23 -0700497 Slog.v(SURFACE_TAG, "setSize: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700498 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700499 }
500
501 @Override
502 public void hide() {
503 super.hide();
504 mShown = false;
Craig Mautner7d8df392012-04-06 15:26:23 -0700505 Slog.v(SURFACE_TAG, "hide: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700506 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700507 }
508 @Override
509 public void show() {
510 super.show();
511 mShown = true;
Craig Mautner7d8df392012-04-06 15:26:23 -0700512 Slog.v(SURFACE_TAG, "show: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700513 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700514 }
515
516 @Override
517 public void destroy() {
518 super.destroy();
Craig Mautner7d8df392012-04-06 15:26:23 -0700519 Slog.v(SURFACE_TAG, "destroy: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700520 + Debug.getCallers(3));
Craig Mautner7358fbf2012-04-12 21:06:33 -0700521 sSurfaces.remove(this);
522 }
523
Craig Mautneracaf9cc2012-04-17 11:45:25 -0700524 @Override
525 public void release() {
526 super.release();
527 Slog.v(SURFACE_TAG, "release: " + this + ". Called by "
Craig Mautnera51a9562012-04-17 17:05:26 -0700528 + Debug.getCallers(3));
Craig Mautneracaf9cc2012-04-17 11:45:25 -0700529 sSurfaces.remove(this);
530 }
531
Craig Mautner7358fbf2012-04-12 21:06:33 -0700532 static void dumpAllSurfaces() {
533 final int N = sSurfaces.size();
534 for (int i = 0; i < N; i++) {
535 Slog.i(TAG, "SurfaceDump: " + sSurfaces.get(i));
536 }
537 }
538
539 @Override
540 public String toString() {
Craig Mautnerfbf378c2012-04-23 17:24:21 -0700541 return "Surface " + Integer.toHexString(System.identityHashCode(this)) + " "
542 + mName + ": shown=" + mShown + " layer=" + mLayer
Craig Mautner7d8df392012-04-06 15:26:23 -0700543 + " alpha=" + mSurfaceTraceAlpha + " " + mPosition.x + "," + mPosition.y
Craig Mautner7358fbf2012-04-12 21:06:33 -0700544 + " " + mSize.x + "x" + mSize.y;
545 }
546 }
547
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700548 Surface createSurfaceLocked() {
549 if (mSurface == null) {
550 mReportDestroySurface = false;
551 mSurfacePendingDestroy = false;
Craig Mautner83339b42012-05-01 22:13:23 -0700552 if (DEBUG_ANIM || DEBUG_ORIENTATION) Slog.i(TAG,
553 "createSurface " + this + ": mDrawState=DRAW_PENDING");
Craig Mautner749a7bb2012-04-02 13:49:53 -0700554 mDrawState = DRAW_PENDING;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700555 if (mWin.mAppToken != null) {
556 mWin.mAppToken.allDrawn = false;
557 }
558
559 mService.makeWindowFreezingScreenIfNeededLocked(mWin);
560
561 int flags = 0;
562 final WindowManager.LayoutParams attrs = mWin.mAttrs;
563
564 if ((attrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) {
565 flags |= Surface.SECURE;
566 }
567 if (WindowState.DEBUG_VISIBILITY) Slog.v(
568 TAG, "Creating surface in session "
569 + mSession.mSurfaceSession + " window " + this
570 + " w=" + mWin.mCompatFrame.width()
571 + " h=" + mWin.mCompatFrame.height() + " format="
572 + attrs.format + " flags=" + flags);
573
574 int w = mWin.mCompatFrame.width();
575 int h = mWin.mCompatFrame.height();
576 if ((attrs.flags & LayoutParams.FLAG_SCALED) != 0) {
577 // for a scaled surface, we always want the requested
578 // size.
579 w = mWin.mRequestedWidth;
580 h = mWin.mRequestedHeight;
581 }
582
583 // Something is wrong and SurfaceFlinger will not like this,
584 // try to revert to sane values
585 if (w <= 0) w = 1;
586 if (h <= 0) h = 1;
587
588 mSurfaceShown = false;
589 mSurfaceLayer = 0;
Craig Mautner7d8df392012-04-06 15:26:23 -0700590 mSurfaceAlpha = 0;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700591 mSurfaceX = 0;
592 mSurfaceY = 0;
593 mSurfaceW = w;
594 mSurfaceH = h;
595 try {
596 final boolean isHwAccelerated = (attrs.flags &
597 WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
598 final int format = isHwAccelerated ? PixelFormat.TRANSLUCENT : attrs.format;
599 if (!PixelFormat.formatHasAlpha(attrs.format)) {
600 flags |= Surface.OPAQUE;
601 }
Craig Mautner7358fbf2012-04-12 21:06:33 -0700602 if (DEBUG_SURFACE_TRACE) {
Craig Mautner7d8df392012-04-06 15:26:23 -0700603 mSurface = new SurfaceTrace(
Craig Mautner7358fbf2012-04-12 21:06:33 -0700604 mSession.mSurfaceSession, mSession.mPid,
605 attrs.getTitle().toString(),
606 0, w, h, format, flags);
607 } else {
608 mSurface = new Surface(
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700609 mSession.mSurfaceSession, mSession.mPid,
610 attrs.getTitle().toString(),
611 0, w, h, format, flags);
Craig Mautner7358fbf2012-04-12 21:06:33 -0700612 }
Craig Mautnerc8bc97e2012-04-02 12:54:54 -0700613 mWin.mHasSurface = true;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700614 if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG,
615 " CREATE SURFACE "
616 + mSurface + " IN SESSION "
617 + mSession.mSurfaceSession
618 + ": pid=" + mSession.mPid + " format="
619 + attrs.format + " flags=0x"
620 + Integer.toHexString(flags)
621 + " / " + this);
622 } catch (Surface.OutOfResourcesException e) {
Craig Mautnerc8bc97e2012-04-02 12:54:54 -0700623 mWin.mHasSurface = false;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700624 Slog.w(TAG, "OutOfResourcesException creating surface");
625 mService.reclaimSomeSurfaceMemoryLocked(this, "create", true);
Craig Mautner749a7bb2012-04-02 13:49:53 -0700626 mDrawState = NO_SURFACE;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700627 return null;
628 } catch (Exception e) {
Craig Mautnerc8bc97e2012-04-02 12:54:54 -0700629 mWin.mHasSurface = false;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700630 Slog.e(TAG, "Exception creating surface", e);
Craig Mautner749a7bb2012-04-02 13:49:53 -0700631 mDrawState = NO_SURFACE;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700632 return null;
633 }
634
635 if (WindowManagerService.localLOGV) Slog.v(
636 TAG, "Got surface: " + mSurface
637 + ", set left=" + mWin.mFrame.left + " top=" + mWin.mFrame.top
638 + ", animLayer=" + mAnimLayer);
639 if (SHOW_LIGHT_TRANSACTIONS) {
640 Slog.i(TAG, ">>> OPEN TRANSACTION createSurfaceLocked");
641 WindowManagerService.logSurface(mWin, "CREATE pos=("
642 + mWin.mFrame.left + "," + mWin.mFrame.top + ") ("
643 + mWin.mCompatFrame.width() + "x" + mWin.mCompatFrame.height()
644 + "), layer=" + mAnimLayer + " HIDE", null);
645 }
646 Surface.openTransaction();
647 try {
648 try {
649 mSurfaceX = mWin.mFrame.left + mWin.mXOffset;
650 mSurfaceY = mWin.mFrame.top + mWin.mYOffset;
651 mSurface.setPosition(mSurfaceX, mSurfaceY);
652 mSurfaceLayer = mAnimLayer;
653 mSurface.setLayer(mAnimLayer);
Craig Mautner7d8df392012-04-06 15:26:23 -0700654 mSurface.setAlpha(0);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700655 mSurfaceShown = false;
656 mSurface.hide();
657 if ((mWin.mAttrs.flags&WindowManager.LayoutParams.FLAG_DITHER) != 0) {
658 if (SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin, "DITHER", null);
659 mSurface.setFlags(Surface.SURFACE_DITHER, Surface.SURFACE_DITHER);
660 }
661 } catch (RuntimeException e) {
662 Slog.w(TAG, "Error creating surface in " + w, e);
663 mService.reclaimSomeSurfaceMemoryLocked(this, "create-init", true);
664 }
Craig Mautner749a7bb2012-04-02 13:49:53 -0700665 mLastHidden = true;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700666 } finally {
667 Surface.closeTransaction();
668 if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
669 "<<< CLOSE TRANSACTION createSurfaceLocked");
670 }
671 if (WindowManagerService.localLOGV) Slog.v(
672 TAG, "Created surface " + this);
673 }
674 return mSurface;
675 }
676
677 void destroySurfaceLocked() {
678 if (mWin.mAppToken != null && mWin == mWin.mAppToken.startingWindow) {
679 mWin.mAppToken.startingDisplayed = false;
680 }
681
Craig Mautner749a7bb2012-04-02 13:49:53 -0700682 mDrawState = NO_SURFACE;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700683 if (mSurface != null) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700684
685 int i = mWin.mChildWindows.size();
686 while (i > 0) {
687 i--;
688 WindowState c = mWin.mChildWindows.get(i);
689 c.mAttachedHidden = true;
690 }
691
692 if (mReportDestroySurface) {
693 mReportDestroySurface = false;
694 mSurfacePendingDestroy = true;
695 try {
696 mWin.mClient.dispatchGetNewSurface();
697 // We'll really destroy on the next time around.
698 return;
699 } catch (RemoteException e) {
700 }
701 }
702
703 try {
704 if (DEBUG_VISIBILITY) {
705 RuntimeException e = null;
706 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
707 e = new RuntimeException();
708 e.fillInStackTrace();
709 }
710 Slog.w(TAG, "Window " + this + " destroying surface "
711 + mSurface + ", session " + mSession, e);
712 }
713 if (mSurfaceDestroyDeferred) {
714 if (mSurface != null && mPendingDestroySurface != mSurface) {
715 if (mPendingDestroySurface != null) {
716 if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
717 RuntimeException e = null;
718 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
719 e = new RuntimeException();
720 e.fillInStackTrace();
721 }
722 WindowManagerService.logSurface(mWin, "DESTROY PENDING", e);
723 }
724 mPendingDestroySurface.destroy();
725 }
726 mPendingDestroySurface = mSurface;
727 }
728 } else {
729 if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
730 RuntimeException e = null;
731 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
732 e = new RuntimeException();
733 e.fillInStackTrace();
734 }
735 WindowManagerService.logSurface(mWin, "DESTROY", e);
736 }
737 mSurface.destroy();
738 }
739 } catch (RuntimeException e) {
740 Slog.w(TAG, "Exception thrown when destroying Window " + this
741 + " surface " + mSurface + " session " + mSession
742 + ": " + e.toString());
743 }
744
745 mSurfaceShown = false;
746 mSurface = null;
Craig Mautnerc8bc97e2012-04-02 12:54:54 -0700747 mWin.mHasSurface =false;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700748 }
749 }
750
751 void destroyDeferredSurfaceLocked() {
752 try {
753 if (mPendingDestroySurface != null) {
754 if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
755 RuntimeException e = null;
756 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
757 e = new RuntimeException();
758 e.fillInStackTrace();
759 }
760 WindowManagerService.logSurface(mWin, "DESTROY PENDING", e);
761 }
762 mPendingDestroySurface.destroy();
763 }
764 } catch (RuntimeException e) {
Craig Mautnerd87946b2012-03-29 18:00:19 -0700765 Slog.w(TAG, "Exception thrown when destroying Window "
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700766 + this + " surface " + mPendingDestroySurface
767 + " session " + mSession + ": " + e.toString());
768 }
769 mSurfaceDestroyDeferred = false;
770 mPendingDestroySurface = null;
771 }
772
773 void computeShownFrameLocked() {
774 final boolean selfTransformation = mHasLocalTransformation;
775 Transformation attachedTransformation =
776 (mAttachedWindow != null && mAttachedWindow.mWinAnimator.mHasLocalTransformation)
777 ? mAttachedWindow.mWinAnimator.mTransformation : null;
Craig Mautner59431632012-04-04 11:56:44 -0700778 final AppWindowAnimator appAnimator =
779 mWin.mAppToken == null ? null : mWin.mAppToken.mAppAnimator;
780 Transformation appTransformation = (appAnimator != null && appAnimator.hasTransformation)
781 ? appAnimator.transformation : null;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700782
783 // Wallpapers are animated based on the "real" window they
784 // are currently targeting.
785 if (mWin.mAttrs.type == TYPE_WALLPAPER && mService.mLowerWallpaperTarget == null
786 && mService.mWallpaperTarget != null) {
787 if (mService.mWallpaperTarget.mWinAnimator.mHasLocalTransformation &&
788 mService.mWallpaperTarget.mWinAnimator.mAnimation != null &&
789 !mService.mWallpaperTarget.mWinAnimator.mAnimation.getDetachWallpaper()) {
790 attachedTransformation = mService.mWallpaperTarget.mWinAnimator.mTransformation;
791 if (WindowManagerService.DEBUG_WALLPAPER && attachedTransformation != null) {
792 Slog.v(TAG, "WP target attached xform: " + attachedTransformation);
793 }
794 }
Craig Mautner59431632012-04-04 11:56:44 -0700795 final AppWindowAnimator wpAppAnimator = mService.mWallpaperTarget.mAppToken == null
796 ? null : mService.mWallpaperTarget.mAppToken.mAppAnimator;
797 if (wpAppAnimator != null &&
798 wpAppAnimator.hasTransformation &&
799 wpAppAnimator.animation != null &&
800 !wpAppAnimator.animation.getDetachWallpaper()) {
801 appTransformation = wpAppAnimator.transformation;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700802 if (WindowManagerService.DEBUG_WALLPAPER && appTransformation != null) {
803 Slog.v(TAG, "WP target app xform: " + appTransformation);
804 }
805 }
806 }
807
808 final boolean screenAnimation = mService.mAnimator.mScreenRotationAnimation != null
809 && mService.mAnimator.mScreenRotationAnimation.isAnimating();
810 if (selfTransformation || attachedTransformation != null
811 || appTransformation != null || screenAnimation) {
812 // cache often used attributes locally
813 final Rect frame = mWin.mFrame;
814 final float tmpFloats[] = mService.mTmpFloats;
815 final Matrix tmpMatrix = mWin.mTmpMatrix;
816
817 // Compute the desired transformation.
818 if (screenAnimation) {
819 // If we are doing a screen animation, the global rotation
820 // applied to windows can result in windows that are carefully
821 // aligned with each other to slightly separate, allowing you
822 // to see what is behind them. An unsightly mess. This...
823 // thing... magically makes it call good: scale each window
824 // slightly (two pixels larger in each dimension, from the
825 // window's center).
826 final float w = frame.width();
827 final float h = frame.height();
828 if (w>=1 && h>=1) {
829 tmpMatrix.setScale(1 + 2/w, 1 + 2/h, w/2, h/2);
830 } else {
831 tmpMatrix.reset();
832 }
833 } else {
834 tmpMatrix.reset();
835 }
836 tmpMatrix.postScale(mWin.mGlobalScale, mWin.mGlobalScale);
837 if (selfTransformation) {
838 tmpMatrix.postConcat(mTransformation.getMatrix());
839 }
840 tmpMatrix.postTranslate(frame.left + mWin.mXOffset, frame.top + mWin.mYOffset);
841 if (attachedTransformation != null) {
842 tmpMatrix.postConcat(attachedTransformation.getMatrix());
843 }
844 if (appTransformation != null) {
845 tmpMatrix.postConcat(appTransformation.getMatrix());
846 }
847 if (screenAnimation) {
848 tmpMatrix.postConcat(
849 mService.mAnimator.mScreenRotationAnimation.getEnterTransformation().getMatrix());
850 }
851
852 // "convert" it into SurfaceFlinger's format
853 // (a 2x2 matrix + an offset)
854 // Here we must not transform the position of the surface
855 // since it is already included in the transformation.
856 //Slog.i(TAG, "Transform: " + matrix);
857
858 mHaveMatrix = true;
859 tmpMatrix.getValues(tmpFloats);
860 mDsDx = tmpFloats[Matrix.MSCALE_X];
861 mDtDx = tmpFloats[Matrix.MSKEW_Y];
862 mDsDy = tmpFloats[Matrix.MSKEW_X];
863 mDtDy = tmpFloats[Matrix.MSCALE_Y];
864 float x = tmpFloats[Matrix.MTRANS_X];
865 float y = tmpFloats[Matrix.MTRANS_Y];
866 int w = frame.width();
867 int h = frame.height();
868 mWin.mShownFrame.set(x, y, x+w, y+h);
869
870 // Now set the alpha... but because our current hardware
871 // can't do alpha transformation on a non-opaque surface,
872 // turn it off if we are running an animation that is also
873 // transforming since it is more important to have that
874 // animation be smooth.
875 mShownAlpha = mAlpha;
876 if (!mService.mLimitedAlphaCompositing
877 || (!PixelFormat.formatHasAlpha(mWin.mAttrs.format)
878 || (mWin.isIdentityMatrix(mDsDx, mDtDx, mDsDy, mDtDy)
879 && x == frame.left && y == frame.top))) {
880 //Slog.i(TAG, "Applying alpha transform");
881 if (selfTransformation) {
882 mShownAlpha *= mTransformation.getAlpha();
883 }
884 if (attachedTransformation != null) {
885 mShownAlpha *= attachedTransformation.getAlpha();
886 }
887 if (appTransformation != null) {
888 mShownAlpha *= appTransformation.getAlpha();
889 }
890 if (screenAnimation) {
891 mShownAlpha *=
892 mService.mAnimator.mScreenRotationAnimation.getEnterTransformation().getAlpha();
893 }
894 } else {
895 //Slog.i(TAG, "Not applying alpha transform");
896 }
897
898 if (WindowManagerService.localLOGV) Slog.v(
899 TAG, "computeShownFrameLocked: Animating " + this +
900 ": " + mWin.mShownFrame +
901 ", alpha=" + mTransformation.getAlpha() + ", mShownAlpha=" + mShownAlpha);
902 return;
Craig Mautner4d7349b2012-04-20 14:52:47 -0700903 } else if (mWin.mIsWallpaper &&
904 (mAnimator.mPendingActions & WindowAnimator.WALLPAPER_ACTION_PENDING) != 0) {
905 return;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700906 }
907
908 if (WindowManagerService.localLOGV) Slog.v(
Craig Mautner4d7349b2012-04-20 14:52:47 -0700909 TAG, "computeShownFrameLocked: " + this +
910 " not attached, mAlpha=" + mAlpha);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700911 mWin.mShownFrame.set(mWin.mFrame);
912 if (mWin.mXOffset != 0 || mWin.mYOffset != 0) {
913 mWin.mShownFrame.offset(mWin.mXOffset, mWin.mYOffset);
914 }
915 mShownAlpha = mAlpha;
916 mHaveMatrix = false;
917 mDsDx = mWin.mGlobalScale;
918 mDtDx = 0;
919 mDsDy = 0;
920 mDtDy = mWin.mGlobalScale;
921 }
Craig Mautnerd87946b2012-03-29 18:00:19 -0700922
Craig Mautneracaf9cc2012-04-17 11:45:25 -0700923 void setSurfaceBoundaries(final boolean recoveringMemory) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700924 final WindowState w = mWin;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700925 int width, height;
926 if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) {
927 // for a scaled surface, we just want to use
928 // the requested size.
929 width = w.mRequestedWidth;
930 height = w.mRequestedHeight;
931 } else {
932 width = w.mCompatFrame.width();
933 height = w.mCompatFrame.height();
934 }
935
936 if (width < 1) {
937 width = 1;
938 }
939 if (height < 1) {
940 height = 1;
941 }
942 final boolean surfaceResized = mSurfaceW != width || mSurfaceH != height;
943 if (surfaceResized) {
944 mSurfaceW = width;
945 mSurfaceH = height;
946 }
947
Craig Mautner4d7349b2012-04-20 14:52:47 -0700948 final float left = w.mShownFrame.left;
949 final float top = w.mShownFrame.top;
950 if (mSurfaceX != left || mSurfaceY != top) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700951 try {
952 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
Craig Mautner4d7349b2012-04-20 14:52:47 -0700953 "POS " + left + ", " + top, null);
954 mSurfaceX = left;
955 mSurfaceY = top;
956 mSurface.setPosition(left, top);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700957 } catch (RuntimeException e) {
958 Slog.w(TAG, "Error positioning surface of " + w
Craig Mautner4d7349b2012-04-20 14:52:47 -0700959 + " pos=(" + left
960 + "," + top + ")", e);
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700961 if (!recoveringMemory) {
962 mService.reclaimSomeSurfaceMemoryLocked(this, "position", true);
963 }
964 }
965 }
966
967 if (surfaceResized) {
968 try {
969 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
970 "SIZE " + width + "x" + height, null);
971 mSurfaceResized = true;
972 mSurface.setSize(width, height);
Craig Mautneracaf9cc2012-04-17 11:45:25 -0700973 mAnimator.mPendingLayoutChanges |=
974 WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700975 } catch (RuntimeException e) {
976 // If something goes wrong with the surface (such
977 // as running out of memory), don't take down the
978 // entire system.
979 Slog.e(TAG, "Error resizing surface of " + w
980 + " size=(" + width + "x" + height + ")", e);
981 if (!recoveringMemory) {
982 mService.reclaimSomeSurfaceMemoryLocked(this, "size", true);
983 }
984 }
985 }
Craig Mautneracaf9cc2012-04-17 11:45:25 -0700986 }
987
988 public void prepareSurfaceLocked(final boolean recoveringMemory) {
989 final WindowState w = mWin;
990 if (mSurface == null) {
991 if (w.mOrientationChanging) {
992 if (DEBUG_ORIENTATION) {
993 Slog.v(TAG, "Orientation change skips hidden " + w);
994 }
995 w.mOrientationChanging = false;
996 }
997 return;
998 }
999
1000 boolean displayed = false;
1001
1002 computeShownFrameLocked();
1003
1004 setSurfaceBoundaries(recoveringMemory);
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001005
Craig Mautnerde6198e2012-04-19 09:59:31 -07001006 if (w.mAttachedHidden || !w.isReadyForDisplay()) {
Craig Mautner0afddcb2012-05-08 15:38:00 -07001007 hide();
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001008 // If we are waiting for this window to handle an
1009 // orientation change, well, it is hidden, so
1010 // doesn't really matter. Note that this does
1011 // introduce a potential glitch if the window
1012 // becomes unhidden before it has drawn for the
1013 // new orientation.
1014 if (w.mOrientationChanging) {
1015 w.mOrientationChanging = false;
Craig Mautnerc8bc97e2012-04-02 12:54:54 -07001016 if (DEBUG_ORIENTATION) Slog.v(TAG,
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001017 "Orientation change skips hidden " + w);
1018 }
1019 } else if (mLastLayer != mAnimLayer
1020 || mLastAlpha != mShownAlpha
1021 || mLastDsDx != mDsDx
1022 || mLastDtDx != mDtDx
1023 || mLastDsDy != mDsDy
1024 || mLastDtDy != mDtDy
1025 || w.mLastHScale != w.mHScale
1026 || w.mLastVScale != w.mVScale
Craig Mautner749a7bb2012-04-02 13:49:53 -07001027 || mLastHidden) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001028 displayed = true;
1029 mLastAlpha = mShownAlpha;
1030 mLastLayer = mAnimLayer;
1031 mLastDsDx = mDsDx;
1032 mLastDtDx = mDtDx;
1033 mLastDsDy = mDsDy;
1034 mLastDtDy = mDtDy;
1035 w.mLastHScale = w.mHScale;
1036 w.mLastVScale = w.mVScale;
1037 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
1038 "alpha=" + mShownAlpha + " layer=" + mAnimLayer
1039 + " matrix=[" + (mDsDx*w.mHScale)
1040 + "," + (mDtDx*w.mVScale)
1041 + "][" + (mDsDy*w.mHScale)
1042 + "," + (mDtDy*w.mVScale) + "]", null);
1043 if (mSurface != null) {
1044 try {
1045 mSurfaceAlpha = mShownAlpha;
1046 mSurface.setAlpha(mShownAlpha);
1047 mSurfaceLayer = w.mWinAnimator.mAnimLayer;
1048 mSurface.setLayer(w.mWinAnimator.mAnimLayer);
1049 mSurface.setMatrix(
1050 mDsDx*w.mHScale, mDtDx*w.mVScale,
1051 mDsDy*w.mHScale, mDtDy*w.mVScale);
Craig Mautner749a7bb2012-04-02 13:49:53 -07001052
1053 if (mLastHidden && mDrawState == HAS_DRAWN) {
1054 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
1055 "SHOW (performLayout)", null);
1056 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + w
1057 + " during relayout");
1058 if (showSurfaceRobustlyLocked()) {
1059 mLastHidden = false;
1060 } else {
1061 w.mOrientationChanging = false;
1062 }
1063 }
1064 if (mSurface != null) {
1065 w.mToken.hasVisible = true;
1066 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001067 } catch (RuntimeException e) {
1068 Slog.w(TAG, "Error updating surface in " + w, e);
1069 if (!recoveringMemory) {
1070 mService.reclaimSomeSurfaceMemoryLocked(this, "update", true);
1071 }
1072 }
1073 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001074 } else {
Craig Mautner83339b42012-05-01 22:13:23 -07001075 if (DEBUG_ANIM) {
1076 Slog.v(TAG, "prepareSurface: No changes in animation for " + mWin);
1077 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001078 displayed = true;
1079 }
1080
1081 if (displayed) {
1082 if (w.mOrientationChanging) {
1083 if (!w.isDrawnLw()) {
Craig Mautnerd09cc4b2012-04-04 10:23:31 -07001084 mAnimator.mBulkUpdateParams |= CLEAR_ORIENTATION_CHANGE_COMPLETE;
Craig Mautnerc8bc97e2012-04-02 12:54:54 -07001085 if (DEBUG_ORIENTATION) Slog.v(TAG,
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001086 "Orientation continue waiting for draw in " + w);
1087 } else {
1088 w.mOrientationChanging = false;
Craig Mautnerc8bc97e2012-04-02 12:54:54 -07001089 if (DEBUG_ORIENTATION) Slog.v(TAG, "Orientation change complete in " + w);
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001090 }
1091 }
1092 w.mToken.hasVisible = true;
1093 }
1094 }
1095
Craig Mautner48ba1e72012-04-02 13:18:16 -07001096 void setTransparentRegionHint(final Region region) {
Craig Mautner1f4e0cc2012-04-10 14:24:38 -07001097 if (mSurface == null) {
1098 Slog.w(TAG, "setTransparentRegionHint: null mSurface after mHasSurface true");
1099 return;
1100 }
Craig Mautner48ba1e72012-04-02 13:18:16 -07001101 if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
1102 ">>> OPEN TRANSACTION setTransparentRegion");
1103 Surface.openTransaction();
1104 try {
1105 if (SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
1106 "transparentRegionHint=" + region, null);
1107 mSurface.setTransparentRegionHint(region);
1108 } finally {
1109 Surface.closeTransaction();
1110 if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
1111 "<<< CLOSE TRANSACTION setTransparentRegion");
1112 }
1113 }
1114
1115 void setWallpaperOffset(int left, int top) {
1116 Surface.openTransaction();
1117 try {
1118 mSurfaceX = left;
1119 mSurfaceY = top;
1120 mSurface.setPosition(left, top);
1121 } catch (RuntimeException e) {
1122 Slog.w(TAG, "Error positioning surface of " + mWin
1123 + " pos=(" + left + "," + top + ")", e);
1124 }
1125 Surface.closeTransaction();
1126 }
1127
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001128 // This must be called while inside a transaction.
1129 boolean performShowLocked() {
1130 if (DEBUG_VISIBILITY) {
1131 RuntimeException e = null;
1132 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
1133 e = new RuntimeException();
1134 e.fillInStackTrace();
1135 }
Craig Mautnerd87946b2012-03-29 18:00:19 -07001136 Slog.v(TAG, "performShow on " + this
Craig Mautner749a7bb2012-04-02 13:49:53 -07001137 + ": mDrawState=" + mDrawState + " readyForDisplay="
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001138 + mWin.isReadyForDisplay()
1139 + " starting=" + (mWin.mAttrs.type == TYPE_APPLICATION_STARTING), e);
1140 }
Craig Mautner749a7bb2012-04-02 13:49:53 -07001141 if (mDrawState == READY_TO_SHOW && mWin.isReadyForDisplay()) {
Craig Mautnerc8bc97e2012-04-02 12:54:54 -07001142 if (SHOW_TRANSACTIONS || DEBUG_ORIENTATION)
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001143 WindowManagerService.logSurface(mWin, "SHOW (performShowLocked)", null);
Craig Mautnerd87946b2012-03-29 18:00:19 -07001144 if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001145 + " during animation: policyVis=" + mWin.mPolicyVisibility
1146 + " attHidden=" + mWin.mAttachedHidden
1147 + " tok.hiddenRequested="
1148 + (mWin.mAppToken != null ? mWin.mAppToken.hiddenRequested : false)
1149 + " tok.hidden="
1150 + (mWin.mAppToken != null ? mWin.mAppToken.hidden : false)
1151 + " animating=" + mAnimating
1152 + " tok animating="
Craig Mautner59431632012-04-04 11:56:44 -07001153 + (mWin.mAppToken != null ? mWin.mAppToken.mAppAnimator.animating : false));
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001154
1155 mService.enableScreenIfNeededLocked();
1156
1157 applyEnterAnimationLocked();
1158
Craig Mautnerde6198e2012-04-19 09:59:31 -07001159 // Force the show in the next prepareSurfaceLocked() call.
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001160 mLastAlpha = -1;
Craig Mautner83339b42012-05-01 22:13:23 -07001161 if (DEBUG_ANIM) Slog.v(TAG, "performShowLocked: mDrawState=HAS_DRAWN");
Craig Mautner749a7bb2012-04-02 13:49:53 -07001162 mDrawState = HAS_DRAWN;
Craig Mautnerde6198e2012-04-19 09:59:31 -07001163 mService.scheduleAnimationLocked();
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001164
1165 int i = mWin.mChildWindows.size();
1166 while (i > 0) {
1167 i--;
1168 WindowState c = mWin.mChildWindows.get(i);
1169 if (c.mAttachedHidden) {
1170 c.mAttachedHidden = false;
1171 if (c.mWinAnimator.mSurface != null) {
1172 c.mWinAnimator.performShowLocked();
1173 // It hadn't been shown, which means layout not
1174 // performed on it, so now we want to make sure to
1175 // do a layout. If called from within the transaction
1176 // loop, this will cause it to restart with a new
1177 // layout.
1178 mService.mLayoutNeeded = true;
1179 }
1180 }
1181 }
1182
1183 if (mWin.mAttrs.type != TYPE_APPLICATION_STARTING
1184 && mWin.mAppToken != null) {
1185 mWin.mAppToken.firstWindowDrawn = true;
1186
1187 if (mWin.mAppToken.startingData != null) {
1188 if (WindowManagerService.DEBUG_STARTING_WINDOW ||
Craig Mautnerd87946b2012-03-29 18:00:19 -07001189 WindowManagerService.DEBUG_ANIM) Slog.v(TAG,
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001190 "Finish starting " + mWin.mToken
1191 + ": first real window is shown, no animation");
1192 // If this initial window is animating, stop it -- we
1193 // will do an animation to reveal it from behind the
1194 // starting window, so there is no need for it to also
1195 // be doing its own stuff.
Craig Mautner4d7349b2012-04-20 14:52:47 -07001196 clearAnimation();
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001197 mService.mFinishedStarting.add(mWin.mAppToken);
1198 mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
1199 }
1200 mWin.mAppToken.updateReportedVisibilityLocked();
1201 }
1202
1203 return true;
1204 }
1205
1206 return false;
1207 }
1208
1209 /**
1210 * Have the surface flinger show a surface, robustly dealing with
1211 * error conditions. In particular, if there is not enough memory
1212 * to show the surface, then we will try to get rid of other surfaces
1213 * in order to succeed.
1214 *
1215 * @return Returns true if the surface was successfully shown.
1216 */
1217 boolean showSurfaceRobustlyLocked() {
1218 try {
1219 if (mSurface != null) {
1220 mSurfaceShown = true;
1221 mSurface.show();
1222 if (mWin.mTurnOnScreen) {
1223 if (DEBUG_VISIBILITY) Slog.v(TAG,
1224 "Show surface turning screen on: " + mWin);
1225 mWin.mTurnOnScreen = false;
Craig Mautner7d8df392012-04-06 15:26:23 -07001226 mAnimator.mBulkUpdateParams |= SET_TURN_ON_SCREEN;
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001227 }
1228 }
1229 return true;
1230 } catch (RuntimeException e) {
1231 Slog.w(TAG, "Failure showing surface " + mSurface + " in " + mWin, e);
1232 }
1233
1234 mService.reclaimSomeSurfaceMemoryLocked(this, "show", true);
1235
1236 return false;
1237 }
1238
1239 void applyEnterAnimationLocked() {
1240 final int transit;
1241 if (mEnterAnimationPending) {
1242 mEnterAnimationPending = false;
1243 transit = WindowManagerPolicy.TRANSIT_ENTER;
1244 } else {
1245 transit = WindowManagerPolicy.TRANSIT_SHOW;
1246 }
1247
1248 applyAnimationLocked(transit, true);
1249 }
1250
Craig Mautner48ba1e72012-04-02 13:18:16 -07001251 // TODO(cmautner): Move back to WindowState?
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001252 /**
1253 * Choose the correct animation and set it to the passed WindowState.
1254 * @param transit If WindowManagerPolicy.TRANSIT_PREVIEW_DONE and the app window has been drawn
1255 * then the animation will be app_starting_exit. Any other value loads the animation from
1256 * the switch statement below.
1257 * @param isEntrance The animation type the last time this was called. Used to keep from
1258 * loading the same animation twice.
1259 * @return true if an animation has been loaded.
1260 */
1261 boolean applyAnimationLocked(int transit, boolean isEntrance) {
1262 if (mLocalAnimating && mAnimationIsEntrance == isEntrance) {
1263 // If we are trying to apply an animation, but already running
1264 // an animation of the same type, then just leave that one alone.
1265 return true;
1266 }
1267
1268 // Only apply an animation if the display isn't frozen. If it is
1269 // frozen, there is no reason to animate and it can cause strange
1270 // artifacts when we unfreeze the display if some different animation
1271 // is running.
1272 if (mService.okToDisplay()) {
1273 int anim = mPolicy.selectAnimationLw(mWin, transit);
1274 int attr = -1;
1275 Animation a = null;
1276 if (anim != 0) {
1277 a = AnimationUtils.loadAnimation(mContext, anim);
1278 } else {
1279 switch (transit) {
1280 case WindowManagerPolicy.TRANSIT_ENTER:
1281 attr = com.android.internal.R.styleable.WindowAnimation_windowEnterAnimation;
1282 break;
1283 case WindowManagerPolicy.TRANSIT_EXIT:
1284 attr = com.android.internal.R.styleable.WindowAnimation_windowExitAnimation;
1285 break;
1286 case WindowManagerPolicy.TRANSIT_SHOW:
1287 attr = com.android.internal.R.styleable.WindowAnimation_windowShowAnimation;
1288 break;
1289 case WindowManagerPolicy.TRANSIT_HIDE:
1290 attr = com.android.internal.R.styleable.WindowAnimation_windowHideAnimation;
1291 break;
1292 }
1293 if (attr >= 0) {
1294 a = mService.loadAnimation(mWin.mAttrs, attr);
1295 }
1296 }
Craig Mautnerd87946b2012-03-29 18:00:19 -07001297 if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG,
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001298 "applyAnimation: win=" + this
1299 + " anim=" + anim + " attr=0x" + Integer.toHexString(attr)
Craig Mautner4d7349b2012-04-20 14:52:47 -07001300 + " a=" + a
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001301 + " mAnimation=" + mAnimation
Craig Mautner83339b42012-05-01 22:13:23 -07001302 + " isEntrance=" + isEntrance + " Callers " + Debug.getCallers(3));
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001303 if (a != null) {
1304 if (WindowManagerService.DEBUG_ANIM) {
1305 RuntimeException e = null;
1306 if (!WindowManagerService.HIDE_STACK_CRAWLS) {
1307 e = new RuntimeException();
1308 e.fillInStackTrace();
1309 }
Craig Mautnerd87946b2012-03-29 18:00:19 -07001310 Slog.v(TAG, "Loaded animation " + a + " for " + this, e);
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001311 }
1312 setAnimation(a);
1313 mAnimationIsEntrance = isEntrance;
1314 }
1315 } else {
1316 clearAnimation();
1317 }
1318
1319 return mAnimation != null;
1320 }
1321
Craig Mautnera2c77052012-03-26 12:14:43 -07001322 public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
1323 if (mAnimating || mLocalAnimating || mAnimationIsEntrance
1324 || mAnimation != null) {
1325 pw.print(prefix); pw.print("mAnimating="); pw.print(mAnimating);
1326 pw.print(" mLocalAnimating="); pw.print(mLocalAnimating);
1327 pw.print(" mAnimationIsEntrance="); pw.print(mAnimationIsEntrance);
1328 pw.print(" mAnimation="); pw.println(mAnimation);
1329 }
1330 if (mHasTransformation || mHasLocalTransformation) {
1331 pw.print(prefix); pw.print("XForm: has=");
1332 pw.print(mHasTransformation);
1333 pw.print(" hasLocal="); pw.print(mHasLocalTransformation);
1334 pw.print(" "); mTransformation.printShortString(pw);
1335 pw.println();
1336 }
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001337 if (mSurface != null) {
1338 if (dumpAll) {
1339 pw.print(prefix); pw.print("mSurface="); pw.println(mSurface);
Craig Mautner749a7bb2012-04-02 13:49:53 -07001340 pw.print(prefix); pw.print("mDrawState="); pw.print(mDrawState);
1341 pw.print(" mLastHidden="); pw.println(mLastHidden);
Craig Mautnerc2f9be02012-03-27 17:32:29 -07001342 }
1343 pw.print(prefix); pw.print("Surface: shown="); pw.print(mSurfaceShown);
1344 pw.print(" layer="); pw.print(mSurfaceLayer);
1345 pw.print(" alpha="); pw.print(mSurfaceAlpha);
1346 pw.print(" rect=("); pw.print(mSurfaceX);
1347 pw.print(","); pw.print(mSurfaceY);
1348 pw.print(") "); pw.print(mSurfaceW);
1349 pw.print(" x "); pw.println(mSurfaceH);
1350 }
1351 if (mPendingDestroySurface != null) {
1352 pw.print(prefix); pw.print("mPendingDestroySurface=");
1353 pw.println(mPendingDestroySurface);
1354 }
1355 if (mSurfaceResized || mSurfaceDestroyDeferred) {
1356 pw.print(prefix); pw.print("mSurfaceResized="); pw.print(mSurfaceResized);
1357 pw.print(" mSurfaceDestroyDeferred="); pw.println(mSurfaceDestroyDeferred);
1358 }
1359 if (mShownAlpha != 1 || mAlpha != 1 || mLastAlpha != 1) {
1360 pw.print(prefix); pw.print("mShownAlpha="); pw.print(mShownAlpha);
1361 pw.print(" mAlpha="); pw.print(mAlpha);
1362 pw.print(" mLastAlpha="); pw.println(mLastAlpha);
1363 }
1364 if (mHaveMatrix || mWin.mGlobalScale != 1) {
1365 pw.print(prefix); pw.print("mGlobalScale="); pw.print(mWin.mGlobalScale);
1366 pw.print(" mDsDx="); pw.print(mDsDx);
1367 pw.print(" mDtDx="); pw.print(mDtDx);
1368 pw.print(" mDsDy="); pw.print(mDsDy);
1369 pw.print(" mDtDy="); pw.println(mDtDy);
1370 }
Craig Mautnera2c77052012-03-26 12:14:43 -07001371 }
1372
Craig Mautnerc8bc97e2012-04-02 12:54:54 -07001373 @Override
1374 public String toString() {
1375 StringBuffer sb = new StringBuffer("WindowStateAnimator (");
1376 sb.append(mWin.mLastTitle + "): ");
1377 sb.append("mSurface " + mSurface);
1378 sb.append(", mAnimation " + mAnimation);
1379 return sb.toString();
1380 }
Craig Mautnera2c77052012-03-26 12:14:43 -07001381}