blob: 6269420c57e9556db4a69bf52a2607726e866187 [file] [log] [blame]
Dianne Hackborn6e1eb762011-02-17 16:07:28 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.wm;
18
19import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
20
21import com.android.server.wm.WindowManagerService.H;
22
23import android.content.pm.ActivityInfo;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -070024import android.graphics.Matrix;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080025import android.os.Message;
26import android.os.RemoteException;
27import android.util.Slog;
28import android.view.IApplicationToken;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -070029import android.view.Surface;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080030import android.view.View;
31import android.view.WindowManager;
Craig Mautnere32c3072012-03-12 15:25:35 -070032import android.view.WindowManagerPolicy;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080033import android.view.animation.Animation;
34import android.view.animation.Transformation;
35
36import java.io.PrintWriter;
37import java.util.ArrayList;
38
39/**
40 * Version of WindowToken that is specifically for a particular application (or
41 * really activity) that is displaying windows.
42 */
Craig Mautnere32c3072012-03-12 15:25:35 -070043class AppWindowToken extends WindowToken {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080044 // Non-null only for application tokens.
45 final IApplicationToken appToken;
46
47 // All of the windows and child windows that are included in this
48 // application token. Note this list is NOT sorted!
49 final ArrayList<WindowState> allAppWindows = new ArrayList<WindowState>();
50
51 int groupId = -1;
52 boolean appFullscreen;
53 int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Craig Mautnera2c77052012-03-26 12:14:43 -070054
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080055 // The input dispatching timeout for this application token in nanoseconds.
56 long inputDispatchingTimeoutNanos;
57
58 // These are used for determining when all windows associated with
59 // an activity have been drawn, so they can be made visible together
60 // at the same time.
Craig Mautner764983d2012-03-22 11:37:36 -070061 // initialize so that it doesn't match mTransactionSequence which is an int.
62 long lastTransactionSequence = Long.MIN_VALUE;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080063 int numInterestingWindows;
64 int numDrawnWindows;
65 boolean inPendingTransaction;
66 boolean allDrawn;
67
68 // Is this token going to be hidden in a little while? If so, it
69 // won't be taken into account for setting the screen orientation.
70 boolean willBeHidden;
71
72 // Is this window's surface needed? This is almost like hidden, except
73 // it will sometimes be true a little earlier: when the token has
74 // been shown, but is still waiting for its app transition to execute
75 // before making its windows shown.
76 boolean hiddenRequested;
77
78 // Have we told the window clients to hide themselves?
79 boolean clientHidden;
80
81 // Last visibility state we reported to the app token.
82 boolean reportedVisible;
83
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -070084 // Last drawn state we reported to the app token.
85 boolean reportedDrawn;
86
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080087 // Set to true when the token has been removed from the window mgr.
88 boolean removed;
89
90 // Have we been asked to have this token keep the screen frozen?
91 boolean freezingScreen;
92
93 boolean animating;
94 Animation animation;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -070095 boolean animInitialized;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -080096 boolean hasTransformation;
97 final Transformation transformation = new Transformation();
98
99 // Offset to the window of all layers in the token, for use by
100 // AppWindowToken animations.
101 int animLayerAdjustment;
102
103 // Information about an application starting window if displayed.
104 StartingData startingData;
105 WindowState startingWindow;
106 View startingView;
107 boolean startingDisplayed;
108 boolean startingMoved;
109 boolean firstWindowDrawn;
110
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700111 // Special surface for thumbnail animation.
112 Surface thumbnail;
113 int thumbnailTransactionSeq;
114 int thumbnailX;
115 int thumbnailY;
116 int thumbnailLayer;
117 Animation thumbnailAnimation;
118 final Transformation thumbnailTransformation = new Transformation();
119
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800120 // Input application handle used by the input dispatcher.
Jeff Brown9302c872011-07-13 22:51:29 -0700121 final InputApplicationHandle mInputApplicationHandle;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800122
123 AppWindowToken(WindowManagerService _service, IApplicationToken _token) {
124 super(_service, _token.asBinder(),
125 WindowManager.LayoutParams.TYPE_APPLICATION, true);
126 appWindowToken = this;
127 appToken = _token;
128 mInputApplicationHandle = new InputApplicationHandle(this);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800129 }
130
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700131 public void setAnimation(Animation anim, boolean initialized) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800132 if (WindowManagerService.localLOGV) Slog.v(
133 WindowManagerService.TAG, "Setting animation in " + this + ": " + anim);
134 animation = anim;
135 animating = false;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700136 animInitialized = initialized;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800137 anim.restrictDuration(WindowManagerService.MAX_ANIMATION_DURATION);
138 anim.scaleCurrentDuration(service.mTransitionAnimationScale);
139 int zorder = anim.getZAdjustment();
140 int adj = 0;
141 if (zorder == Animation.ZORDER_TOP) {
142 adj = WindowManagerService.TYPE_LAYER_OFFSET;
143 } else if (zorder == Animation.ZORDER_BOTTOM) {
144 adj = -WindowManagerService.TYPE_LAYER_OFFSET;
145 }
146
147 if (animLayerAdjustment != adj) {
148 animLayerAdjustment = adj;
149 updateLayers();
150 }
Craig Mautner22ce1412012-03-20 10:16:26 -0700151 // Start out animation gone if window is gone, or visible if window is visible.
152 transformation.clear();
153 transformation.setAlpha(reportedVisible ? 1 : 0);
154 hasTransformation = true;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800155 }
156
157 public void setDummyAnimation() {
158 if (animation == null) {
159 if (WindowManagerService.localLOGV) Slog.v(
160 WindowManagerService.TAG, "Setting dummy animation in " + this);
161 animation = WindowManagerService.sDummyAnimation;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700162 animInitialized = false;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800163 }
164 }
165
166 public void clearAnimation() {
167 if (animation != null) {
168 animation = null;
169 animating = true;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700170 animInitialized = false;
171 }
172 clearThumbnail();
173 }
174
175 public void clearThumbnail() {
176 if (thumbnail != null) {
177 thumbnail.destroy();
178 thumbnail = null;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800179 }
180 }
181
182 void updateLayers() {
183 final int N = allAppWindows.size();
184 final int adj = animLayerAdjustment;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700185 thumbnailLayer = -1;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800186 for (int i=0; i<N; i++) {
187 WindowState w = allAppWindows.get(i);
188 w.mAnimLayer = w.mLayer + adj;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700189 if (w.mAnimLayer > thumbnailLayer) {
190 thumbnailLayer = w.mAnimLayer;
191 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800192 if (WindowManagerService.DEBUG_LAYERS) Slog.v(WindowManagerService.TAG, "Updating layer " + w + ": "
193 + w.mAnimLayer);
194 if (w == service.mInputMethodTarget && !service.mInputMethodTargetWaitingAnim) {
195 service.setInputMethodAnimLayerAdjustment(adj);
196 }
197 if (w == service.mWallpaperTarget && service.mLowerWallpaperTarget == null) {
198 service.setWallpaperAnimLayerAdjustmentLocked(adj);
199 }
200 }
201 }
202
203 void sendAppVisibilityToClients() {
204 final int N = allAppWindows.size();
205 for (int i=0; i<N; i++) {
206 WindowState win = allAppWindows.get(i);
207 if (win == startingWindow && clientHidden) {
208 // Don't hide the starting window.
209 continue;
210 }
211 try {
212 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
213 "Setting visibility of " + win + ": " + (!clientHidden));
214 win.mClient.dispatchAppVisibility(!clientHidden);
215 } catch (RemoteException e) {
216 }
217 }
218 }
219
Craig Mautner03273d02012-03-21 11:52:40 -0700220 boolean showAllWindowsLocked() {
221 boolean isAnimating = false;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800222 final int NW = allAppWindows.size();
223 for (int i=0; i<NW; i++) {
224 WindowState w = allAppWindows.get(i);
225 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
226 "performing show on: " + w);
227 w.performShowLocked();
Craig Mautnera2c77052012-03-26 12:14:43 -0700228 isAnimating |= w.mWinAnimator.isAnimating();
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800229 }
Craig Mautner03273d02012-03-21 11:52:40 -0700230 return isAnimating;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800231 }
232
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700233 private void stepThumbnailAnimation(long currentTime) {
234 thumbnailTransformation.clear();
235 thumbnailAnimation.getTransformation(currentTime, thumbnailTransformation);
236 thumbnailTransformation.getMatrix().preTranslate(thumbnailX, thumbnailY);
237 final boolean screenAnimation = service.mAnimator.mScreenRotationAnimation != null
238 && service.mAnimator.mScreenRotationAnimation.isAnimating();
239 if (screenAnimation) {
240 thumbnailTransformation.postCompose(
241 service.mAnimator.mScreenRotationAnimation.getEnterTransformation());
242 }
243 // cache often used attributes locally
244 final float tmpFloats[] = service.mTmpFloats;
245 thumbnailTransformation.getMatrix().getValues(tmpFloats);
Craig Mautnera2c77052012-03-26 12:14:43 -0700246 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(thumbnail,
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700247 "thumbnail", "POS " + tmpFloats[Matrix.MTRANS_X]
248 + ", " + tmpFloats[Matrix.MTRANS_Y], null);
249 thumbnail.setPosition(tmpFloats[Matrix.MTRANS_X], tmpFloats[Matrix.MTRANS_Y]);
Craig Mautnera2c77052012-03-26 12:14:43 -0700250 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(thumbnail,
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700251 "thumbnail", "alpha=" + thumbnailTransformation.getAlpha()
252 + " layer=" + thumbnailLayer
253 + " matrix=[" + tmpFloats[Matrix.MSCALE_X]
254 + "," + tmpFloats[Matrix.MSKEW_Y]
255 + "][" + tmpFloats[Matrix.MSKEW_X]
256 + "," + tmpFloats[Matrix.MSCALE_Y] + "]", null);
257 thumbnail.setAlpha(thumbnailTransformation.getAlpha());
258 // The thumbnail is layered below the window immediately above this
259 // token's anim layer.
260 thumbnail.setLayer(thumbnailLayer + WindowManagerService.WINDOW_LAYER_MULTIPLIER
261 - WindowManagerService.LAYER_OFFSET_THUMBNAIL);
262 thumbnail.setMatrix(tmpFloats[Matrix.MSCALE_X], tmpFloats[Matrix.MSKEW_Y],
263 tmpFloats[Matrix.MSKEW_X], tmpFloats[Matrix.MSCALE_Y]);
264 }
Craig Mautnere32c3072012-03-12 15:25:35 -0700265
266 private boolean stepAnimation(long currentTime) {
Craig Mautnerdbb79912012-03-01 18:59:14 -0800267 if (animation == null) {
268 return false;
269 }
270 transformation.clear();
271 final boolean more = animation.getTransformation(currentTime, transformation);
272 if (WindowManagerService.DEBUG_ANIM) Slog.v(
273 WindowManagerService.TAG, "Stepped animation in " + this +
274 ": more=" + more + ", xform=" + transformation);
275 if (!more) {
276 animation = null;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700277 clearThumbnail();
Craig Mautnerdbb79912012-03-01 18:59:14 -0800278 if (WindowManagerService.DEBUG_ANIM) Slog.v(
279 WindowManagerService.TAG, "Finished animation in " + this +
280 " @ " + currentTime);
281 }
282 hasTransformation = more;
283 return more;
284 }
285
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800286 // This must be called while inside a transaction.
Craig Mautnere32c3072012-03-12 15:25:35 -0700287 boolean stepAnimationLocked(long currentTime, int dw, int dh) {
Craig Mautner2fb98b12012-03-20 17:24:00 -0700288 if (service.okToDisplay()) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800289 // We will run animations as long as the display isn't frozen.
290
291 if (animation == WindowManagerService.sDummyAnimation) {
292 // This guy is going to animate, but not yet. For now count
293 // it as not animating for purposes of scheduling transactions;
294 // when it is really time to animate, this will be set to
295 // a real animation and the next call will execute normally.
296 return false;
297 }
298
299 if ((allDrawn || animating || startingDisplayed) && animation != null) {
300 if (!animating) {
301 if (WindowManagerService.DEBUG_ANIM) Slog.v(
302 WindowManagerService.TAG, "Starting animation in " + this +
303 " @ " + currentTime + ": dw=" + dw + " dh=" + dh
304 + " scale=" + service.mTransitionAnimationScale
305 + " allDrawn=" + allDrawn + " animating=" + animating);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700306 if (!animInitialized) {
307 animation.initialize(dw, dh, dw, dh);
308 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800309 animation.setStartTime(currentTime);
310 animating = true;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700311 if (thumbnail != null) {
312 thumbnail.show();
313 thumbnailAnimation.setStartTime(currentTime);
314 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800315 }
Craig Mautner1dd3ed02012-03-16 14:01:16 -0700316 if (stepAnimation(currentTime)) {
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700317 // animation isn't over, step any thumbnail and that's
318 // it for now.
319 if (thumbnail != null) {
320 stepThumbnailAnimation(currentTime);
321 }
Craig Mautner1dd3ed02012-03-16 14:01:16 -0700322 return true;
323 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800324 }
325 } else if (animation != null) {
326 // If the display is frozen, and there is a pending animation,
327 // clear it and make sure we run the cleanup code.
328 animating = true;
329 animation = null;
330 }
331
332 hasTransformation = false;
333
334 if (!animating) {
335 return false;
336 }
337
Craig Mautnere32c3072012-03-12 15:25:35 -0700338 service.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700339 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
340 service.debugLayoutRepeats("AppWindowToken");
341 }
342
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800343 clearAnimation();
344 animating = false;
345 if (animLayerAdjustment != 0) {
346 animLayerAdjustment = 0;
347 updateLayers();
348 }
349 if (service.mInputMethodTarget != null && service.mInputMethodTarget.mAppToken == this) {
350 service.moveInputMethodWindowsIfNeededLocked(true);
351 }
352
353 if (WindowManagerService.DEBUG_ANIM) Slog.v(
354 WindowManagerService.TAG, "Animation done in " + this
355 + ": reportedVisible=" + reportedVisible);
356
357 transformation.clear();
358
359 final int N = windows.size();
360 for (int i=0; i<N; i++) {
Craig Mautnera2c77052012-03-26 12:14:43 -0700361 windows.get(i).mWinAnimator.finishExit();
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800362 }
363 updateReportedVisibilityLocked();
364
365 return false;
366 }
367
368 void updateReportedVisibilityLocked() {
369 if (appToken == null) {
370 return;
371 }
372
373 int numInteresting = 0;
374 int numVisible = 0;
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700375 int numDrawn = 0;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800376 boolean nowGone = true;
377
378 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "Update reported visibility: " + this);
379 final int N = allAppWindows.size();
380 for (int i=0; i<N; i++) {
381 WindowState win = allAppWindows.get(i);
382 if (win == startingWindow || win.mAppFreezing
383 || win.mViewVisibility != View.VISIBLE
384 || win.mAttrs.type == TYPE_APPLICATION_STARTING
385 || win.mDestroying) {
386 continue;
387 }
388 if (WindowManagerService.DEBUG_VISIBILITY) {
389 Slog.v(WindowManagerService.TAG, "Win " + win + ": isDrawn="
390 + win.isDrawnLw()
Craig Mautnera2c77052012-03-26 12:14:43 -0700391 + ", isAnimating=" + win.mWinAnimator.isAnimating());
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800392 if (!win.isDrawnLw()) {
393 Slog.v(WindowManagerService.TAG, "Not displayed: s=" + win.mSurface
394 + " pv=" + win.mPolicyVisibility
395 + " dp=" + win.mDrawPending
396 + " cdp=" + win.mCommitDrawPending
397 + " ah=" + win.mAttachedHidden
398 + " th="
399 + (win.mAppToken != null
400 ? win.mAppToken.hiddenRequested : false)
Craig Mautnera2c77052012-03-26 12:14:43 -0700401 + " a=" + win.mWinAnimator.mAnimating);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800402 }
403 }
404 numInteresting++;
405 if (win.isDrawnLw()) {
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700406 numDrawn++;
Craig Mautnera2c77052012-03-26 12:14:43 -0700407 if (!win.mWinAnimator.isAnimating()) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800408 numVisible++;
409 }
410 nowGone = false;
Craig Mautnera2c77052012-03-26 12:14:43 -0700411 } else if (win.mWinAnimator.isAnimating()) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800412 nowGone = false;
413 }
414 }
415
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700416 boolean nowDrawn = numInteresting > 0 && numDrawn >= numInteresting;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800417 boolean nowVisible = numInteresting > 0 && numVisible >= numInteresting;
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700418 if (!nowGone) {
419 // If the app is not yet gone, then it can only become visible/drawn.
420 if (!nowDrawn) {
421 nowDrawn = reportedDrawn;
422 }
423 if (!nowVisible) {
424 nowVisible = reportedVisible;
425 }
426 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800427 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "VIS " + this + ": interesting="
428 + numInteresting + " visible=" + numVisible);
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700429 if (nowDrawn != reportedDrawn) {
430 if (nowDrawn) {
431 Message m = service.mH.obtainMessage(
432 H.REPORT_APPLICATION_TOKEN_DRAWN, this);
433 service.mH.sendMessage(m);
434 }
435 reportedDrawn = nowDrawn;
436 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800437 if (nowVisible != reportedVisible) {
438 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(
439 WindowManagerService.TAG, "Visibility changed in " + this
440 + ": vis=" + nowVisible);
441 reportedVisible = nowVisible;
442 Message m = service.mH.obtainMessage(
443 H.REPORT_APPLICATION_TOKEN_WINDOWS,
444 nowVisible ? 1 : 0,
445 nowGone ? 1 : 0,
446 this);
447 service.mH.sendMessage(m);
448 }
449 }
450
451 WindowState findMainWindow() {
452 int j = windows.size();
453 while (j > 0) {
454 j--;
455 WindowState win = windows.get(j);
456 if (win.mAttrs.type == WindowManager.LayoutParams.TYPE_BASE_APPLICATION
457 || win.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) {
458 return win;
459 }
460 }
461 return null;
462 }
463
Craig Mautnerdbb79912012-03-01 18:59:14 -0800464 @Override
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800465 void dump(PrintWriter pw, String prefix) {
466 super.dump(pw, prefix);
467 if (appToken != null) {
468 pw.print(prefix); pw.println("app=true");
469 }
470 if (allAppWindows.size() > 0) {
471 pw.print(prefix); pw.print("allAppWindows="); pw.println(allAppWindows);
472 }
473 pw.print(prefix); pw.print("groupId="); pw.print(groupId);
474 pw.print(" appFullscreen="); pw.print(appFullscreen);
475 pw.print(" requestedOrientation="); pw.println(requestedOrientation);
476 pw.print(prefix); pw.print("hiddenRequested="); pw.print(hiddenRequested);
477 pw.print(" clientHidden="); pw.print(clientHidden);
478 pw.print(" willBeHidden="); pw.print(willBeHidden);
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700479 pw.print(" reportedDrawn="); pw.print(reportedDrawn);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800480 pw.print(" reportedVisible="); pw.println(reportedVisible);
481 if (paused || freezingScreen) {
482 pw.print(prefix); pw.print("paused="); pw.print(paused);
483 pw.print(" freezingScreen="); pw.println(freezingScreen);
484 }
485 if (numInterestingWindows != 0 || numDrawnWindows != 0
486 || inPendingTransaction || allDrawn) {
487 pw.print(prefix); pw.print("numInterestingWindows=");
488 pw.print(numInterestingWindows);
489 pw.print(" numDrawnWindows="); pw.print(numDrawnWindows);
490 pw.print(" inPendingTransaction="); pw.print(inPendingTransaction);
491 pw.print(" allDrawn="); pw.println(allDrawn);
492 }
493 if (animating || animation != null) {
494 pw.print(prefix); pw.print("animating="); pw.print(animating);
495 pw.print(" animation="); pw.println(animation);
496 }
497 if (hasTransformation) {
498 pw.print(prefix); pw.print("XForm: ");
499 transformation.printShortString(pw);
500 pw.println();
501 }
502 if (animLayerAdjustment != 0) {
503 pw.print(prefix); pw.print("animLayerAdjustment="); pw.println(animLayerAdjustment);
504 }
505 if (startingData != null || removed || firstWindowDrawn) {
506 pw.print(prefix); pw.print("startingData="); pw.print(startingData);
507 pw.print(" removed="); pw.print(removed);
508 pw.print(" firstWindowDrawn="); pw.println(firstWindowDrawn);
509 }
510 if (startingWindow != null || startingView != null
511 || startingDisplayed || startingMoved) {
512 pw.print(prefix); pw.print("startingWindow="); pw.print(startingWindow);
513 pw.print(" startingView="); pw.print(startingView);
514 pw.print(" startingDisplayed="); pw.print(startingDisplayed);
515 pw.print(" startingMoved"); pw.println(startingMoved);
516 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700517 if (thumbnail != null) {
518 pw.print(prefix); pw.print("thumbnail="); pw.print(thumbnail);
519 pw.print(" x="); pw.print(thumbnailX);
520 pw.print(" y="); pw.print(thumbnailY);
521 pw.print(" layer="); pw.println(thumbnailLayer);
522 pw.print(prefix); pw.print("thumbnailAnimation="); pw.println(thumbnailAnimation);
523 pw.print(prefix); pw.print("thumbnailTransformation=");
524 pw.println(thumbnailTransformation.toShortString());
525 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800526 }
527
528 @Override
529 public String toString() {
530 if (stringName == null) {
531 StringBuilder sb = new StringBuilder();
532 sb.append("AppWindowToken{");
533 sb.append(Integer.toHexString(System.identityHashCode(this)));
534 sb.append(" token="); sb.append(token); sb.append('}');
535 stringName = sb.toString();
536 }
537 return stringName;
538 }
539}