From 3c15df1d04f0fda04ed387e5c44e70b61b9b7a6c Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Mon, 15 Aug 2022 15:34:42 +0000 Subject: [PATCH] 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 --- core/java/android/view/SurfaceView.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 8f9c5fe2b87fd..f3814867f3218 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -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