Skip to content

Commit fbf378c

Browse files
author
Craig Mautner
committed
Various debugging enhancements.
Also moved DummyAnimation into AppWindowAnimator where it belongs. Change-Id: I7da254a8b99030b898e2ff8d983500d7ce0b2b65
1 parent 1579a67 commit fbf378c

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

services/java/com/android/server/wm/AppWindowAnimator.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*
1616
*/
1717
public class AppWindowAnimator {
18+
static final String TAG = "AppWindowAnimator";
1819

1920
final AppWindowToken mAppToken;
2021
final WindowManagerService mService;
@@ -43,6 +44,8 @@ public class AppWindowAnimator {
4344
Animation thumbnailAnimation;
4445
final Transformation thumbnailTransformation = new Transformation();
4546

47+
static final Animation sDummyAnimation = new DummyAnimation();
48+
4649
public AppWindowAnimator(final WindowManagerService service, final AppWindowToken atoken) {
4750
mService = service;
4851
mAppToken = atoken;
@@ -51,7 +54,7 @@ public AppWindowAnimator(final WindowManagerService service, final AppWindowToke
5154

5255
public void setAnimation(Animation anim, boolean initialized) {
5356
if (WindowManagerService.localLOGV) Slog.v(
54-
WindowManagerService.TAG, "Setting animation in " + this + ": " + anim);
57+
TAG, "Setting animation in " + this + ": " + anim);
5558
animation = anim;
5659
animating = false;
5760
animInitialized = initialized;
@@ -78,8 +81,8 @@ public void setAnimation(Animation anim, boolean initialized) {
7881
public void setDummyAnimation() {
7982
if (animation == null) {
8083
if (WindowManagerService.localLOGV) Slog.v(
81-
WindowManagerService.TAG, "Setting dummy animation in " + this);
82-
animation = WindowManagerService.sDummyAnimation;
84+
TAG, "Setting dummy animation in " + this);
85+
animation = sDummyAnimation;
8386
animInitialized = false;
8487
}
8588
}
@@ -111,7 +114,7 @@ void updateLayers() {
111114
if (winAnimator.mAnimLayer > thumbnailLayer) {
112115
thumbnailLayer = winAnimator.mAnimLayer;
113116
}
114-
if (WindowManagerService.DEBUG_LAYERS) Slog.v(WindowManagerService.TAG, "Updating layer " + w + ": "
117+
if (WindowManagerService.DEBUG_LAYERS) Slog.v(TAG, "Updating layer " + w + ": "
115118
+ winAnimator.mAnimLayer);
116119
if (w == mService.mInputMethodTarget && !mService.mInputMethodTargetWaitingAnim) {
117120
mService.setInputMethodAnimLayerAdjustment(adj);
@@ -162,14 +165,12 @@ private boolean stepAnimation(long currentTime) {
162165
transformation.clear();
163166
final boolean more = animation.getTransformation(currentTime, transformation);
164167
if (WindowManagerService.DEBUG_ANIM) Slog.v(
165-
WindowManagerService.TAG, "Stepped animation in " + this +
166-
": more=" + more + ", xform=" + transformation);
168+
TAG, "Stepped animation in " + this + ": more=" + more + ", xform=" + transformation);
167169
if (!more) {
168170
animation = null;
169171
clearThumbnail();
170172
if (WindowManagerService.DEBUG_ANIM) Slog.v(
171-
WindowManagerService.TAG, "Finished animation in " + this +
172-
" @ " + currentTime);
173+
TAG, "Finished animation in " + this + " @ " + currentTime);
173174
}
174175
hasTransformation = more;
175176
return more;
@@ -180,7 +181,7 @@ boolean stepAnimationLocked(long currentTime, int dw, int dh) {
180181
if (mService.okToDisplay()) {
181182
// We will run animations as long as the display isn't frozen.
182183

183-
if (animation == WindowManagerService.sDummyAnimation) {
184+
if (animation == sDummyAnimation) {
184185
// This guy is going to animate, but not yet. For now count
185186
// it as not animating for purposes of scheduling transactions;
186187
// when it is really time to animate, this will be set to
@@ -192,7 +193,7 @@ boolean stepAnimationLocked(long currentTime, int dw, int dh) {
192193
&& animation != null) {
193194
if (!animating) {
194195
if (WindowManagerService.DEBUG_ANIM) Slog.v(
195-
WindowManagerService.TAG, "Starting animation in " + this +
196+
TAG, "Starting animation in " + this +
196197
" @ " + currentTime + ": dw=" + dw + " dh=" + dh
197198
+ " scale=" + mService.mTransitionAnimationScale
198199
+ " allDrawn=" + mAppToken.allDrawn + " animating=" + animating);
@@ -245,7 +246,7 @@ boolean stepAnimationLocked(long currentTime, int dw, int dh) {
245246
}
246247

247248
if (WindowManagerService.DEBUG_ANIM) Slog.v(
248-
WindowManagerService.TAG, "Animation done in " + this
249+
TAG, "Animation done in " + this
249250
+ ": reportedVisible=" + mAppToken.reportedVisible);
250251

251252
transformation.clear();
@@ -264,7 +265,7 @@ boolean showAllWindowsLocked() {
264265
final int NW = mAppToken.allAppWindows.size();
265266
for (int i=0; i<NW; i++) {
266267
WindowStateAnimator winAnimator = mAppToken.allAppWindows.get(i).mWinAnimator;
267-
if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
268+
if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
268269
"performing show on: " + winAnimator);
269270
winAnimator.performShowLocked();
270271
isAnimating |= winAnimator.isAnimating();
@@ -298,4 +299,15 @@ void dump(PrintWriter pw, String prefix) {
298299
pw.println(thumbnailTransformation.toShortString());
299300
}
300301
}
302+
303+
// This is an animation that does nothing: it just immediately finishes
304+
// itself every time it is called. It is used as a stub animation in cases
305+
// where we want to synchronize multiple things that may be animating.
306+
static final class DummyAnimation extends Animation {
307+
@Override
308+
public boolean getTransformation(long currentTime, Transformation outTransformation) {
309+
return false;
310+
}
311+
}
312+
301313
}

services/java/com/android/server/wm/WindowAnimator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private void updateWindowsAppsAndRotationAnimationsLocked() {
130130
for (i=0; i<NAT; i++) {
131131
final AppWindowAnimator appAnimator = mService.mAppTokens.get(i).mAppAnimator;
132132
final boolean wasAnimating = appAnimator.animation != null
133-
&& appAnimator.animation != WindowManagerService.sDummyAnimation;
133+
&& appAnimator.animation != AppWindowAnimator.sDummyAnimation;
134134
if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
135135
mAnimating = true;
136136
} else if (wasAnimating) {
@@ -147,7 +147,7 @@ private void updateWindowsAppsAndRotationAnimationsLocked() {
147147
for (i=0; i<NEAT; i++) {
148148
final AppWindowAnimator appAnimator = mService.mExitingAppTokens.get(i).mAppAnimator;
149149
final boolean wasAnimating = appAnimator.animation != null
150-
&& appAnimator.animation != WindowManagerService.sDummyAnimation;
150+
&& appAnimator.animation != AppWindowAnimator.sDummyAnimation;
151151
if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
152152
mAnimating = true;
153153
} else if (wasAnimating) {

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4111,7 +4111,7 @@ boolean setTokenVisibilityLocked(AppWindowToken wtoken, WindowManager.LayoutPara
41114111
boolean runningAppAnimation = false;
41124112

41134113
if (transit != WindowManagerPolicy.TRANSIT_UNSET) {
4114-
if (wtoken.mAppAnimator.animation == sDummyAnimation) {
4114+
if (wtoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation) {
41154115
wtoken.mAppAnimator.animation = null;
41164116
}
41174117
if (applyAnimationLocked(wtoken, lp, transit, visible)) {
@@ -6580,16 +6580,6 @@ private void sendScreenStatusToClients() {
65806580
}
65816581
}
65826582

6583-
// This is an animation that does nothing: it just immediately finishes
6584-
// itself every time it is called. It is used as a stub animation in cases
6585-
// where we want to synchronize multiple things that may be animating.
6586-
static final class DummyAnimation extends Animation {
6587-
public boolean getTransformation(long currentTime, Transformation outTransformation) {
6588-
return false;
6589-
}
6590-
}
6591-
static final Animation sDummyAnimation = new DummyAnimation();
6592-
65936583
// -------------------------------------------------------------
65946584
// Async Handler
65956585
// -------------------------------------------------------------

services/java/com/android/server/wm/WindowStateAnimator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,10 @@ boolean finishDrawingLocked() {
390390

391391
// This must be called while inside a transaction.
392392
boolean commitFinishDrawingLocked(long currentTime) {
393-
//Slog.i(TAG, "commitFinishDrawingLocked: " + mSurface);
394393
if (mDrawState != COMMIT_DRAW_PENDING) {
395394
return false;
396395
}
396+
//Slog.i(TAG, "commitFinishDrawingLocked: Draw pending. " + mSurface);
397397
mDrawState = READY_TO_SHOW;
398398
final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING;
399399
final AppWindowToken atoken = mWin.mAppToken;
@@ -515,7 +515,8 @@ static void dumpAllSurfaces() {
515515

516516
@Override
517517
public String toString() {
518-
return "Surface " + mName + ": shown=" + mShown + " layer=" + mLayer
518+
return "Surface " + Integer.toHexString(System.identityHashCode(this)) + " "
519+
+ mName + ": shown=" + mShown + " layer=" + mLayer
519520
+ " alpha=" + mSurfaceTraceAlpha + " " + mPosition.x + "," + mPosition.y
520521
+ " " + mSize.x + "x" + mSize.y;
521522
}

0 commit comments

Comments
 (0)