Revert "Revert "Check windowing mode in SplashscreenTests#testSplashscreenContent""

This reverts commit bc9725d8107114fed7b5511c9634778f6c2908ac.

Reason for revert: The original change was made by Microsoft
(https://android-review.googlesource.com/c/platform/cts/+/1466332/
The change was cherry picked in by Samsung.

The splashScreenContent is not supposed to be full screen so we
shouldn't check for color equality outside the app bounds.
Using the task bounds will also take the system bar in account.

For the Surface Duo, the meaning of fullscreen is different because
if an app is in full screen on only one screen,
the app is considered fullscreen.

Since this fix accounts for more cases, I prefer to have this one
merged and do another fix for dual screen device where we check
for the Window's logical display width when checking the screenshot

Bug: 198426328
Bug: 171233754
Bug: 188754214

Change-Id: I785ab0b0b9f3a850caf6a4af6975e0223345534b
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java b/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
index e87cf2c..1de257b 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
@@ -34,6 +34,8 @@
 import org.junit.Before;
 import org.junit.Test;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+
 /**
  * Build/Install/Run:
  *     atest CtsWindowManagerDeviceTestCases:SplashscreenTests
@@ -58,12 +60,17 @@
         // Activity may not be launched yet even if app transition is in idle state.
         mWmState.waitForActivityState(SPLASHSCREEN_ACTIVITY, STATE_RESUMED);
         mWmState.waitForAppTransitionIdleOnDisplay(DEFAULT_DISPLAY);
-        final WindowManagerState.ActivityTask task =
-                mWmState.getTaskByActivity(SPLASHSCREEN_ACTIVITY);
+        mWmState.getStableBounds();
         final Bitmap image = takeScreenshot();
+        int windowingMode = mWmState.getFocusedStackWindowingMode();
+        Rect appBounds = new Rect();
+        appBounds.set(windowingMode == WINDOWING_MODE_FULLSCREEN ?
+                mWmState.getStableBounds() :
+                mWmState.findFirstWindowWithType(
+                        WindowManager.LayoutParams.TYPE_APPLICATION_STARTING).getContentFrame());
         // Use ratios to flexibly accomodate circular or not quite rectangular displays
         // Note: Color.BLACK is the pixel color outside of the display region
-        assertColors(image, task.mBounds, Color.RED, 0.50f, Color.BLACK, 0.02f);
+        assertColors(image, appBounds, Color.RED, 0.50f, Color.BLACK, 0.02f);
     }
 
     private void assertColors(Bitmap img, Rect bounds, int primaryColor,
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
index 957b80f..91e3359 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
@@ -1521,7 +1521,7 @@
     public static class WindowState extends WindowContainer {
 
         private static final int WINDOW_TYPE_NORMAL = 0;
-        private static final int WINDOW_TYPE_STARTING = 1;
+        public static final int WINDOW_TYPE_STARTING = 1;
         private static final int WINDOW_TYPE_EXITING = 2;
         private static final int WINDOW_TYPE_DEBUGGER = 3;