@@ -3973,6 +3973,7 @@ void unsetAppFreezingScreenLocked(AppWindowToken wtoken,
39733973 if (w .mAppFreezing ) {
39743974 w .mAppFreezing = false ;
39753975 if (w .mSurface != null && !w .mOrientationChanging ) {
3976+ if (DEBUG_ORIENTATION ) Slog .v (TAG , "set mOrientationChanging of " + w );
39763977 w .mOrientationChanging = true ;
39773978 }
39783979 unfrozeWindows = true ;
@@ -5106,7 +5107,7 @@ public Bitmap screenshotApplications(IBinder appToken, int width, int height) {
51065107 }
51075108
51085109 if (rawss == null ) {
5109- Log .w (TAG , "Failure taking screenshot for (" + dw + "x" + dh
5110+ Slog .w (TAG , "Failure taking screenshot for (" + dw + "x" + dh
51105111 + ") to layer " + maxLayer );
51115112 return null ;
51125113 }
@@ -5312,6 +5313,7 @@ public boolean updateRotationUncheckedLocked(boolean inTransaction) {
53125313 for (int i =mWindows .size ()-1 ; i >=0 ; i --) {
53135314 WindowState w = mWindows .get (i );
53145315 if (w .mSurface != null ) {
5316+ if (DEBUG_ORIENTATION ) Slog .v (TAG , "Set mOrientationChanging of " + w );
53155317 w .mOrientationChanging = true ;
53165318 }
53175319 }
@@ -7128,7 +7130,7 @@ private final void assignLayersLocked() {
71287130 if (DEBUG_LAYERS ) {
71297131 RuntimeException here = new RuntimeException ("here" );
71307132 here .fillInStackTrace ();
7131- Log .v (TAG , "Assigning layers" , here );
7133+ Slog .v (TAG , "Assigning layers" , here );
71327134 }
71337135
71347136 for (i =0 ; i <N ; i ++) {
@@ -7367,6 +7369,25 @@ private final int performLayoutLockedInner(boolean initial, boolean updateInputW
73677369 return mPolicy .finishLayoutLw ();
73687370 }
73697371
7372+ void makeWindowFreezingScreenIfNeededLocked (WindowState w ) {
7373+ // If the screen is currently frozen or off, then keep
7374+ // it frozen/off until this window draws at its new
7375+ // orientation.
7376+ if (mDisplayFrozen || !mPolicy .isScreenOnFully ()) {
7377+ if (DEBUG_ORIENTATION ) Slog .v (TAG ,
7378+ "Changing surface while display frozen: " + w );
7379+ w .mOrientationChanging = true ;
7380+ if (!mWindowsFreezingScreen ) {
7381+ mWindowsFreezingScreen = true ;
7382+ // XXX should probably keep timeout from
7383+ // when we first froze the display.
7384+ mH .removeMessages (H .WINDOW_FREEZE_TIMEOUT );
7385+ mH .sendMessageDelayed (mH .obtainMessage (
7386+ H .WINDOW_FREEZE_TIMEOUT ), 2000 );
7387+ }
7388+ }
7389+ }
7390+
73707391 // "Something has changed! Let's make it correct now."
73717392 private final void performLayoutAndPlaceSurfacesLockedInner (
73727393 boolean recoveringMemory ) {
@@ -7718,6 +7739,10 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
77187739 + " drawn=" + wtoken .numDrawnWindows );
77197740 wtoken .showAllWindowsLocked ();
77207741 unsetAppFreezingScreenLocked (wtoken , false , true );
7742+ if (DEBUG_ORIENTATION ) Slog .i (TAG ,
7743+ "Setting orientationChangeComplete=true because wtoken "
7744+ + wtoken + " numInteresting=" + numInteresting
7745+ + " numDrawn=" + wtoken .numDrawnWindows );
77217746 orientationChangeComplete = true ;
77227747 }
77237748 } else if (!wtoken .allDrawn ) {
@@ -8225,22 +8250,7 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
82258250
82268251 w .mLastContentInsets .set (w .mContentInsets );
82278252 w .mLastVisibleInsets .set (w .mVisibleInsets );
8228- // If the screen is currently frozen or off, then keep
8229- // it frozen/off until this window draws at its new
8230- // orientation.
8231- if (mDisplayFrozen || !mPolicy .isScreenOnFully ()) {
8232- if (DEBUG_ORIENTATION ) Slog .v (TAG ,
8233- "Resizing while display frozen: " + w );
8234- w .mOrientationChanging = true ;
8235- if (!mWindowsFreezingScreen ) {
8236- mWindowsFreezingScreen = true ;
8237- // XXX should probably keep timeout from
8238- // when we first froze the display.
8239- mH .removeMessages (H .WINDOW_FREEZE_TIMEOUT );
8240- mH .sendMessageDelayed (mH .obtainMessage (
8241- H .WINDOW_FREEZE_TIMEOUT ), 2000 );
8242- }
8243- }
8253+ makeWindowFreezingScreenIfNeededLocked (w );
82448254 // If the orientation is changing, then we need to
82458255 // hold off on unfreezing the display until this
82468256 // window has been redrawn; to do that, we need
@@ -8563,6 +8573,8 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
85638573 + Integer .toHexString (diff ));
85648574 }
85658575 win .mConfiguration = mCurConfiguration ;
8576+ if (DEBUG_ORIENTATION && win .mDrawPending ) Slog .i (
8577+ TAG , "Resizing " + win + " WITH DRAW PENDING" );
85668578 win .mClient .resized ((int )win .mSurfaceW , (int )win .mSurfaceH ,
85678579 win .mLastContentInsets , win .mLastVisibleInsets , win .mDrawPending ,
85688580 configChanged ? win .mConfiguration : null );
@@ -9087,6 +9099,7 @@ private void stopFreezingDisplayLocked() {
90879099
90889100 if (CUSTOM_SCREEN_ROTATION && mScreenRotationAnimation != null
90899101 && mScreenRotationAnimation .hasScreenshot ()) {
9102+ if (DEBUG_ORIENTATION ) Slog .i (TAG , "**** Dismissing screen rotation animation" );
90909103 if (mScreenRotationAnimation .dismiss (mFxSession , MAX_ANIMATION_DURATION ,
90919104 mTransitionAnimationScale , mCurDisplayWidth , mCurDisplayHeight )) {
90929105 requestAnimationLocked (0 );
0 commit comments