@@ -38,7 +38,6 @@ public class WindowAnimator {
3838 ArrayList <WindowStateAnimator > mWinAnimators = new ArrayList <WindowStateAnimator >();
3939
4040 boolean mAnimating ;
41- boolean mTokenMayBeDrawn ;
4241 boolean mForceHiding ;
4342 WindowState mWindowAnimationBackground ;
4443 int mWindowAnimationBackgroundColor ;
@@ -57,7 +56,7 @@ public class WindowAnimator {
5756
5857 /** Skip repeated AppWindowTokens initialization. Note that AppWindowsToken's version of this
5958 * is a long initialized to Long.MIN_VALUE so that it doesn't match this value on startup. */
60- private int mTransactionSequence ;
59+ private int mAnimTransactionSequence ;
6160
6261 /** The one and only screen rotation if one is happening */
6362 ScreenRotationAnimation mScreenRotationAnimation = null ;
@@ -194,7 +193,7 @@ private void updateWindowsAppsAndRotationAnimationsLocked() {
194193 }
195194
196195 private void updateWindowsAndWallpaperLocked () {
197- ++mTransactionSequence ;
196+ ++mAnimTransactionSequence ;
198197
199198 ArrayList <WindowStateAnimator > unForceHiding = null ;
200199 boolean wallpaperInUnForceHiding = false ;
@@ -332,59 +331,22 @@ private void updateWindowsAndWallpaperLocked() {
332331 }
333332
334333 final AppWindowToken atoken = win .mAppToken ;
335- if (atoken != null && (!atoken .allDrawn || atoken .mAppAnimator .freezingScreen )) {
336- if (atoken .lastTransactionSequence != mTransactionSequence ) {
337- atoken .lastTransactionSequence = mTransactionSequence ;
338- atoken .numInterestingWindows = atoken .numDrawnWindows = 0 ;
339- atoken .startingDisplayed = false ;
340- }
341- if ((win .isOnScreen () || winAnimator .mAttrType
342- == WindowManager .LayoutParams .TYPE_BASE_APPLICATION )
343- && !win .mExiting && !win .mDestroying ) {
344- if (WindowManagerService .DEBUG_VISIBILITY ||
345- WindowManagerService .DEBUG_ORIENTATION ) {
346- Slog .v (TAG , "Eval win " + win + ": isDrawn=" + win .isDrawnLw ()
347- + ", isAnimating=" + winAnimator .isAnimating ());
348- if (!win .isDrawnLw ()) {
349- Slog .v (TAG , "Not displayed: s=" + winAnimator .mSurface
350- + " pv=" + win .mPolicyVisibility
351- + " mDrawState=" + winAnimator .mDrawState
352- + " ah=" + win .mAttachedHidden
353- + " th=" + atoken .hiddenRequested
354- + " a=" + winAnimator .mAnimating );
355- }
356- }
357- if (win != atoken .startingWindow ) {
358- if (!atoken .mAppAnimator .freezingScreen || !win .mAppFreezing ) {
359- atoken .numInterestingWindows ++;
360- if (win .isDrawnLw ()) {
361- atoken .numDrawnWindows ++;
362- if (WindowManagerService .DEBUG_VISIBILITY ||
363- WindowManagerService .DEBUG_ORIENTATION ) Slog .v (TAG ,
364- "tokenMayBeDrawn: " + atoken
365- + " freezingScreen=" + atoken .mAppAnimator .freezingScreen
366- + " mAppFreezing=" + win .mAppFreezing );
367- mTokenMayBeDrawn = true ;
368- }
334+ if (winAnimator .mDrawState == WindowStateAnimator .READY_TO_SHOW ) {
335+ if (atoken == null || atoken .allDrawn ) {
336+ if (winAnimator .performShowLocked ()) {
337+ mPendingLayoutChanges |= WindowManagerPolicy .FINISH_LAYOUT_REDO_ANIM ;
338+ if (WindowManagerService .DEBUG_LAYOUT_REPEATS ) {
339+ mService .debugLayoutRepeats ("updateWindowsAndWallpaperLocked 5" ,
340+ mPendingLayoutChanges );
369341 }
370- } else if (win .isDrawnLw ()) {
371- atoken .startingDisplayed = true ;
372- }
373- }
374- } else if (winAnimator .mDrawState == WindowStateAnimator .READY_TO_SHOW ) {
375- if (winAnimator .performShowLocked ()) {
376- mPendingLayoutChanges |= WindowManagerPolicy .FINISH_LAYOUT_REDO_ANIM ;
377- if (WindowManagerService .DEBUG_LAYOUT_REPEATS ) {
378- mService .debugLayoutRepeats ("updateWindowsAndWallpaperLocked 5" ,
379- mPendingLayoutChanges );
380342 }
381343 }
382344 }
383345 final AppWindowAnimator appAnimator =
384346 atoken == null ? null : atoken .mAppAnimator ;
385347 if (appAnimator != null && appAnimator .thumbnail != null ) {
386- if (appAnimator .thumbnailTransactionSeq != mTransactionSequence ) {
387- appAnimator .thumbnailTransactionSeq = mTransactionSequence ;
348+ if (appAnimator .thumbnailTransactionSeq != mAnimTransactionSequence ) {
349+ appAnimator .thumbnailTransactionSeq = mAnimTransactionSequence ;
388350 appAnimator .thumbnailLayer = 0 ;
389351 }
390352 if (appAnimator .thumbnailLayer < winAnimator .mAnimLayer ) {
@@ -414,47 +376,39 @@ private void testTokenMayBeDrawnLocked() {
414376 final int NT = appTokens .size ();
415377 for (int i =0 ; i <NT ; i ++) {
416378 AppWindowToken wtoken = appTokens .get (i );
417- if (wtoken .mAppAnimator .freezingScreen ) {
418- int numInteresting = wtoken .numInterestingWindows ;
419- if (numInteresting > 0 && wtoken .numDrawnWindows >= numInteresting ) {
420- if (WindowManagerService .DEBUG_VISIBILITY ) Slog .v (TAG ,
421- "allDrawn: " + wtoken
422- + " interesting=" + numInteresting
423- + " drawn=" + wtoken .numDrawnWindows );
424- wtoken .mAppAnimator .showAllWindowsLocked ();
425- mService .unsetAppFreezingScreenLocked (wtoken , false , true );
426- if (WindowManagerService .DEBUG_ORIENTATION ) Slog .i (TAG ,
427- "Setting mOrientationChangeComplete=true because wtoken "
428- + wtoken + " numInteresting=" + numInteresting
429- + " numDrawn=" + wtoken .numDrawnWindows );
430- // This will set mOrientationChangeComplete and cause a pass through layout.
431- mPendingLayoutChanges |= WindowManagerPolicy .FINISH_LAYOUT_REDO_WALLPAPER ;
432- }
433- } else if (!wtoken .allDrawn ) {
434- int numInteresting = wtoken .numInterestingWindows ;
435- if (numInteresting > 0 && wtoken .numDrawnWindows >= numInteresting ) {
436- if (WindowManagerService .DEBUG_VISIBILITY ) Slog .v (TAG ,
437- "allDrawn: " + wtoken
438- + " interesting=" + numInteresting
439- + " drawn=" + wtoken .numDrawnWindows );
440- wtoken .allDrawn = true ;
441- mPendingLayoutChanges |= PhoneWindowManager .FINISH_LAYOUT_REDO_ANIM ;
442- if (WindowManagerService .DEBUG_LAYOUT_REPEATS ) {
443- mService .debugLayoutRepeats ("testTokenMayBeDrawnLocked" ,
444- mPendingLayoutChanges );
445- }
379+ final boolean allDrawn = wtoken .allDrawn ;
380+ if (allDrawn != wtoken .mAppAnimator .allDrawn ) {
381+ wtoken .mAppAnimator .allDrawn = allDrawn ;
382+ if (allDrawn ) {
383+ // The token has now changed state to having all
384+ // windows shown... what to do, what to do?
385+ if (wtoken .mAppAnimator .freezingScreen ) {
386+ wtoken .mAppAnimator .showAllWindowsLocked ();
387+ mService .unsetAppFreezingScreenLocked (wtoken , false , true );
388+ if (WindowManagerService .DEBUG_ORIENTATION ) Slog .i (TAG ,
389+ "Setting mOrientationChangeComplete=true because wtoken "
390+ + wtoken + " numInteresting=" + wtoken .numInterestingWindows
391+ + " numDrawn=" + wtoken .numDrawnWindows );
392+ // This will set mOrientationChangeComplete and cause a pass through layout.
393+ mPendingLayoutChanges |= WindowManagerPolicy .FINISH_LAYOUT_REDO_WALLPAPER ;
394+ } else {
395+ mPendingLayoutChanges |= PhoneWindowManager .FINISH_LAYOUT_REDO_ANIM ;
396+ if (WindowManagerService .DEBUG_LAYOUT_REPEATS ) {
397+ mService .debugLayoutRepeats ("testTokenMayBeDrawnLocked" ,
398+ mPendingLayoutChanges );
399+ }
446400
447- // We can now show all of the drawn windows!
448- if (!mService .mOpeningApps .contains (wtoken )) {
449- mAnimating |= wtoken .mAppAnimator .showAllWindowsLocked ();
401+ // We can now show all of the drawn windows!
402+ if (!mService .mOpeningApps .contains (wtoken )) {
403+ mAnimating |= wtoken .mAppAnimator .showAllWindowsLocked ();
404+ }
450405 }
451406 }
452407 }
453408 }
454409 }
455410
456411 private void performAnimationsLocked () {
457- mTokenMayBeDrawn = false ;
458412 mForceHiding = false ;
459413 mDetachedWallpaper = null ;
460414 mWindowAnimationBackground = null ;
@@ -465,9 +419,7 @@ private void performAnimationsLocked() {
465419 mPendingActions |= WALLPAPER_ACTION_PENDING ;
466420 }
467421
468- if (mTokenMayBeDrawn ) {
469- testTokenMayBeDrawnLocked ();
470- }
422+ testTokenMayBeDrawnLocked ();
471423 }
472424
473425 synchronized void animate () {
@@ -584,18 +536,23 @@ boolean isDimming(final WindowStateAnimator winAnimator) {
584536 }
585537
586538 public void dump (PrintWriter pw , String prefix , boolean dumpAll ) {
587- if (mWindowDetachedWallpaper != null ) {
588- pw .print (" mWindowDetachedWallpaper=" ); pw .println (mWindowDetachedWallpaper );
589- }
590- if (mWindowAnimationBackgroundSurface != null ) {
591- pw .println (" mWindowAnimationBackgroundSurface:" );
592- mWindowAnimationBackgroundSurface .printTo (" " , pw );
593- }
594- if (mDimAnimator != null ) {
595- pw .println (" mDimAnimator:" );
596- mDimAnimator .printTo (" " , pw );
597- } else {
598- pw .println ( " no DimAnimator " );
539+ if (dumpAll ) {
540+ if (mWindowDetachedWallpaper != null ) {
541+ pw .print (prefix ); pw .print ("mWindowDetachedWallpaper=" );
542+ pw .println (mWindowDetachedWallpaper );
543+ }
544+ pw .print (prefix ); pw .print ("mAnimTransactionSequence=" );
545+ pw .println (mAnimTransactionSequence );
546+ if (mWindowAnimationBackgroundSurface != null ) {
547+ pw .print (prefix ); pw .print ("mWindowAnimationBackgroundSurface:" );
548+ mWindowAnimationBackgroundSurface .printTo (prefix + " " , pw );
549+ }
550+ if (mDimAnimator != null ) {
551+ pw .print (prefix ); pw .print ("mDimAnimator:" );
552+ mDimAnimator .printTo (prefix + " " , pw );
553+ } else {
554+ pw .print (prefix ); pw .print ("no DimAnimator " );
555+ }
599556 }
600557 }
601558
0 commit comments