SurfaceView: Fix incorrect position changed check

Position changed check was incorrectly checking the position with
window insets against one without window insets. This would cause
unnecessary updates if the window had insets.

Test: presubmit
Fixes: 242246240

Change-Id: If3a3d57e8ae28e111bee57601ce7237adf1d6a1d
This commit is contained in:
Vishnu Nair
2022-08-15 15:34:42 +00:00
parent e2d779319a
commit 3c15df1d04

View File

@@ -908,7 +908,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
&& mRequestedVisible;
final boolean sizeChanged = mSurfaceWidth != myWidth || mSurfaceHeight != myHeight;
final boolean windowVisibleChanged = mWindowVisibility != mLastWindowVisibility;
getLocationInSurface(mLocation);
getLocationInWindow(mLocation);
final boolean positionChanged = mWindowSpaceLeft != mLocation[0]
|| mWindowSpaceTop != mLocation[1];
final boolean layoutSizeChanged = getWidth() != mScreenRect.width()
@@ -919,7 +919,6 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
if (creating || formatChanged || sizeChanged || visibleChanged ||
(mUseAlpha && alphaChanged) || windowVisibleChanged ||
positionChanged || layoutSizeChanged || hintChanged) {
getLocationInWindow(mLocation);
if (DEBUG) Log.i(TAG, System.identityHashCode(this) + " "
+ "Changes: creating=" + creating