Skip to content

Commit 1dd3ed0

Browse files
author
Craig Mautner
committed
Perform finish animation actions.
When stepAnimation returns false, do not return false immediately. Instead carry out finish actions. Also, remove state machine that is no longer necessary. Fixes bug 6184070. Change-Id: I530eb2b62b864bbce929f573d10b31b102152f1f
1 parent 4108fbc commit 1dd3ed0

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ boolean stepAnimationLocked(long currentTime, int dw, int dh) {
240240
animation.setStartTime(currentTime);
241241
animating = true;
242242
}
243-
// we're done!
244-
return stepAnimation(currentTime);
243+
if (stepAnimation(currentTime)) {
244+
// we're done!
245+
return true;
246+
}
245247
}
246248
} else if (animation != null) {
247249
// If the display is frozen, and there is a pending animation,

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
305305
int mAnimDw;
306306
int mAnimDh;
307307

308-
static final int ANIM_STATE_IDLE = 0;
309-
static final int ANIM_STATE_RUNNING = 1;
310-
static final int ANIM_STATE_STOPPING = 2;
311-
int mAnimState = ANIM_STATE_IDLE;
312-
313308
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
314309
WindowState attachedWindow, int seq, WindowManager.LayoutParams a,
315310
int viewVisibility) {
@@ -653,7 +648,6 @@ public void clearAnimation() {
653648
mLocalAnimating = false;
654649
mAnimation.cancel();
655650
mAnimation = null;
656-
mAnimState = ANIM_STATE_IDLE;
657651
}
658652
}
659653

@@ -665,7 +659,6 @@ void cancelExitAnimationForNextAnimationLocked() {
665659
mAnimation.cancel();
666660
mAnimation = null;
667661
destroySurfaceLocked();
668-
mAnimState = ANIM_STATE_IDLE;
669662
}
670663
mExiting = false;
671664
}
@@ -971,7 +964,8 @@ boolean performShowLocked() {
971964
mAppToken.firstWindowDrawn = true;
972965

973966
if (mAppToken.startingData != null) {
974-
if (WindowManagerService.DEBUG_STARTING_WINDOW || WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
967+
if (WindowManagerService.DEBUG_STARTING_WINDOW ||
968+
WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
975969
"Finish starting " + mToken
976970
+ ": first real window is shown, no animation");
977971
// If this initial window is animating, stop it -- we
@@ -983,7 +977,6 @@ boolean performShowLocked() {
983977
mAnimation = null;
984978
// Make sure we clean up the animation.
985979
mAnimating = true;
986-
mAnimState = ANIM_STATE_IDLE;
987980
}
988981
mService.mFinishedStarting.add(mAppToken);
989982
mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
@@ -995,17 +988,14 @@ boolean performShowLocked() {
995988
}
996989

997990
private boolean stepAnimation(long currentTime) {
998-
if ((mAnimation == null) || !mLocalAnimating || (mAnimState != ANIM_STATE_RUNNING)) {
991+
if ((mAnimation == null) || !mLocalAnimating) {
999992
return false;
1000993
}
1001994
mTransformation.clear();
1002995
final boolean more = mAnimation.getTransformation(currentTime, mTransformation);
1003996
if (WindowManagerService.DEBUG_ANIM) Slog.v(
1004997
WindowManagerService.TAG, "Stepped animation in " + this +
1005998
": more=" + more + ", xform=" + mTransformation);
1006-
if (!more) {
1007-
mAnimState = ANIM_STATE_STOPPING;
1008-
}
1009999
return more;
10101000
}
10111001

@@ -1032,11 +1022,11 @@ boolean stepAnimationLocked(long currentTime) {
10321022
mAnimation.setStartTime(currentTime);
10331023
mLocalAnimating = true;
10341024
mAnimating = true;
1035-
mAnimState = ANIM_STATE_RUNNING;
10361025
}
1037-
if ((mAnimation != null) && mLocalAnimating &&
1038-
(mAnimState != ANIM_STATE_STOPPING)) {
1039-
return stepAnimation(currentTime);
1026+
if ((mAnimation != null) && mLocalAnimating) {
1027+
if (stepAnimation(currentTime)) {
1028+
return true;
1029+
}
10401030
}
10411031
if (WindowManagerService.DEBUG_ANIM) Slog.v(
10421032
WindowManagerService.TAG, "Finished animation in " + this +
@@ -1137,7 +1127,6 @@ boolean stepAnimationLocked(long currentTime) {
11371127
mAppToken.updateReportedVisibilityLocked();
11381128
}
11391129

1140-
mAnimState = ANIM_STATE_IDLE;
11411130
return false;
11421131
}
11431132

0 commit comments

Comments
 (0)