Reset transparent region when saving a surface

Fixes: 28432088

Ensure a transparent region on a saved surface is reset for future use,
since the surface should be like-new if used again.

This prevents an issue where the region - used to signal a portion of
content doesn't need to be composited - is persisted when a saved
surface is reused. The client assumes it's new and in default
state (composite everything), but the window is clipped when composited.

Change-Id: Icf2ec94c735679d715aded58de7eab12e9c43367
This commit is contained in:
Chris Craik
2016-05-06 13:39:08 -07:00
parent 08ca2e3a75
commit 3131bdec70

View File

@@ -1986,12 +1986,17 @@ final class WindowState implements WindowManagerPolicy.WindowState {
return mAppToken.shouldSaveSurface();
}
static final Region sEmptyRegion = new Region();
void destroyOrSaveSurface() {
mSurfaceSaved = shouldSaveSurface();
if (mSurfaceSaved) {
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
Slog.v(TAG, "Saving surface: " + this);
}
// Previous user of the surface may have set a transparent region signaling a portion
// doesn't need to be composited, so reset to default empty state.
mSession.setTransparentRegion(mClient, sEmptyRegion);
mWinAnimator.hide("saved surface");
mWinAnimator.mDrawState = WindowStateAnimator.NO_SURFACE;