Only restore saved surfaces in the last visible rotation.
am: 237028ae3b
Change-Id: I9963cfb9b515b1ceabdb39a64027bb227e191643
This commit is contained in:
@@ -3081,6 +3081,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
if (oldVisibility == View.GONE) {
|
if (oldVisibility == View.GONE) {
|
||||||
winAnimator.mEnterAnimationPending = true;
|
winAnimator.mEnterAnimationPending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
win.mLastVisibleLayoutRotation = mRotation;
|
||||||
|
|
||||||
winAnimator.mEnteringAnimation = true;
|
winAnimator.mEnteringAnimation = true;
|
||||||
if ((result & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) {
|
if ((result & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) {
|
||||||
win.prepareWindowToDisplayDuringRelayout(outConfig);
|
win.prepareWindowToDisplayDuringRelayout(outConfig);
|
||||||
|
|||||||
@@ -394,6 +394,13 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
*/
|
*/
|
||||||
boolean mOrientationChanging;
|
boolean mOrientationChanging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The orientation during the last visible call to relayout. If our
|
||||||
|
* current orientation is different, the window can't be ready
|
||||||
|
* to be shown.
|
||||||
|
*/
|
||||||
|
int mLastVisibleLayoutRotation = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How long we last kept the screen frozen.
|
* How long we last kept the screen frozen.
|
||||||
*/
|
*/
|
||||||
@@ -2095,6 +2102,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
Slog.v(TAG, "Destroying saved surface: " + this);
|
Slog.v(TAG, "Destroying saved surface: " + this);
|
||||||
}
|
}
|
||||||
mWinAnimator.destroySurfaceLocked();
|
mWinAnimator.destroySurfaceLocked();
|
||||||
|
mSurfaceSaved = false;
|
||||||
}
|
}
|
||||||
mWasVisibleBeforeClientHidden = false;
|
mWasVisibleBeforeClientHidden = false;
|
||||||
}
|
}
|
||||||
@@ -2103,7 +2111,18 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
|||||||
if (!mSurfaceSaved) {
|
if (!mSurfaceSaved) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sometimes we save surfaces due to layout invisible
|
||||||
|
// directly after rotation occurs. However this means
|
||||||
|
// the surface was never laid out in the new orientation.
|
||||||
|
// We can only restore to the last rotation we were
|
||||||
|
// laid out as visible in.
|
||||||
|
if (mLastVisibleLayoutRotation != mService.mRotation) {
|
||||||
|
destroySavedSurface();
|
||||||
|
return;
|
||||||
|
}
|
||||||
mSurfaceSaved = false;
|
mSurfaceSaved = false;
|
||||||
|
|
||||||
if (mWinAnimator.mSurfaceController != null) {
|
if (mWinAnimator.mSurfaceController != null) {
|
||||||
setHasSurface(true);
|
setHasSurface(true);
|
||||||
mWinAnimator.mDrawState = WindowStateAnimator.READY_TO_SHOW;
|
mWinAnimator.mDrawState = WindowStateAnimator.READY_TO_SHOW;
|
||||||
|
|||||||
Reference in New Issue
Block a user