@@ -3969,6 +3969,7 @@ void unsetAppFreezingScreenLocked(AppWindowToken wtoken,
39693969 if (w .mAppFreezing ) {
39703970 w .mAppFreezing = false ;
39713971 if (w .mSurface != null && !w .mOrientationChanging ) {
3972+ if (DEBUG_ORIENTATION ) Slog .v (TAG , "set mOrientationChanging of " + w );
39723973 w .mOrientationChanging = true ;
39733974 }
39743975 unfrozeWindows = true ;
@@ -5102,7 +5103,7 @@ public Bitmap screenshotApplications(IBinder appToken, int width, int height) {
51025103 }
51035104
51045105 if (rawss == null ) {
5105- Log .w (TAG , "Failure taking screenshot for (" + dw + "x" + dh
5106+ Slog .w (TAG , "Failure taking screenshot for (" + dw + "x" + dh
51065107 + ") to layer " + maxLayer );
51075108 return null ;
51085109 }
@@ -5308,6 +5309,7 @@ public boolean updateRotationUncheckedLocked(boolean inTransaction) {
53085309 for (int i =mWindows .size ()-1 ; i >=0 ; i --) {
53095310 WindowState w = mWindows .get (i );
53105311 if (w .mSurface != null ) {
5312+ if (DEBUG_ORIENTATION ) Slog .v (TAG , "Set mOrientationChanging of " + w );
53115313 w .mOrientationChanging = true ;
53125314 }
53135315 }
@@ -7124,7 +7126,7 @@ private final void assignLayersLocked() {
71247126 if (DEBUG_LAYERS ) {
71257127 RuntimeException here = new RuntimeException ("here" );
71267128 here .fillInStackTrace ();
7127- Log .v (TAG , "Assigning layers" , here );
7129+ Slog .v (TAG , "Assigning layers" , here );
71287130 }
71297131
71307132 for (i =0 ; i <N ; i ++) {
@@ -7363,6 +7365,25 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
73637365 return mPolicy .finishLayoutLw ();
73647366 }
73657367
7368+ void makeWindowFreezingScreenIfNeededLocked (WindowState w ) {
7369+ // If the screen is currently frozen or off, then keep
7370+ // it frozen/off until this window draws at its new
7371+ // orientation.
7372+ if (mDisplayFrozen || !mPolicy .isScreenOnFully ()) {
7373+ if (DEBUG_ORIENTATION ) Slog .v (TAG ,
7374+ "Changing surface while display frozen: " + w );
7375+ w .mOrientationChanging = true ;
7376+ if (!mWindowsFreezingScreen ) {
7377+ mWindowsFreezingScreen = true ;
7378+ // XXX should probably keep timeout from
7379+ // when we first froze the display.
7380+ mH .removeMessages (H .WINDOW_FREEZE_TIMEOUT );
7381+ mH .sendMessageDelayed (mH .obtainMessage (
7382+ H .WINDOW_FREEZE_TIMEOUT ), 2000 );
7383+ }
7384+ }
7385+ }
7386+
73667387 // "Something has changed! Let's make it correct now."
73677388 private final void performLayoutAndPlaceSurfacesLockedInner (
73687389 boolean recoveringMemory ) {
@@ -7714,6 +7735,10 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
77147735 + " drawn=" + wtoken .numDrawnWindows );
77157736 wtoken .showAllWindowsLocked ();
77167737 unsetAppFreezingScreenLocked (wtoken , false , true );
7738+ if (DEBUG_ORIENTATION ) Slog .i (TAG ,
7739+ "Setting orientationChangeComplete=true because wtoken "
7740+ + wtoken + " numInteresting=" + numInteresting
7741+ + " numDrawn=" + wtoken .numDrawnWindows );
77177742 orientationChangeComplete = true ;
77187743 }
77197744 } else if (!wtoken .allDrawn ) {
@@ -8221,22 +8246,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
82218246
82228247 w .mLastContentInsets .set (w .mContentInsets );
82238248 w .mLastVisibleInsets .set (w .mVisibleInsets );
8224- // If the screen is currently frozen or off, then keep
8225- // it frozen/off until this window draws at its new
8226- // orientation.
8227- if (mDisplayFrozen || !mPolicy .isScreenOnFully ()) {
8228- if (DEBUG_ORIENTATION ) Slog .v (TAG ,
8229- "Resizing while display frozen: " + w );
8230- w .mOrientationChanging = true ;
8231- if (!mWindowsFreezingScreen ) {
8232- mWindowsFreezingScreen = true ;
8233- // XXX should probably keep timeout from
8234- // when we first froze the display.
8235- mH .removeMessages (H .WINDOW_FREEZE_TIMEOUT );
8236- mH .sendMessageDelayed (mH .obtainMessage (
8237- H .WINDOW_FREEZE_TIMEOUT ), 2000 );
8238- }
8239- }
8249+ makeWindowFreezingScreenIfNeededLocked (w );
82408250 // If the orientation is changing, then we need to
82418251 // hold off on unfreezing the display until this
82428252 // window has been redrawn; to do that, we need
@@ -8559,6 +8569,8 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
85598569 + Integer .toHexString (diff ));
85608570 }
85618571 win .mConfiguration = mCurConfiguration ;
8572+ if (DEBUG_ORIENTATION && win .mDrawPending ) Slog .i (
8573+ TAG , "Resizing " + win + " WITH DRAW PENDING" );
85628574 win .mClient .resized ((int )win .mSurfaceW , (int )win .mSurfaceH ,
85638575 win .mLastContentInsets , win .mLastVisibleInsets , win .mDrawPending ,
85648576 configChanged ? win .mConfiguration : null );
@@ -9083,6 +9095,7 @@ private void stopFreezingDisplayLocked() {
90839095
90849096 if (CUSTOM_SCREEN_ROTATION && mScreenRotationAnimation != null
90859097 && mScreenRotationAnimation .hasScreenshot ()) {
9098+ if (DEBUG_ORIENTATION ) Slog .i (TAG , "**** Dismissing screen rotation animation" );
90869099 if (mScreenRotationAnimation .dismiss (mFxSession , MAX_ANIMATION_DURATION ,
90879100 mTransitionAnimationScale , mCurDisplayWidth , mCurDisplayHeight )) {
90889101 requestAnimationLocked (0 );
0 commit comments