blob: 09e99a5cc1ae199ce1255b27109a06ce6f01f924 [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++) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700187 final WindowState w = allAppWindows.get(i);
188 final WindowStateAnimator winAnimator = w.mWinAnimator;
189 winAnimator.mAnimLayer = w.mLayer + adj;
190 if (winAnimator.mAnimLayer > thumbnailLayer) {
191 thumbnailLayer = winAnimator.mAnimLayer;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700192 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800193 if (WindowManagerService.DEBUG_LAYERS) Slog.v(WindowManagerService.TAG, "Updating layer " + w + ": "
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700194 + winAnimator.mAnimLayer);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800195 if (w == service.mInputMethodTarget && !service.mInputMethodTargetWaitingAnim) {
196 service.setInputMethodAnimLayerAdjustment(adj);
197 }
198 if (w == service.mWallpaperTarget && service.mLowerWallpaperTarget == null) {
199 service.setWallpaperAnimLayerAdjustmentLocked(adj);
200 }
201 }
202 }
203
204 void sendAppVisibilityToClients() {
205 final int N = allAppWindows.size();
206 for (int i=0; i<N; i++) {
207 WindowState win = allAppWindows.get(i);
208 if (win == startingWindow && clientHidden) {
209 // Don't hide the starting window.
210 continue;
211 }
212 try {
213 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
214 "Setting visibility of " + win + ": " + (!clientHidden));
215 win.mClient.dispatchAppVisibility(!clientHidden);
216 } catch (RemoteException e) {
217 }
218 }
219 }
220
Craig Mautner03273d02012-03-21 11:52:40 -0700221 boolean showAllWindowsLocked() {
222 boolean isAnimating = false;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800223 final int NW = allAppWindows.size();
224 for (int i=0; i<NW; i++) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700225 WindowStateAnimator winAnimator = allAppWindows.get(i).mWinAnimator;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800226 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700227 "performing show on: " + winAnimator);
228 winAnimator.performShowLocked();
229 isAnimating |= winAnimator.isAnimating();
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800230 }
Craig Mautner03273d02012-03-21 11:52:40 -0700231 return isAnimating;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800232 }
233
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700234 private void stepThumbnailAnimation(long currentTime) {
235 thumbnailTransformation.clear();
236 thumbnailAnimation.getTransformation(currentTime, thumbnailTransformation);
237 thumbnailTransformation.getMatrix().preTranslate(thumbnailX, thumbnailY);
238 final boolean screenAnimation = service.mAnimator.mScreenRotationAnimation != null
239 && service.mAnimator.mScreenRotationAnimation.isAnimating();
240 if (screenAnimation) {
241 thumbnailTransformation.postCompose(
242 service.mAnimator.mScreenRotationAnimation.getEnterTransformation());
243 }
244 // cache often used attributes locally
245 final float tmpFloats[] = service.mTmpFloats;
246 thumbnailTransformation.getMatrix().getValues(tmpFloats);
Craig Mautnera2c77052012-03-26 12:14:43 -0700247 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(thumbnail,
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700248 "thumbnail", "POS " + tmpFloats[Matrix.MTRANS_X]
249 + ", " + tmpFloats[Matrix.MTRANS_Y], null);
250 thumbnail.setPosition(tmpFloats[Matrix.MTRANS_X], tmpFloats[Matrix.MTRANS_Y]);
Craig Mautnera2c77052012-03-26 12:14:43 -0700251 if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(thumbnail,
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700252 "thumbnail", "alpha=" + thumbnailTransformation.getAlpha()
253 + " layer=" + thumbnailLayer
254 + " matrix=[" + tmpFloats[Matrix.MSCALE_X]
255 + "," + tmpFloats[Matrix.MSKEW_Y]
256 + "][" + tmpFloats[Matrix.MSKEW_X]
257 + "," + tmpFloats[Matrix.MSCALE_Y] + "]", null);
258 thumbnail.setAlpha(thumbnailTransformation.getAlpha());
259 // The thumbnail is layered below the window immediately above this
260 // token's anim layer.
261 thumbnail.setLayer(thumbnailLayer + WindowManagerService.WINDOW_LAYER_MULTIPLIER
262 - WindowManagerService.LAYER_OFFSET_THUMBNAIL);
263 thumbnail.setMatrix(tmpFloats[Matrix.MSCALE_X], tmpFloats[Matrix.MSKEW_Y],
264 tmpFloats[Matrix.MSKEW_X], tmpFloats[Matrix.MSCALE_Y]);
265 }
Craig Mautnere32c3072012-03-12 15:25:35 -0700266
267 private boolean stepAnimation(long currentTime) {
Craig Mautnerdbb79912012-03-01 18:59:14 -0800268 if (animation == null) {
269 return false;
270 }
271 transformation.clear();
272 final boolean more = animation.getTransformation(currentTime, transformation);
273 if (WindowManagerService.DEBUG_ANIM) Slog.v(
274 WindowManagerService.TAG, "Stepped animation in " + this +
275 ": more=" + more + ", xform=" + transformation);
276 if (!more) {
277 animation = null;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700278 clearThumbnail();
Craig Mautnerdbb79912012-03-01 18:59:14 -0800279 if (WindowManagerService.DEBUG_ANIM) Slog.v(
280 WindowManagerService.TAG, "Finished animation in " + this +
281 " @ " + currentTime);
282 }
283 hasTransformation = more;
284 return more;
285 }
286
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800287 // This must be called while inside a transaction.
Craig Mautnere32c3072012-03-12 15:25:35 -0700288 boolean stepAnimationLocked(long currentTime, int dw, int dh) {
Craig Mautner2fb98b12012-03-20 17:24:00 -0700289 if (service.okToDisplay()) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800290 // We will run animations as long as the display isn't frozen.
291
292 if (animation == WindowManagerService.sDummyAnimation) {
293 // This guy is going to animate, but not yet. For now count
294 // it as not animating for purposes of scheduling transactions;
295 // when it is really time to animate, this will be set to
296 // a real animation and the next call will execute normally.
297 return false;
298 }
299
300 if ((allDrawn || animating || startingDisplayed) && animation != null) {
301 if (!animating) {
302 if (WindowManagerService.DEBUG_ANIM) Slog.v(
303 WindowManagerService.TAG, "Starting animation in " + this +
304 " @ " + currentTime + ": dw=" + dw + " dh=" + dh
305 + " scale=" + service.mTransitionAnimationScale
306 + " allDrawn=" + allDrawn + " animating=" + animating);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700307 if (!animInitialized) {
308 animation.initialize(dw, dh, dw, dh);
309 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800310 animation.setStartTime(currentTime);
311 animating = true;
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700312 if (thumbnail != null) {
313 thumbnail.show();
314 thumbnailAnimation.setStartTime(currentTime);
315 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800316 }
Craig Mautner1dd3ed02012-03-16 14:01:16 -0700317 if (stepAnimation(currentTime)) {
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700318 // animation isn't over, step any thumbnail and that's
319 // it for now.
320 if (thumbnail != null) {
321 stepThumbnailAnimation(currentTime);
322 }
Craig Mautner1dd3ed02012-03-16 14:01:16 -0700323 return true;
324 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800325 }
326 } else if (animation != null) {
327 // If the display is frozen, and there is a pending animation,
328 // clear it and make sure we run the cleanup code.
329 animating = true;
330 animation = null;
331 }
332
333 hasTransformation = false;
334
335 if (!animating) {
336 return false;
337 }
338
Craig Mautnere32c3072012-03-12 15:25:35 -0700339 service.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
Craig Mautnercf8cbbe2012-03-25 21:54:36 -0700340 if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
341 service.debugLayoutRepeats("AppWindowToken");
342 }
343
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800344 clearAnimation();
345 animating = false;
346 if (animLayerAdjustment != 0) {
347 animLayerAdjustment = 0;
348 updateLayers();
349 }
350 if (service.mInputMethodTarget != null && service.mInputMethodTarget.mAppToken == this) {
351 service.moveInputMethodWindowsIfNeededLocked(true);
352 }
353
354 if (WindowManagerService.DEBUG_ANIM) Slog.v(
355 WindowManagerService.TAG, "Animation done in " + this
356 + ": reportedVisible=" + reportedVisible);
357
358 transformation.clear();
359
360 final int N = windows.size();
361 for (int i=0; i<N; i++) {
Craig Mautnera2c77052012-03-26 12:14:43 -0700362 windows.get(i).mWinAnimator.finishExit();
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800363 }
364 updateReportedVisibilityLocked();
365
366 return false;
367 }
368
369 void updateReportedVisibilityLocked() {
370 if (appToken == null) {
371 return;
372 }
373
374 int numInteresting = 0;
375 int numVisible = 0;
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700376 int numDrawn = 0;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800377 boolean nowGone = true;
378
Craig Mautnerc8bc97e2012-04-02 12:54:54 -0700379 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
380 "Update reported visibility: " + this);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800381 final int N = allAppWindows.size();
382 for (int i=0; i<N; i++) {
383 WindowState win = allAppWindows.get(i);
384 if (win == startingWindow || win.mAppFreezing
385 || win.mViewVisibility != View.VISIBLE
386 || win.mAttrs.type == TYPE_APPLICATION_STARTING
387 || win.mDestroying) {
388 continue;
389 }
390 if (WindowManagerService.DEBUG_VISIBILITY) {
391 Slog.v(WindowManagerService.TAG, "Win " + win + ": isDrawn="
392 + win.isDrawnLw()
Craig Mautnera2c77052012-03-26 12:14:43 -0700393 + ", isAnimating=" + win.mWinAnimator.isAnimating());
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800394 if (!win.isDrawnLw()) {
Craig Mautnerc2f9be02012-03-27 17:32:29 -0700395 Slog.v(WindowManagerService.TAG, "Not displayed: s=" + win.mWinAnimator.mSurface
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800396 + " pv=" + win.mPolicyVisibility
Craig Mautnera608b882012-03-30 13:03:49 -0700397 + " dp=" + win.mWinAnimator.mDrawPending
398 + " cdp=" + win.mWinAnimator.mCommitDrawPending
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800399 + " ah=" + win.mAttachedHidden
400 + " th="
401 + (win.mAppToken != null
402 ? win.mAppToken.hiddenRequested : false)
Craig Mautnera2c77052012-03-26 12:14:43 -0700403 + " a=" + win.mWinAnimator.mAnimating);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800404 }
405 }
406 numInteresting++;
407 if (win.isDrawnLw()) {
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700408 numDrawn++;
Craig Mautnera2c77052012-03-26 12:14:43 -0700409 if (!win.mWinAnimator.isAnimating()) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800410 numVisible++;
411 }
412 nowGone = false;
Craig Mautnera2c77052012-03-26 12:14:43 -0700413 } else if (win.mWinAnimator.isAnimating()) {
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800414 nowGone = false;
415 }
416 }
417
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700418 boolean nowDrawn = numInteresting > 0 && numDrawn >= numInteresting;
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800419 boolean nowVisible = numInteresting > 0 && numVisible >= numInteresting;
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700420 if (!nowGone) {
421 // If the app is not yet gone, then it can only become visible/drawn.
422 if (!nowDrawn) {
423 nowDrawn = reportedDrawn;
424 }
425 if (!nowVisible) {
426 nowVisible = reportedVisible;
427 }
428 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800429 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "VIS " + this + ": interesting="
430 + numInteresting + " visible=" + numVisible);
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700431 if (nowDrawn != reportedDrawn) {
432 if (nowDrawn) {
433 Message m = service.mH.obtainMessage(
434 H.REPORT_APPLICATION_TOKEN_DRAWN, this);
435 service.mH.sendMessage(m);
436 }
437 reportedDrawn = nowDrawn;
438 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800439 if (nowVisible != reportedVisible) {
440 if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(
441 WindowManagerService.TAG, "Visibility changed in " + this
442 + ": vis=" + nowVisible);
443 reportedVisible = nowVisible;
444 Message m = service.mH.obtainMessage(
445 H.REPORT_APPLICATION_TOKEN_WINDOWS,
446 nowVisible ? 1 : 0,
447 nowGone ? 1 : 0,
448 this);
449 service.mH.sendMessage(m);
450 }
451 }
452
453 WindowState findMainWindow() {
454 int j = windows.size();
455 while (j > 0) {
456 j--;
457 WindowState win = windows.get(j);
458 if (win.mAttrs.type == WindowManager.LayoutParams.TYPE_BASE_APPLICATION
459 || win.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING) {
460 return win;
461 }
462 }
463 return null;
464 }
465
Craig Mautnerdbb79912012-03-01 18:59:14 -0800466 @Override
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800467 void dump(PrintWriter pw, String prefix) {
468 super.dump(pw, prefix);
469 if (appToken != null) {
470 pw.print(prefix); pw.println("app=true");
471 }
472 if (allAppWindows.size() > 0) {
473 pw.print(prefix); pw.print("allAppWindows="); pw.println(allAppWindows);
474 }
475 pw.print(prefix); pw.print("groupId="); pw.print(groupId);
476 pw.print(" appFullscreen="); pw.print(appFullscreen);
477 pw.print(" requestedOrientation="); pw.println(requestedOrientation);
478 pw.print(prefix); pw.print("hiddenRequested="); pw.print(hiddenRequested);
479 pw.print(" clientHidden="); pw.print(clientHidden);
480 pw.print(" willBeHidden="); pw.print(willBeHidden);
Dianne Hackborn2c84cfc2011-10-31 15:39:59 -0700481 pw.print(" reportedDrawn="); pw.print(reportedDrawn);
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800482 pw.print(" reportedVisible="); pw.println(reportedVisible);
483 if (paused || freezingScreen) {
484 pw.print(prefix); pw.print("paused="); pw.print(paused);
485 pw.print(" freezingScreen="); pw.println(freezingScreen);
486 }
487 if (numInterestingWindows != 0 || numDrawnWindows != 0
488 || inPendingTransaction || allDrawn) {
489 pw.print(prefix); pw.print("numInterestingWindows=");
490 pw.print(numInterestingWindows);
491 pw.print(" numDrawnWindows="); pw.print(numDrawnWindows);
492 pw.print(" inPendingTransaction="); pw.print(inPendingTransaction);
493 pw.print(" allDrawn="); pw.println(allDrawn);
494 }
495 if (animating || animation != null) {
496 pw.print(prefix); pw.print("animating="); pw.print(animating);
497 pw.print(" animation="); pw.println(animation);
498 }
499 if (hasTransformation) {
500 pw.print(prefix); pw.print("XForm: ");
501 transformation.printShortString(pw);
502 pw.println();
503 }
504 if (animLayerAdjustment != 0) {
505 pw.print(prefix); pw.print("animLayerAdjustment="); pw.println(animLayerAdjustment);
506 }
507 if (startingData != null || removed || firstWindowDrawn) {
508 pw.print(prefix); pw.print("startingData="); pw.print(startingData);
509 pw.print(" removed="); pw.print(removed);
510 pw.print(" firstWindowDrawn="); pw.println(firstWindowDrawn);
511 }
512 if (startingWindow != null || startingView != null
513 || startingDisplayed || startingMoved) {
514 pw.print(prefix); pw.print("startingWindow="); pw.print(startingWindow);
515 pw.print(" startingView="); pw.print(startingView);
516 pw.print(" startingDisplayed="); pw.print(startingDisplayed);
517 pw.print(" startingMoved"); pw.println(startingMoved);
518 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700519 if (thumbnail != null) {
520 pw.print(prefix); pw.print("thumbnail="); pw.print(thumbnail);
521 pw.print(" x="); pw.print(thumbnailX);
522 pw.print(" y="); pw.print(thumbnailY);
523 pw.print(" layer="); pw.println(thumbnailLayer);
524 pw.print(prefix); pw.print("thumbnailAnimation="); pw.println(thumbnailAnimation);
525 pw.print(prefix); pw.print("thumbnailTransformation=");
526 pw.println(thumbnailTransformation.toShortString());
527 }
Dianne Hackborn6e1eb762011-02-17 16:07:28 -0800528 }
529
530 @Override
531 public String toString() {
532 if (stringName == null) {
533 StringBuilder sb = new StringBuilder();
534 sb.append("AppWindowToken{");
535 sb.append(Integer.toHexString(System.identityHashCode(this)));
536 sb.append(" token="); sb.append(token); sb.append('}');
537 stringName = sb.toString();
538 }
539 return stringName;
540 }
541}