Merge "Fix PipRotation tests"
diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt
index f0c96ac..edfa63a 100644
--- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt
+++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/EnterPipTest.kt
@@ -16,6 +16,7 @@
 
 package com.android.wm.shell.flicker.pip
 
+import android.platform.test.annotations.FlakyTest
 import android.platform.test.annotations.Presubmit
 import android.view.Surface
 import androidx.test.filters.RequiresDevice
@@ -88,7 +89,7 @@
     /**
      * Checks [pipApp] layer remains visible throughout the animation
      */
-    @Presubmit
+    @FlakyTest
     @Test
     open fun pipAppLayerAlwaysVisible() {
         testSpec.assertLayers {
diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipRotationTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipRotationTest.kt
index af34f5e..2abe6d5 100644
--- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipRotationTest.kt
+++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipRotationTest.kt
@@ -106,9 +106,9 @@
      */
     @Presubmit
     @Test
-    fun appLayerRotates_StartingBounds() {
+    fun fixedAppLayer_StartingBounds() {
         testSpec.assertLayersStart {
-            visibleRegion(fixedApp).coversExactly(screenBoundsStart)
+            visibleRegion(fixedApp).coversAtMost(screenBoundsStart)
         }
     }
 
@@ -117,9 +117,33 @@
      */
     @Presubmit
     @Test
-    fun appLayerRotates_EndingBounds() {
+    fun fixedAppLayer_EndingBounds() {
         testSpec.assertLayersEnd {
-            visibleRegion(fixedApp).coversExactly(screenBoundsEnd)
+            visibleRegion(fixedApp).coversAtMost(screenBoundsEnd)
+        }
+    }
+
+    /**
+     * Checks that [fixedApp] plus [pipApp] layers are within [screenBoundsEnd] at the start
+     * of the transition
+     */
+    @Presubmit
+    @Test
+    fun appLayers_StartingBounds() {
+        testSpec.assertLayersStart {
+            visibleRegion(fixedApp.or(pipApp)).coversExactly(screenBoundsStart)
+        }
+    }
+
+    /**
+     * Checks that [fixedApp] plus [pipApp] layers are within [screenBoundsEnd] at the end
+     * of the transition
+     */
+    @Presubmit
+    @Test
+    fun appLayers_EndingBounds() {
+        testSpec.assertLayersEnd {
+            visibleRegion(fixedApp.or(pipApp)).coversExactly(screenBoundsEnd)
         }
     }