Adding CTS test to prevent non-fullscreen activities from triggering PIP

Bug: 63581685
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testAppOpsDenyPipOnPause
Test: Launch screenshot from notification tray above auto-enter PiP
      activity

Change-Id: I8980bbf2f2021981e5f2c5a6e39981455e20d086
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerPinnedStackTests.java b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerPinnedStackTests.java
index 55b41c8..c6855f9 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerPinnedStackTests.java
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerPinnedStackTests.java
@@ -492,6 +492,16 @@
                 ALWAYS_FOCUSABLE_PIP_ACTIVITY)));
     }
 
+    public void testAutoEnterPictureInPictureNonFullscreenActivity() throws Exception {
+        if (!supportsPip()) return;
+
+        // Launch an auto-enter PIP activity, and a translucent activity on top. Ensure that the
+        // start of the translucent activity does not trigger the PIP activity to enter PIP.
+        launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP_ON_PAUSE, "true");
+        launchActivity(TRANSLUCENT_TEST_ACTIVITY);
+        assertPinnedStackDoesNotExist();
+    }
+
     public void testDisallowMultipleTasksInPinnedStack() throws Exception {
         if (!supportsPip()) return;