@@ -212,6 +212,7 @@ public class PhoneStatusBar extends BaseStatusBar {
212212
213213 Choreographer mChoreographer ;
214214 boolean mAnimating ;
215+ boolean mClosing ; // only valid when mAnimating; indicates the initial acceleration
215216 float mAnimY ;
216217 float mAnimVel ;
217218 float mAnimAccel ;
@@ -1276,29 +1277,41 @@ void performCollapse() {
12761277 }
12771278 }
12781279
1280+ void resetLastAnimTime () {
1281+ mAnimLastTimeNanos = System .nanoTime ();
1282+ if (SPEW ) {
1283+ Throwable t = new Throwable ();
1284+ t .fillInStackTrace ();
1285+ Slog .d (TAG , "resetting last anim time=" + mAnimLastTimeNanos , t );
1286+ }
1287+ }
1288+
12791289 void doAnimation (long frameTimeNanos ) {
12801290 if (mAnimating ) {
1281- if (SPEW ) Slog .d (TAG , "doAnimation" );
1291+ if (SPEW ) Slog .d (TAG , "doAnimation dt=" + ( frameTimeNanos - mAnimLastTimeNanos ) );
12821292 if (SPEW ) Slog .d (TAG , "doAnimation before mAnimY=" + mAnimY );
12831293 incrementAnim (frameTimeNanos );
1284- if (SPEW ) Slog .d (TAG , "doAnimation after mAnimY=" + mAnimY );
1294+ if (SPEW ) {
1295+ Slog .d (TAG , "doAnimation after mAnimY=" + mAnimY );
1296+ Slog .d (TAG , "doAnimation expandedViewMax=" + getExpandedViewMaxHeight ());
1297+ }
12851298
1286- if (mAnimY >= getExpandedViewMaxHeight ()-1 ) {
1299+ if (mAnimY >= getExpandedViewMaxHeight ()-1 && ! mClosing ) {
12871300 if (SPEW ) Slog .d (TAG , "Animation completed to expanded state." );
12881301 mAnimating = false ;
12891302 updateExpandedViewPos (EXPANDED_FULL_OPEN );
12901303 performExpand ();
12911304 return ;
12921305 }
12931306
1294- if (mAnimY == 0 && mAnimAccel == 0 && mAnimVel == 0 ) {
1307+ if (mAnimY == 0 && mAnimAccel == 0 && mClosing ) {
12951308 if (SPEW ) Slog .d (TAG , "Animation completed to collapsed state." );
12961309 mAnimating = false ;
12971310 performCollapse ();
12981311 return ;
12991312 }
13001313
1301- if (mAnimY < getStatusBarHeight ()) {
1314+ if (mAnimY < getStatusBarHeight () && mClosing ) {
13021315 // Draw one more frame with the bar positioned at the top of the screen
13031316 // before ending the animation so that the user sees the bar in
13041317 // its final position. The call to performCollapse() causes a window
@@ -1336,6 +1349,9 @@ void incrementAnim(long frameTimeNanos) {
13361349 }
13371350
13381351 void doRevealAnimation (long frameTimeNanos ) {
1352+ if (SPEW ) {
1353+ Slog .d (TAG , "doRevealAnimation: dt=" + (frameTimeNanos - mAnimLastTimeNanos ));
1354+ }
13391355 final int h = getCloseViewHeight () + getStatusBarHeight ();
13401356 if (mAnimatingReveal && mAnimating && mAnimY < h ) {
13411357 incrementAnim (frameTimeNanos );
@@ -1365,7 +1381,7 @@ void prepareTracking(int y, boolean opening) {
13651381 updateExpandedViewPos ((int )mAnimY );
13661382 mAnimating = true ;
13671383 mAnimatingReveal = true ;
1368- mAnimLastTimeNanos = System . nanoTime ();
1384+ resetLastAnimTime ();
13691385 mChoreographer .removeCallbacks (Choreographer .CALLBACK_ANIMATION ,
13701386 mAnimationCallback , null );
13711387 mChoreographer .removeCallbacks (Choreographer .CALLBACK_ANIMATION ,
@@ -1439,8 +1455,9 @@ void performFling(int y, float vel, boolean always) {
14391455 //Slog.d(TAG, "mAnimY=" + mAnimY + " mAnimVel=" + mAnimVel
14401456 // + " mAnimAccel=" + mAnimAccel);
14411457
1442- mAnimLastTimeNanos = System . nanoTime ();
1458+ resetLastAnimTime ();
14431459 mAnimating = true ;
1460+ mClosing = mAnimAccel < 0 ;
14441461
14451462 mChoreographer .removeCallbacks (Choreographer .CALLBACK_ANIMATION ,
14461463 mAnimationCallback , null );
0 commit comments