Skip to content

Commit be4f5bb

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Fix Home key causes wrong animation" into jb-dev
2 parents 9a793c9 + 83339b4 commit be4f5bb

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ private void updateWindowsAppsAndRotationAnimationsLocked() {
140140
mService.debugLayoutRepeats("appToken " + appAnimator.mAppToken + " done",
141141
mPendingLayoutChanges);
142142
}
143+
if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG,
144+
"updateWindowsApps...: done animating " + appAnimator.mAppToken);
143145
}
144146
}
145147

@@ -154,9 +156,11 @@ private void updateWindowsAppsAndRotationAnimationsLocked() {
154156
// stopped animating, do one more pass through the layout
155157
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
156158
if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
157-
mService.debugLayoutRepeats("exiting appToken " + appAnimator.mAppToken
159+
mService.debugLayoutRepeats("exiting appToken " + appAnimator.mAppToken
158160
+ " done", mPendingLayoutChanges);
159161
}
162+
if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG,
163+
"updateWindowsApps...: done animating exiting " + appAnimator.mAppToken);
160164
}
161165
}
162166

@@ -246,9 +250,9 @@ private void updateWindowsAndWallpaperLocked() {
246250

247251
if (mPolicy.doesForceHide(win, win.mAttrs)) {
248252
if (!wasAnimating && nowAnimating) {
249-
if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
250-
"Animation started that could impact force hide: "
251-
+ win);
253+
if (WindowManagerService.DEBUG_ANIM ||
254+
WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
255+
"Animation started that could impact force hide: " + win);
252256
mBulkUpdateParams |= SET_FORCE_HIDING_CHANGED;
253257
mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
254258
if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@
130130
import android.view.animation.AnimationUtils;
131131
import android.view.animation.Interpolator;
132132
import android.view.animation.ScaleAnimation;
133-
import android.view.animation.Transformation;
134-
import android.view.animation.TranslateAnimation;
135133

136134
import java.io.BufferedWriter;
137135
import java.io.DataInputStream;
@@ -3245,12 +3243,21 @@ private boolean applyAnimationLocked(AppWindowToken wtoken,
32453243
if (mNextAppTransitionType == ActivityOptions.ANIM_CUSTOM) {
32463244
a = loadAnimation(mNextAppTransitionPackage, enter ?
32473245
mNextAppTransitionEnter : mNextAppTransitionExit);
3246+
if (DEBUG_ANIM) Slog.v(TAG, "applyAnimation: wtoken=" + wtoken
3247+
+ " anim=" + a + " nextAppTransition=ANIM_CUSTOM"
3248+
+ " transit=" + transit + " Callers " + Debug.getCallers(3));
32483249
} else if (mNextAppTransitionType == ActivityOptions.ANIM_SCALE_UP) {
32493250
a = createScaleUpAnimationLocked(transit, enter);
32503251
initialized = true;
3252+
if (DEBUG_ANIM) Slog.v(TAG, "applyAnimation: wtoken=" + wtoken
3253+
+ " anim=" + a + " nextAppTransition=ANIM_SCALE_UP"
3254+
+ " transit=" + transit + " Callers " + Debug.getCallers(3));
32513255
} else if (mNextAppTransitionType == ActivityOptions.ANIM_THUMBNAIL) {
32523256
a = createThumbnailAnimationLocked(transit, enter, false);
32533257
initialized = true;
3258+
if (DEBUG_ANIM) Slog.v(TAG, "applyAnimation: wtoken=" + wtoken
3259+
+ " anim=" + a + " nextAppTransition=ANIM_THUMBNAIL"
3260+
+ " transit=" + transit + " Callers " + Debug.getCallers(3));
32543261
} else {
32553262
int animAttr = 0;
32563263
switch (transit) {
@@ -3309,7 +3316,7 @@ private boolean applyAnimationLocked(AppWindowToken wtoken,
33093316
if (DEBUG_ANIM) Slog.v(TAG, "applyAnimation: wtoken=" + wtoken
33103317
+ " anim=" + a
33113318
+ " animAttr=0x" + Integer.toHexString(animAttr)
3312-
+ " transit=" + transit);
3319+
+ " transit=" + transit + " Callers " + Debug.getCallers(3));
33133320
}
33143321
if (a != null) {
33153322
if (DEBUG_ANIM) {
@@ -7856,7 +7863,9 @@ public int handleAppTransitionReadyLocked() {
78567863
mToTopApps.clear();
78577864
}
78587865

7859-
WindowState oldWallpaper = mWallpaperTarget;
7866+
WindowState oldWallpaper =
7867+
mWallpaperTarget != null && mWallpaperTarget.mWinAnimator.isAnimating()
7868+
? null : mWallpaperTarget;
78607869

78617870
adjustWallpaperWindowsLocked();
78627871
mInnerFields.mWallpaperMayChange = false;
@@ -8167,8 +8176,8 @@ private void updateResizingWindows(final WindowState w) {
81678176
// to go through the process of getting informed
81688177
// by the application when it has finished drawing.
81698178
if (w.mOrientationChanging) {
8170-
if (DEBUG_ORIENTATION) Slog.v(TAG,
8171-
"Orientation start waiting for draw in "
8179+
if (DEBUG_ANIM || DEBUG_ORIENTATION) Slog.v(TAG,
8180+
"Orientation start waiting for draw mDrawState=DRAW_PENDING in "
81728181
+ w + ", surface " + winAnimator.mSurface);
81738182
winAnimator.mDrawState = WindowStateAnimator.DRAW_PENDING;
81748183
if (w.mAppToken != null) {

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,9 @@ void finishExit() {
380380

381381
boolean finishDrawingLocked() {
382382
if (mDrawState == DRAW_PENDING) {
383-
if (SHOW_TRANSACTIONS || DEBUG_ORIENTATION) Slog.v(
384-
TAG, "finishDrawingLocked: " + this + " in " + mSurface);
383+
if (DEBUG_ANIM || SHOW_TRANSACTIONS || DEBUG_ORIENTATION) Slog.v(
384+
TAG, "finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING " + this + " in "
385+
+ mSurface);
385386
mDrawState = COMMIT_DRAW_PENDING;
386387
return true;
387388
}
@@ -393,7 +394,8 @@ boolean commitFinishDrawingLocked(long currentTime) {
393394
if (mDrawState != COMMIT_DRAW_PENDING) {
394395
return false;
395396
}
396-
//Slog.i(TAG, "commitFinishDrawingLocked: Draw pending. " + mSurface);
397+
if (DEBUG_ANIM)
398+
Slog.i(TAG, "commitFinishDrawingLocked: mDrawState=READY_TO_SHOW " + mSurface);
397399
mDrawState = READY_TO_SHOW;
398400
final boolean starting = mWin.mAttrs.type == TYPE_APPLICATION_STARTING;
399401
final AppWindowToken atoken = mWin.mAppToken;
@@ -526,8 +528,8 @@ Surface createSurfaceLocked() {
526528
if (mSurface == null) {
527529
mReportDestroySurface = false;
528530
mSurfacePendingDestroy = false;
529-
if (DEBUG_ORIENTATION) Slog.i(TAG,
530-
"createSurface " + this + ": DRAW NOW PENDING");
531+
if (DEBUG_ANIM || DEBUG_ORIENTATION) Slog.i(TAG,
532+
"createSurface " + this + ": mDrawState=DRAW_PENDING");
531533
mDrawState = DRAW_PENDING;
532534
if (mWin.mAppToken != null) {
533535
mWin.mAppToken.allDrawn = false;
@@ -1062,6 +1064,9 @@ public void prepareSurfaceLocked(final boolean recoveringMemory) {
10621064
}
10631065
}
10641066
} else {
1067+
if (DEBUG_ANIM) {
1068+
Slog.v(TAG, "prepareSurface: No changes in animation for " + mWin);
1069+
}
10651070
displayed = true;
10661071
}
10671072

@@ -1145,6 +1150,7 @@ boolean performShowLocked() {
11451150

11461151
// Force the show in the next prepareSurfaceLocked() call.
11471152
mLastAlpha = -1;
1153+
if (DEBUG_ANIM) Slog.v(TAG, "performShowLocked: mDrawState=HAS_DRAWN");
11481154
mDrawState = HAS_DRAWN;
11491155
mService.scheduleAnimationLocked();
11501156

@@ -1285,7 +1291,7 @@ boolean applyAnimationLocked(int transit, boolean isEntrance) {
12851291
+ " anim=" + anim + " attr=0x" + Integer.toHexString(attr)
12861292
+ " a=" + a
12871293
+ " mAnimation=" + mAnimation
1288-
+ " isEntrance=" + isEntrance);
1294+
+ " isEntrance=" + isEntrance + " Callers " + Debug.getCallers(3));
12891295
if (a != null) {
12901296
if (WindowManagerService.DEBUG_ANIM) {
12911297
RuntimeException e = null;

0 commit comments

Comments
 (0)