Replace getLocationOnScreen with getLocationInWindow
We called new SynchronousPixelCopy().request(window, pos) while
the position was the location on the screen. This CL fix this.
Bug: 160032230
Test: atest android.view.cts.TextureViewTest
Change-Id: I89d391234789c4d20b1788bbbfd3cc10b93b4900
diff --git a/tests/tests/view/src/android/view/cts/TextureViewTest.java b/tests/tests/view/src/android/view/cts/TextureViewTest.java
index 9cab157..8736f36 100644
--- a/tests/tests/view/src/android/view/cts/TextureViewTest.java
+++ b/tests/tests/view/src/android/view/cts/TextureViewTest.java
@@ -81,7 +81,7 @@
mActivityRule.runOnUiThread(() -> {
View content = activity.findViewById(android.R.id.content);
int[] outLocation = new int[2];
- content.getLocationOnScreen(outLocation);
+ content.getLocationInWindow(outLocation);
center.x = outLocation[0] + (content.getWidth() / 2);
center.y = outLocation[1] + (content.getHeight() / 2);
windowRet[0] = activity.getWindow();
@@ -145,7 +145,7 @@
final Rect viewPos = new Rect();
mActivityRule.runOnUiThread(() -> {
int[] outLocation = new int[2];
- textureView.getLocationOnScreen(outLocation);
+ textureView.getLocationInWindow(outLocation);
viewPos.left = outLocation[0];
viewPos.top = outLocation[1];
viewPos.right = viewPos.left + textureView.getWidth();
@@ -187,7 +187,7 @@
final Rect viewPos = new Rect();
mActivityRule.runOnUiThread(() -> {
int[] outLocation = new int[2];
- textureView.getLocationOnScreen(outLocation);
+ textureView.getLocationInWindow(outLocation);
viewPos.left = outLocation[0];
viewPos.top = outLocation[1];
viewPos.right = viewPos.left + textureView.getWidth();
@@ -343,7 +343,7 @@
final Rect viewPos = new Rect();
mActivityRule.runOnUiThread(() -> {
int[] outLocation = new int[2];
- textureView.getLocationOnScreen(outLocation);
+ textureView.getLocationInWindow(outLocation);
viewPos.left = outLocation[0];
viewPos.top = outLocation[1];
viewPos.right = viewPos.left + textureView.getWidth();