@@ -1173,8 +1173,7 @@ static boolean canBeImeTarget(WindowState w) {
11731173 if (DEBUG_INPUT_METHOD ) {
11741174 Slog .i (TAG , "isVisibleOrAdding " + w + ": " + w .isVisibleOrAdding ());
11751175 if (!w .isVisibleOrAdding ()) {
1176- Slog .i (TAG , " mSurface=" + w .mWinAnimator .mSurface + " reportDestroy="
1177- + w .mWinAnimator .mReportDestroySurface
1176+ Slog .i (TAG , " mSurface=" + w .mWinAnimator .mSurface
11781177 + " relayoutCalled=" + w .mRelayoutCalled + " viewVis=" + w .mViewVisibility
11791178 + " policyVis=" + w .mPolicyVisibility + " attachHid=" + w .mAttachedHidden
11801179 + " exiting=" + w .mExiting + " destroying=" + w .mDestroying );
@@ -2651,7 +2650,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
26512650 int requestedHeight , int viewVisibility , int flags ,
26522651 Rect outFrame , Rect outContentInsets ,
26532652 Rect outVisibleInsets , Configuration outConfig , Surface outSurface ) {
2654- boolean displayed = false ;
2653+ boolean toBeDisplayed = false ;
26552654 boolean inTouchMode ;
26562655 boolean configChanged ;
26572656 boolean surfaceChanged = false ;
@@ -2754,7 +2753,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
27542753 }
27552754 if (viewVisibility == View .VISIBLE &&
27562755 (win .mAppToken == null || !win .mAppToken .clientHidden )) {
2757- displayed = !win .isVisibleLw ();
2756+ toBeDisplayed = !win .isVisibleLw ();
27582757 if (win .mExiting ) {
27592758 winAnimator .cancelExitAnimationForNextAnimationLocked ();
27602759 win .mExiting = false ;
@@ -2766,7 +2765,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
27662765 if (oldVisibility == View .GONE ) {
27672766 winAnimator .mEnterAnimationPending = true ;
27682767 }
2769- if (displayed ) {
2768+ if (toBeDisplayed ) {
27702769 if (win .isDrawnLw () && okToDisplay ()) {
27712770 winAnimator .applyEnterAnimationLocked ();
27722771 }
@@ -2792,7 +2791,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
27922791 if ((attrChanges &WindowManager .LayoutParams .FORMAT_CHANGED ) != 0 ) {
27932792 // To change the format, we need to re-build the surface.
27942793 winAnimator .destroySurfaceLocked ();
2795- displayed = true ;
2794+ toBeDisplayed = true ;
27962795 surfaceChanged = true ;
27972796 }
27982797 try {
@@ -2802,8 +2801,6 @@ public int relayoutWindow(Session session, IWindow client, int seq,
28022801 Surface surface = winAnimator .createSurfaceLocked ();
28032802 if (surface != null ) {
28042803 outSurface .copyFrom (surface );
2805- winAnimator .mReportDestroySurface = false ;
2806- winAnimator .mSurfacePendingDestroy = false ;
28072804 if (SHOW_TRANSACTIONS ) Slog .i (TAG ,
28082805 " OUT SURFACE " + outSurface + ": copied" );
28092806 } else {
@@ -2820,7 +2817,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
28202817 Binder .restoreCallingIdentity (origId );
28212818 return 0 ;
28222819 }
2823- if (displayed ) {
2820+ if (toBeDisplayed ) {
28242821 focusMayChange = true ;
28252822 }
28262823 if (win .mAttrs .type == TYPE_INPUT_METHOD
@@ -2845,19 +2842,18 @@ public int relayoutWindow(Session session, IWindow client, int seq,
28452842 winAnimator .mEnterAnimationPending = false ;
28462843 if (winAnimator .mSurface != null ) {
28472844 if (DEBUG_VISIBILITY ) Slog .i (TAG , "Relayout invis " + win
2848- + ": mExiting=" + win .mExiting
2849- + " mSurfacePendingDestroy=" + winAnimator .mSurfacePendingDestroy );
2845+ + ": mExiting=" + win .mExiting );
28502846 // If we are not currently running the exit animation, we
28512847 // need to see about starting one.
2852- if (!win .mExiting || winAnimator . mSurfacePendingDestroy ) {
2848+ if (!win .mExiting ) {
28532849 surfaceChanged = true ;
28542850 // Try starting an animation; if there isn't one, we
28552851 // can destroy the surface right away.
28562852 int transit = WindowManagerPolicy .TRANSIT_EXIT ;
28572853 if (win .mAttrs .type == TYPE_APPLICATION_STARTING ) {
28582854 transit = WindowManagerPolicy .TRANSIT_PREVIEW_DONE ;
28592855 }
2860- if (! winAnimator . mSurfacePendingDestroy && win .isWinVisibleLw () &&
2856+ if (win .isWinVisibleLw () &&
28612857 winAnimator .applyAnimationLocked (transit , false )) {
28622858 focusMayChange = true ;
28632859 win .mExiting = true ;
@@ -2880,22 +2876,8 @@ public int relayoutWindow(Session session, IWindow client, int seq,
28802876 }
28812877 }
28822878
2883- if (winAnimator .mSurface == null || (win .getAttrs ().flags
2884- & WindowManager .LayoutParams .FLAG_KEEP_SURFACE_WHILE_ANIMATING ) == 0
2885- || winAnimator .mSurfacePendingDestroy ) {
2886- // We could be called from a local process, which
2887- // means outSurface holds its current surface. Ensure the
2888- // surface object is cleared, but we don't necessarily want
2889- // it actually destroyed at this point.
2890- winAnimator .mSurfacePendingDestroy = false ;
2891- outSurface .release ();
2892- if (DEBUG_VISIBILITY ) Slog .i (TAG , "Releasing surface in: " + win );
2893- } else if (winAnimator .mSurface != null ) {
2894- if (DEBUG_VISIBILITY ) Slog .i (TAG ,
2895- "Keeping surface, will report destroy: " + win );
2896- winAnimator .mReportDestroySurface = true ;
2897- outSurface .copyFrom (winAnimator .mSurface );
2898- }
2879+ outSurface .release ();
2880+ if (DEBUG_VISIBILITY ) Slog .i (TAG , "Releasing surface in: " + win );
28992881 }
29002882
29012883 if (focusMayChange ) {
@@ -2912,7 +2894,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
29122894 boolean assignLayers = false ;
29132895
29142896 if (imMayMove ) {
2915- if (moveInputMethodWindowsIfNeededLocked (false ) || displayed ) {
2897+ if (moveInputMethodWindowsIfNeededLocked (false ) || toBeDisplayed ) {
29162898 // Little hack here -- we -should- be able to rely on the
29172899 // function to return true if the IME has moved and needs
29182900 // its layer recomputed. However, if the IME was hidden
@@ -2934,7 +2916,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
29342916 }
29352917 configChanged = updateOrientationFromAppTokensLocked (false );
29362918 performLayoutAndPlaceSurfacesLocked ();
2937- if (displayed && win .mIsWallpaper ) {
2919+ if (toBeDisplayed && win .mIsWallpaper ) {
29382920 updateWallpaperOffsetLocked (win , mAppDisplayWidth , mAppDisplayHeight , false );
29392921 }
29402922 if (win .mAppToken != null ) {
@@ -2970,7 +2952,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
29702952 Binder .restoreCallingIdentity (origId );
29712953
29722954 return (inTouchMode ? WindowManagerImpl .RELAYOUT_RES_IN_TOUCH_MODE : 0 )
2973- | (displayed ? WindowManagerImpl .RELAYOUT_RES_FIRST_TIME : 0 )
2955+ | (toBeDisplayed ? WindowManagerImpl .RELAYOUT_RES_FIRST_TIME : 0 )
29742956 | (surfaceChanged ? WindowManagerImpl .RELAYOUT_RES_SURFACE_CHANGED : 0 )
29752957 | (animating ? WindowManagerImpl .RELAYOUT_RES_ANIMATING : 0 );
29762958 }
0 commit comments