Specify the boundsToCheck to correspond to the testing content area only.

Prior to this change, boundsToCheck corresponded to the entire display
screen. However, even though we enter full-screen mode for this test,
based on configruation, some SystemUI components like NavigationBar or
StatusBar may be included in the boundsToCheck, which results in false
test failures in SurfaceViewSyncTest. BoundsToCheck should only include
the area that is relevant to the test.

Bug: 146536203
Test: SurfaceViewSyncTest now passing even when some SystemUI components
are shown on the screen.

Change-Id: I0f9e70d5ae3b1587420de2b33da17b269e60613d
Merged-In: I0f9e70d5ae3b1587420de2b33da17b269e60613d
diff --git a/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java b/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
index f1838e2..641d6c9 100644
--- a/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
+++ b/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
@@ -212,9 +212,9 @@
             display.getRealSize(size);
             display.getMetrics(metrics);
 
-            View decorView = getWindow().getDecorView();
-            Rect boundsToCheck = new Rect(0, 0, decorView.getWidth(), decorView.getHeight());
-            int[] topLeft = decorView.getLocationOnScreen();
+            View testAreaView = findViewById(android.R.id.content);
+            Rect boundsToCheck = new Rect(0, 0, testAreaView.getWidth(), testAreaView.getHeight());
+            int[] topLeft = testAreaView.getLocationOnScreen();
             boundsToCheck.offset(topLeft[0], topLeft[1]);
 
             if (boundsToCheck.width() < 90 || boundsToCheck.height() < 90) {