@@ -176,7 +176,7 @@ private void copyLayoutToAnimParamsLocked() {
176176 // Set the new DimAnimator params.
177177 DimAnimator .Parameters dimParams = layoutToAnim .mDimParams ;
178178 if (dimParams == null ) {
179- mDimParams = dimParams ;
179+ mDimParams = null ;
180180 } else {
181181 final WindowStateAnimator newWinAnimator = dimParams .mDimWinAnimator ;
182182
@@ -187,7 +187,7 @@ private void copyLayoutToAnimParamsLocked() {
187187 if (newWinAnimator .mSurfaceShown &&
188188 (existingDimWinAnimator == null || !existingDimWinAnimator .mSurfaceShown
189189 || existingDimWinAnimator .mAnimLayer < newWinAnimator .mAnimLayer )) {
190- mDimParams = dimParams ;
190+ mDimParams = new DimAnimator . Parameters ( dimParams ) ;
191191 }
192192 }
193193
@@ -559,15 +559,6 @@ private void testTokenMayBeDrawnLocked() {
559559 private void performAnimationsLocked (final WinAnimatorList winAnimatorList ) {
560560 updateWindowsLocked (winAnimatorList );
561561 updateWallpaperLocked (winAnimatorList );
562-
563- for (int i = mPendingLayoutChanges .size () - 1 ; i >= 0 ; i --) {
564- if ((mPendingLayoutChanges .valueAt (i )
565- & WindowManagerPolicy .FINISH_LAYOUT_REDO_WALLPAPER ) != 0 ) {
566- mPendingActions |= WALLPAPER_ACTION_PENDING ;
567- }
568- }
569-
570- testTokenMayBeDrawnLocked ();
571562 }
572563
573564 // TODO(cmautner): Change the following comment when no longer locked on mWindowMap */
@@ -576,12 +567,7 @@ private void animateLocked() {
576567 if (!mInitialized ) {
577568 return ;
578569 }
579- for (int i = mWinAnimatorLists .size () - 1 ; i >= 0 ; i --) {
580- animateLocked (mWinAnimatorLists .get (i ));
581- }
582- }
583570
584- private void animateLocked (final WinAnimatorList winAnimatorList ) {
585571 mPendingLayoutChanges .clear ();
586572 mCurrentTime = SystemClock .uptimeMillis ();
587573 mBulkUpdateParams = SET_ORIENTATION_CHANGE_COMPLETE ;
@@ -591,23 +577,29 @@ private void animateLocked(final WinAnimatorList winAnimatorList) {
591577 Slog .i (TAG , "!!! animate: entry time=" + mCurrentTime );
592578 }
593579
594- // Update animations of all applications, including those
595- // associated with exiting/removed apps
580+ if ( WindowManagerService . SHOW_TRANSACTIONS ) Slog . i (
581+ TAG , ">>> OPEN TRANSACTION animateLocked" );
596582 Surface .openTransaction ();
597-
598583 try {
599584 updateWindowsAppsAndRotationAnimationsLocked ();
600- performAnimationsLocked (winAnimatorList );
601585
602- // THIRD LOOP: Update the surfaces of all windows.
586+ for (int i = mWinAnimatorLists .size () - 1 ; i >= 0 ; i --) {
587+ final WinAnimatorList winAnimatorList = mWinAnimatorLists .get (i );
603588
604- if (mScreenRotationAnimation != null ) {
605- mScreenRotationAnimation .updateSurfacesInTransaction ();
589+ // Update animations of all applications, including those
590+ // associated with exiting/removed apps
591+ performAnimationsLocked (winAnimatorList );
592+
593+ final int N = winAnimatorList .size ();
594+ for (int j = 0 ; j < N ; j ++) {
595+ winAnimatorList .get (j ).prepareSurfaceLocked (true );
596+ }
606597 }
607598
608- final int N = winAnimatorList .size ();
609- for (int i = 0 ; i < N ; i ++) {
610- winAnimatorList .get (i ).prepareSurfaceLocked (true );
599+ testTokenMayBeDrawnLocked ();
600+
601+ if (mScreenRotationAnimation != null ) {
602+ mScreenRotationAnimation .updateSurfacesInTransaction ();
611603 }
612604
613605 if (mDimParams != null ) {
@@ -634,6 +626,15 @@ private void animateLocked(final WinAnimatorList winAnimatorList) {
634626 Log .wtf (TAG , "Unhandled exception in Window Manager" , e );
635627 } finally {
636628 Surface .closeTransaction ();
629+ if (WindowManagerService .SHOW_TRANSACTIONS ) Slog .i (
630+ TAG , "<<< CLOSE TRANSACTION animateLocked" );
631+ }
632+
633+ for (int i = mPendingLayoutChanges .size () - 1 ; i >= 0 ; i --) {
634+ if ((mPendingLayoutChanges .valueAt (i )
635+ & WindowManagerPolicy .FINISH_LAYOUT_REDO_WALLPAPER ) != 0 ) {
636+ mPendingActions |= WALLPAPER_ACTION_PENDING ;
637+ }
637638 }
638639
639640 if (mBulkUpdateParams != 0 || mPendingLayoutChanges .size () > 0 ) {
0 commit comments