Do not create pinned stack task while entering PiP in test.

LaunchPipOnPipActivity explicitly creates a new task when the PiP
mode changes. This would okay in normal operations as it would land
in the focus stack, which the pinned stack cannot be. However, test
apis are used to specify the pinned stack. This leads to a race
condition where the PiP menu activity is trying to be launched at
the same time the AlwaysFocusablePipActivity is starting.

This CL resolves the issue by forcing AlwaysFocusablePipActivity into
the same task as LaunchPipOnPipActivity for non-tv devices, which
matches the behavior seen in production usage when launching an
activity into the PiP stack.

Change-Id: I438e736b8db194a53eb1c396632fa84fd07c73d7
Fixes: 64000839
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerActivityVisibilityTests#testTranslucentActivityOnTopOfPinnedStack
3 files changed