Merge "Make sure preserved surface is removed when it's no longer needed" into nyc-dev

This commit is contained in:
Chong Zhang
2016-05-10 17:53:25 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 5 deletions

View File

@@ -329,11 +329,14 @@ class AppWindowToken extends WindowToken {
final DisplayContentList displayList = new DisplayContentList();
for (int i = allWindows.size() - 1; i >= 0; i--) {
final WindowState win = allWindows.get(i);
if (!win.mDestroying) {
if (!(mAppStopped || win.mWindowRemovalAllowed)) {
continue;
}
if (!(mAppStopped || win.mWindowRemovalAllowed)) {
win.mWinAnimator.destroyPreservedSurfaceLocked();
if (!win.mDestroying) {
continue;
}

View File

@@ -659,6 +659,13 @@ class WindowStateAnimator {
mDestroyPreservedSurfaceUponRedraw = false;
}
void markPreservedSurfaceForDestroy() {
if (mDestroyPreservedSurfaceUponRedraw
&& !mService.mDestroyPreservedSurface.contains(mWin)) {
mService.mDestroyPreservedSurface.add(mWin);
}
}
WindowSurfaceController createSurfaceLocked() {
final WindowState w = mWin;
if (w.hasSavedSurface()) {
@@ -1518,9 +1525,7 @@ class WindowStateAnimator {
if (prepared && mLastHidden && mDrawState == HAS_DRAWN) {
if (showSurfaceRobustlyLocked()) {
if (mDestroyPreservedSurfaceUponRedraw) {
mService.mDestroyPreservedSurface.add(mWin);
}
markPreservedSurfaceForDestroy();
mAnimator.requestRemovalOfReplacedWindows(w);
mLastHidden = false;
if (mIsWallpaper) {