Make sure preserved surface is removed when it's no longer needed
Preserved surface might be used for format change as well as surface size change outside a drag resizing. We currently remove the preserved surface in prepareSurfaceLocked() after the window is shown, but sometimes app gets stopped before any animation pass is run. bug: 28546172 Change-Id: I7f883f4b5c6da4dce70f94173b368a912056d062
This commit is contained in:
@@ -329,11 +329,14 @@ class AppWindowToken extends WindowToken {
|
|||||||
final DisplayContentList displayList = new DisplayContentList();
|
final DisplayContentList displayList = new DisplayContentList();
|
||||||
for (int i = allWindows.size() - 1; i >= 0; i--) {
|
for (int i = allWindows.size() - 1; i >= 0; i--) {
|
||||||
final WindowState win = allWindows.get(i);
|
final WindowState win = allWindows.get(i);
|
||||||
if (!win.mDestroying) {
|
|
||||||
|
if (!(mAppStopped || win.mWindowRemovalAllowed)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mAppStopped || win.mWindowRemovalAllowed)) {
|
win.mWinAnimator.destroyPreservedSurfaceLocked();
|
||||||
|
|
||||||
|
if (!win.mDestroying) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -659,6 +659,13 @@ class WindowStateAnimator {
|
|||||||
mDestroyPreservedSurfaceUponRedraw = false;
|
mDestroyPreservedSurfaceUponRedraw = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void markPreservedSurfaceForDestroy() {
|
||||||
|
if (mDestroyPreservedSurfaceUponRedraw
|
||||||
|
&& !mService.mDestroyPreservedSurface.contains(mWin)) {
|
||||||
|
mService.mDestroyPreservedSurface.add(mWin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WindowSurfaceController createSurfaceLocked() {
|
WindowSurfaceController createSurfaceLocked() {
|
||||||
final WindowState w = mWin;
|
final WindowState w = mWin;
|
||||||
if (w.hasSavedSurface()) {
|
if (w.hasSavedSurface()) {
|
||||||
@@ -1518,9 +1525,7 @@ class WindowStateAnimator {
|
|||||||
|
|
||||||
if (prepared && mLastHidden && mDrawState == HAS_DRAWN) {
|
if (prepared && mLastHidden && mDrawState == HAS_DRAWN) {
|
||||||
if (showSurfaceRobustlyLocked()) {
|
if (showSurfaceRobustlyLocked()) {
|
||||||
if (mDestroyPreservedSurfaceUponRedraw) {
|
markPreservedSurfaceForDestroy();
|
||||||
mService.mDestroyPreservedSurface.add(mWin);
|
|
||||||
}
|
|
||||||
mAnimator.requestRemovalOfReplacedWindows(w);
|
mAnimator.requestRemovalOfReplacedWindows(w);
|
||||||
mLastHidden = false;
|
mLastHidden = false;
|
||||||
if (mIsWallpaper) {
|
if (mIsWallpaper) {
|
||||||
|
|||||||
Reference in New Issue
Block a user