Use boundsOnScreen to offset the translate

ScreenRect is position in current window. However, it results in the
incorrect bounds if the window isn't from (0, 0). We need to update
it with bounds on screen instead.

Bug: 149539748
Test: a11y CTS & unit tests
Change-Id: I3cb07656a2c87e5f4fd1cba78463b1135c959bd4
This commit is contained in:
Jackal Guo
2020-02-14 15:38:39 +08:00
parent 8a48bc0b1f
commit ef364c5a55

View File

@@ -1643,8 +1643,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
}
private void updateScreenMatrixForEmbeddedHierarchy() {
getBoundsOnScreen(mTmpRect, true);
mTmpMatrix.reset();
mTmpMatrix.setTranslate(mScreenRect.left, mScreenRect.top);
mTmpMatrix.setTranslate(mTmpRect.left, mTmpRect.top);
mTmpMatrix.postScale(mScreenRect.width() / (float) mSurfaceWidth,
mScreenRect.height() / (float) mSurfaceHeight);