@@ -4245,6 +4245,7 @@ void unsetAppFreezingScreenLocked(AppWindowToken wtoken,
42454245 if (w .mHasSurface && !w .mOrientationChanging ) {
42464246 if (DEBUG_ORIENTATION ) Slog .v (TAG , "set mOrientationChanging of " + w );
42474247 w .mOrientationChanging = true ;
4248+ mInnerFields .mOrientationChangeComplete = false ;
42484249 }
42494250 unfrozeWindows = true ;
42504251 }
@@ -5550,6 +5551,7 @@ public boolean updateRotationUncheckedLocked(boolean inTransaction) {
55505551 if (w .mHasSurface ) {
55515552 if (DEBUG_ORIENTATION ) Slog .v (TAG , "Set mOrientationChanging of " + w );
55525553 w .mOrientationChanging = true ;
5554+ mInnerFields .mOrientationChangeComplete = false ;
55535555 }
55545556 }
55555557 for (int i =mRotationWatchers .size ()-1 ; i >=0 ; i --) {
@@ -7654,6 +7656,7 @@ void makeWindowFreezingScreenIfNeededLocked(WindowState w) {
76547656 if (DEBUG_ORIENTATION ) Slog .v (TAG ,
76557657 "Changing surface while display frozen: " + w );
76567658 w .mOrientationChanging = true ;
7659+ mInnerFields .mOrientationChangeComplete = false ;
76577660 if (!mWindowsFreezingScreen ) {
76587661 mWindowsFreezingScreen = true ;
76597662 // XXX should probably keep timeout from
@@ -8022,7 +8025,7 @@ private void updateResizingWindows(final WindowState w) {
80228025 Slog .v (TAG , "Resize reasons: "
80238026 + " contentInsetsChanged=" + w .mContentInsetsChanged
80248027 + " visibleInsetsChanged=" + w .mVisibleInsetsChanged
8025- + " surfaceResized=" + w . mWinAnimator .mSurfaceResized
8028+ + " surfaceResized=" + winAnimator .mSurfaceResized
80268029 + " configChanged=" + configChanged );
80278030 }
80288031
@@ -8037,23 +8040,23 @@ private void updateResizingWindows(final WindowState w) {
80378040 if (w .mOrientationChanging ) {
80388041 if (DEBUG_ORIENTATION ) Slog .v (TAG ,
80398042 "Orientation start waiting for draw in "
8040- + w + ", surface " + w . mWinAnimator .mSurface );
8043+ + w + ", surface " + winAnimator .mSurface );
80418044 winAnimator .mDrawState = WindowStateAnimator .DRAW_PENDING ;
80428045 if (w .mAppToken != null ) {
80438046 w .mAppToken .allDrawn = false ;
80448047 }
80458048 }
80468049 if (!mResizingWindows .contains (w )) {
80478050 if (DEBUG_RESIZE || DEBUG_ORIENTATION ) Slog .v (TAG ,
8048- "Resizing window " + w + " to " + w . mWinAnimator .mSurfaceW
8049- + "x" + w . mWinAnimator .mSurfaceH );
8051+ "Resizing window " + w + " to " + winAnimator .mSurfaceW
8052+ + "x" + winAnimator .mSurfaceH );
80508053 mResizingWindows .add (w );
80518054 }
80528055 } else if (w .mOrientationChanging ) {
80538056 if (w .isDrawnLw ()) {
80548057 if (DEBUG_ORIENTATION ) Slog .v (TAG ,
80558058 "Orientation not waiting for draw in "
8056- + w + ", surface " + w . mWinAnimator .mSurface );
8059+ + w + ", surface " + winAnimator .mSurface );
80578060 w .mOrientationChanging = false ;
80588061 }
80598062 }
@@ -8125,7 +8128,8 @@ private void handleNotObscuredLocked(final WindowState w, final long currentTime
81258128 private final void performLayoutAndPlaceSurfacesLockedInner (
81268129 boolean recoveringMemory ) {
81278130 if (DEBUG_WINDOW_TRACE ) {
8128- Slog .v (TAG , "performLayoutAndPlaceSurfacesLockedInner: entry" );
8131+ Slog .v (TAG , "performLayoutAndPlaceSurfacesLockedInner: entry. Called by "
8132+ + getCallers (3 ));
81298133 }
81308134 if (mDisplay == null ) {
81318135 Slog .i (TAG , "skipping performLayoutAndPlaceSurfacesLockedInner with no mDisplay" );
@@ -8145,7 +8149,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
81458149 updateFocusedWindowLocked (UPDATE_FOCUS_WILL_PLACE_SURFACES ,
81468150 false /*updateInputWindows*/ );
81478151 }
8148-
8152+
81498153 // Initialize state of exiting tokens.
81508154 for (i =mExitingTokens .size ()-1 ; i >=0 ; i --) {
81518155 mExitingTokens .get (i ).hasVisible = false ;
@@ -8174,7 +8178,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
81748178
81758179 try {
81768180 int repeats = 0 ;
8177-
8181+
81788182 do {
81798183 repeats ++;
81808184 if (repeats > 6 ) {
@@ -8234,7 +8238,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
82348238 mInnerFields .mObscured = false ;
82358239 mInnerFields .mDimming = false ;
82368240 mInnerFields .mSyswin = false ;
8237-
8241+
82388242 boolean focusDisplayed = false ;
82398243 final int N = mWindows .size ();
82408244 for (i =N -1 ; i >=0 ; i --) {
@@ -8258,7 +8262,52 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
82588262 // has been updated accordingly.
82598263 updateWallpaperVisibilityLocked ();
82608264 }
8265+
8266+ final WindowStateAnimator winAnimator = w .mWinAnimator ;
8267+
8268+ // If the window has moved due to its containing
8269+ // content frame changing, then we'd like to animate
8270+ // it.
8271+ if (w .mHasSurface && w .shouldAnimateMove ()) {
8272+ // Frame has moved, containing content frame
8273+ // has also moved, and we're not currently animating...
8274+ // let's do something.
8275+ Animation a = AnimationUtils .loadAnimation (mContext ,
8276+ com .android .internal .R .anim .window_move_from_decor );
8277+ winAnimator .setAnimation (a );
8278+ winAnimator .mAnimDw = w .mLastFrame .left - w .mFrame .left ;
8279+ winAnimator .mAnimDh = w .mLastFrame .top - w .mFrame .top ;
8280+ } else {
8281+ winAnimator .mAnimDw = innerDw ;
8282+ winAnimator .mAnimDh = innerDh ;
8283+ }
8284+
8285+ //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
8286+ w .mContentChanged = false ;
8287+
8288+ // Moved from updateWindowsAndWallpaperLocked().
8289+ if (w .mHasSurface ) {
8290+ // Take care of the window being ready to display.
8291+ if (winAnimator .commitFinishDrawingLocked (currentTime )) {
8292+ if ((w .mAttrs .flags
8293+ & WindowManager .LayoutParams .FLAG_SHOW_WALLPAPER ) != 0 ) {
8294+ if (WindowManagerService .DEBUG_WALLPAPER ) Slog .v (TAG ,
8295+ "First draw done in potential wallpaper target " + w );
8296+ mInnerFields .mWallpaperMayChange = true ;
8297+ mPendingLayoutChanges |= WindowManagerPolicy .FINISH_LAYOUT_REDO_WALLPAPER ;
8298+ if (WindowManagerService .DEBUG_LAYOUT_REPEATS ) {
8299+ debugLayoutRepeats ("updateWindowsAndWallpaperLocked 1" ,
8300+ mPendingLayoutChanges );
8301+ }
8302+ }
8303+ }
8304+
8305+ winAnimator .setSurfaceBoundaries (recoveringMemory );
8306+ }
8307+
8308+ updateResizingWindows (w );
82618309 }
8310+
82628311 if (focusDisplayed ) {
82638312 mH .sendEmptyMessage (H .REPORT_LOSING_FOCUS );
82648313 }
@@ -8340,68 +8389,10 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
83408389 if (DEBUG_LAYOUT_REPEATS ) debugLayoutRepeats ("mLayoutNeeded" , mPendingLayoutChanges );
83418390 }
83428391
8343- final int N = mWindows .size ();
8344- for (i =N -1 ; i >=0 ; i --) {
8345- final WindowState w = mWindows .get (i );
8346- final WindowStateAnimator winAnimator = w .mWinAnimator ;
8347-
8348- // If the window has moved due to its containing
8349- // content frame changing, then we'd like to animate
8350- // it.
8351- if (w .mHasSurface && w .shouldAnimateMove ()) {
8352- // Frame has moved, containing content frame
8353- // has also moved, and we're not currently animating...
8354- // let's do something.
8355- Animation a = AnimationUtils .loadAnimation (mContext ,
8356- com .android .internal .R .anim .window_move_from_decor );
8357- winAnimator .setAnimation (a );
8358- winAnimator .mAnimDw = w .mLastFrame .left - w .mFrame .left ;
8359- winAnimator .mAnimDh = w .mLastFrame .top - w .mFrame .top ;
8360- } else {
8361- winAnimator .mAnimDw = innerDw ;
8362- winAnimator .mAnimDh = innerDh ;
8363- }
8364-
8365- //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
8366- w .mContentChanged = false ;
8367-
8368- // TODO(cmautner): Can this move up to the loop at the end of try/catch above?
8369- updateResizingWindows (w );
8370-
8371- // Moved from updateWindowsAndWallpaperLocked().
8372- if (w .mHasSurface ) {
8373- // Take care of the window being ready to display.
8374- if (winAnimator .commitFinishDrawingLocked (currentTime )) {
8375- if ((w .mAttrs .flags
8376- & WindowManager .LayoutParams .FLAG_SHOW_WALLPAPER ) != 0 ) {
8377- if (WindowManagerService .DEBUG_WALLPAPER ) Slog .v (TAG ,
8378- "First draw done in potential wallpaper target " + w );
8379- mInnerFields .mWallpaperMayChange = true ;
8380- mPendingLayoutChanges |= WindowManagerPolicy .FINISH_LAYOUT_REDO_WALLPAPER ;
8381- if (WindowManagerService .DEBUG_LAYOUT_REPEATS ) {
8382- debugLayoutRepeats ("updateWindowsAndWallpaperLocked 1" ,
8383- mPendingLayoutChanges );
8384- }
8385- }
8386- }
8387- }
8388- }
8389-
8390- if (DEBUG_ORIENTATION && mDisplayFrozen ) Slog .v (TAG ,
8391- "With display frozen, orientationChangeComplete="
8392- + mInnerFields .mOrientationChangeComplete );
8393- if (mInnerFields .mOrientationChangeComplete ) {
8394- if (mWindowsFreezingScreen ) {
8395- mWindowsFreezingScreen = false ;
8396- mH .removeMessages (H .WINDOW_FREEZE_TIMEOUT );
8397- }
8398- stopFreezingDisplayLocked ();
8399- }
8400-
84018392 if (!mResizingWindows .isEmpty ()) {
84028393 for (i = mResizingWindows .size () - 1 ; i >= 0 ; i --) {
84038394 WindowState win = mResizingWindows .get (i );
8404- final WindowStateAnimator winAnimator = win .mWinAnimator ;
8395+ final WindowStateAnimator winAnimator = win .mWinAnimator ;
84058396 try {
84068397 if (DEBUG_RESIZE || DEBUG_ORIENTATION ) Slog .v (TAG ,
84078398 "Reporting new frame to " + win + ": " + win .mCompatFrame );
@@ -8420,7 +8411,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
84208411 win .mConfiguration = mCurConfiguration ;
84218412 if (DEBUG_ORIENTATION &&
84228413 winAnimator .mDrawState == WindowStateAnimator .DRAW_PENDING ) Slog .i (
8423- TAG , "Resizing " + win + " WITH DRAW PENDING" );
8414+ TAG , "Resizing " + win + " WITH DRAW PENDING" );
84248415 win .mClient .resized ((int )winAnimator .mSurfaceW ,
84258416 (int )winAnimator .mSurfaceH ,
84268417 win .mLastContentInsets , win .mLastVisibleInsets ,
@@ -8436,6 +8427,17 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
84368427 mResizingWindows .clear ();
84378428 }
84388429
8430+ if (DEBUG_ORIENTATION && mDisplayFrozen ) Slog .v (TAG ,
8431+ "With display frozen, orientationChangeComplete="
8432+ + mInnerFields .mOrientationChangeComplete );
8433+ if (mInnerFields .mOrientationChangeComplete ) {
8434+ if (mWindowsFreezingScreen ) {
8435+ mWindowsFreezingScreen = false ;
8436+ mH .removeMessages (H .WINDOW_FREEZE_TIMEOUT );
8437+ }
8438+ stopFreezingDisplayLocked ();
8439+ }
8440+
84398441 // Destroy the surface of any windows that are no longer visible.
84408442 boolean wallpaperDestroyed = false ;
84418443 i = mDestroySurface .size ();
0 commit comments