Fix ViewRoot inset adjustment after initial setup.

If the insets change, "mWidth/mHeight" won't change
as it's based on the window frame (not the surface size),
we need to track when the insets change and call
HardwareRenderer.setup with the new values.

Bug: 28257246
Bug: 28368990
Change-Id: Ida304b57c4671d010d1cf7b370674c9453841c97
This commit is contained in:
Robert Carr
2016-04-28 13:27:08 -07:00
parent fa255f6ead
commit 1bccabf3c4

View File

@@ -389,6 +389,8 @@ public final class ViewRootImpl implements ViewParent,
/** Set to true once doDie() has been called. */
private boolean mRemoved;
private boolean mNeedsHwRendererSetup;
/**
* Consistency verifier for debugging purposes.
*/
@@ -915,6 +917,11 @@ public final class ViewRootImpl implements ViewParent,
mWindowAttributes.surfaceInsets.set(
oldInsetLeft, oldInsetTop, oldInsetRight, oldInsetBottom);
mWindowAttributes.hasManualSurfaceInsets = oldHasManualSurfaceInsets;
} else if (mWindowAttributes.surfaceInsets.left != oldInsetLeft
|| mWindowAttributes.surfaceInsets.top != oldInsetTop
|| mWindowAttributes.surfaceInsets.right != oldInsetRight
|| mWindowAttributes.surfaceInsets.bottom != oldInsetBottom) {
mNeedsHwRendererSetup = true;
}
applyKeepScreenOnFlag(mWindowAttributes);
@@ -1959,9 +1966,11 @@ public final class ViewRootImpl implements ViewParent,
if (hardwareRenderer != null && hardwareRenderer.isEnabled()) {
if (hwInitialized
|| mWidth != hardwareRenderer.getWidth()
|| mHeight != hardwareRenderer.getHeight()) {
|| mHeight != hardwareRenderer.getHeight()
|| mNeedsHwRendererSetup) {
hardwareRenderer.setup(mWidth, mHeight, mAttachInfo,
mWindowAttributes.surfaceInsets);
mNeedsHwRendererSetup = false;
}
}