Skip to content

Commit 6098c1f

Browse files
author
Jeff Brown
committed
Fix status bar animation jank on last frame.
Change-Id: Idd99f37c76038de1c02a8297c6454c357a846294
1 parent ed5f45a commit 6098c1f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,23 +1254,36 @@ void doAnimation(long frameTimeNanos) {
12541254
if (SPEW) Slog.d(TAG, "doAnimation before mAnimY=" + mAnimY);
12551255
incrementAnim(frameTimeNanos);
12561256
if (SPEW) Slog.d(TAG, "doAnimation after mAnimY=" + mAnimY);
1257+
12571258
if (mAnimY >= getExpandedViewMaxHeight()-1) {
12581259
if (SPEW) Slog.d(TAG, "Animation completed to expanded state.");
12591260
mAnimating = false;
12601261
updateExpandedViewPos(EXPANDED_FULL_OPEN);
12611262
performExpand();
1263+
return;
12621264
}
1263-
else if (mAnimY < getStatusBarHeight()) {
1265+
1266+
if (mAnimY == 0 && mAnimAccel == 0 && mAnimVel == 0) {
12641267
if (SPEW) Slog.d(TAG, "Animation completed to collapsed state.");
12651268
mAnimating = false;
1266-
updateExpandedViewPos(0);
12671269
performCollapse();
1270+
return;
12681271
}
1269-
else {
1270-
updateExpandedViewPos((int)mAnimY);
1271-
mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION,
1272-
mAnimationCallback, null);
1272+
1273+
if (mAnimY < getStatusBarHeight()) {
1274+
// Draw one more frame with the bar positioned at the top of the screen
1275+
// before ending the animation so that the user sees the bar in
1276+
// its final position. The call to performCollapse() causes a window
1277+
// relayout which takes time and might cause the animation to skip
1278+
// on the very last frame before the bar disappears if we did it now.
1279+
mAnimY = 0;
1280+
mAnimAccel = 0;
1281+
mAnimVel = 0;
12731282
}
1283+
1284+
updateExpandedViewPos((int)mAnimY);
1285+
mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION,
1286+
mAnimationCallback, null);
12741287
}
12751288
}
12761289

0 commit comments

Comments
 (0)