Loading core/java/android/view/SurfaceView.java +3 −14 Original line number Diff line number Diff line Loading @@ -404,15 +404,6 @@ public class SurfaceView extends View { } } private Rect getParentSurfaceInsets() { final ViewRootImpl root = getViewRootImpl(); if (root == null) { return null; } else { return root.mWindowAttributes.surfaceInsets; } } /** @hide */ protected void updateSurface() { if (!mHaveFrame) { Loading Loading @@ -468,9 +459,6 @@ public class SurfaceView extends View { mTranslator.translateRectInAppWindowToScreen(mScreenRect); } final Rect surfaceInsets = getParentSurfaceInsets(); mScreenRect.offset(surfaceInsets.left, surfaceInsets.top); if (creating) { mSurfaceSession = new SurfaceSession(viewRoot.mSurface); mSurfaceControl = new SurfaceControl(mSurfaceSession, Loading Loading @@ -627,7 +615,7 @@ public class SurfaceView extends View { } else { // Calculate the window position in case RT loses the window // and we need to fallback to a UI-thread driven position update getLocationInSurface(mLocation); getLocationInWindow(mLocation); final boolean positionChanged = mWindowSpaceLeft != mLocation[0] || mWindowSpaceTop != mLocation[1]; final boolean layoutSizeChanged = getWidth() != mScreenRect.width() Loading @@ -640,6 +628,8 @@ public class SurfaceView extends View { mLocation[0] = getWidth(); mLocation[1] = getHeight(); transformFromViewToWindowSpace(mLocation); mScreenRect.set(mWindowSpaceLeft, mWindowSpaceTop, mLocation[0], mLocation[1]); Loading Loading @@ -698,7 +688,6 @@ public class SurfaceView extends View { if (mSurfaceControl == null) { return; } // TODO: This is teensy bit racey in that a brand new SurfaceView moving on // its 2nd frame if RenderThread is running slowly could potentially see // this as false, enter the branch, get pre-empted, then this comes along Loading core/jni/android_view_RenderNode.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -452,6 +452,10 @@ static void android_view_RenderNode_requestPositionUpdates(JNIEnv* env, jobject, const RenderProperties& props = node.properties(); uirenderer::Rect bounds(props.getWidth(), props.getHeight()); transform.mapRect(bounds); bounds.left -= info.windowInsetLeft; bounds.right -= info.windowInsetLeft; bounds.top -= info.windowInsetTop; bounds.bottom -= info.windowInsetTop; if (CC_LIKELY(transform.isPureTranslate())) { // snap/round the computed bounds, so they match the rounding behavior Loading core/jni/android_view_ThreadedRenderer.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -178,9 +178,13 @@ public: } } // TODO: This is hacky info.windowInsetLeft = -stagingProperties().getLeft(); info.windowInsetTop = -stagingProperties().getTop(); info.updateWindowPositions = true; RenderNode::prepareTree(info); info.updateWindowPositions = false; info.windowInsetLeft = 0; info.windowInsetTop = 0; info.errorHandler = nullptr; } Loading libs/hwui/TreeInfo.h +2 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ public: LayerUpdateQueue* layerUpdateQueue = nullptr; ErrorHandler* errorHandler = nullptr; int32_t windowInsetLeft = 0; int32_t windowInsetTop = 0; bool updateWindowPositions = false; struct Out { Loading Loading
core/java/android/view/SurfaceView.java +3 −14 Original line number Diff line number Diff line Loading @@ -404,15 +404,6 @@ public class SurfaceView extends View { } } private Rect getParentSurfaceInsets() { final ViewRootImpl root = getViewRootImpl(); if (root == null) { return null; } else { return root.mWindowAttributes.surfaceInsets; } } /** @hide */ protected void updateSurface() { if (!mHaveFrame) { Loading Loading @@ -468,9 +459,6 @@ public class SurfaceView extends View { mTranslator.translateRectInAppWindowToScreen(mScreenRect); } final Rect surfaceInsets = getParentSurfaceInsets(); mScreenRect.offset(surfaceInsets.left, surfaceInsets.top); if (creating) { mSurfaceSession = new SurfaceSession(viewRoot.mSurface); mSurfaceControl = new SurfaceControl(mSurfaceSession, Loading Loading @@ -627,7 +615,7 @@ public class SurfaceView extends View { } else { // Calculate the window position in case RT loses the window // and we need to fallback to a UI-thread driven position update getLocationInSurface(mLocation); getLocationInWindow(mLocation); final boolean positionChanged = mWindowSpaceLeft != mLocation[0] || mWindowSpaceTop != mLocation[1]; final boolean layoutSizeChanged = getWidth() != mScreenRect.width() Loading @@ -640,6 +628,8 @@ public class SurfaceView extends View { mLocation[0] = getWidth(); mLocation[1] = getHeight(); transformFromViewToWindowSpace(mLocation); mScreenRect.set(mWindowSpaceLeft, mWindowSpaceTop, mLocation[0], mLocation[1]); Loading Loading @@ -698,7 +688,6 @@ public class SurfaceView extends View { if (mSurfaceControl == null) { return; } // TODO: This is teensy bit racey in that a brand new SurfaceView moving on // its 2nd frame if RenderThread is running slowly could potentially see // this as false, enter the branch, get pre-empted, then this comes along Loading
core/jni/android_view_RenderNode.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -452,6 +452,10 @@ static void android_view_RenderNode_requestPositionUpdates(JNIEnv* env, jobject, const RenderProperties& props = node.properties(); uirenderer::Rect bounds(props.getWidth(), props.getHeight()); transform.mapRect(bounds); bounds.left -= info.windowInsetLeft; bounds.right -= info.windowInsetLeft; bounds.top -= info.windowInsetTop; bounds.bottom -= info.windowInsetTop; if (CC_LIKELY(transform.isPureTranslate())) { // snap/round the computed bounds, so they match the rounding behavior Loading
core/jni/android_view_ThreadedRenderer.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -178,9 +178,13 @@ public: } } // TODO: This is hacky info.windowInsetLeft = -stagingProperties().getLeft(); info.windowInsetTop = -stagingProperties().getTop(); info.updateWindowPositions = true; RenderNode::prepareTree(info); info.updateWindowPositions = false; info.windowInsetLeft = 0; info.windowInsetTop = 0; info.errorHandler = nullptr; } Loading
libs/hwui/TreeInfo.h +2 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ public: LayerUpdateQueue* layerUpdateQueue = nullptr; ErrorHandler* errorHandler = nullptr; int32_t windowInsetLeft = 0; int32_t windowInsetTop = 0; bool updateWindowPositions = false; struct Out { Loading