Fix PiP Shell Transitions

PiP Shell Transitions needs to be more robust to pass CTS tests
reliably.

Some changes:

1. DELIVERED_TO_TOP intents don't create a transition since there is
   no change to the WM hierarchy. This way the app-launch transition
   won't conflict with activityRestartAttempt.

2. If PiP started an expand transition while an enter transition is
   ongoing, cancel the enter transition.
   a. Additionally, because PiP doesn't resize task until the enter
      transition finishes, the expand transition will actually be
      a no-op. If we see this pattern, also cancel the enter
      transition.

3. When taskVanished, make sure to call any pending finishCallback
   because it doesn't allow the running animator to properly finish.
   Transition systems require the finish callback to function
   properly.

4. Minimize the uses of finishTransition with a sync callback. We
   probably need to phase this out because it can conflict with
   subsequent startTransition calls (because only 1 sync is supported
   at a time).

Bug: 183993924
Test: atest PinnedStackTests
Change-Id: Ieb573032839a2f31b0bb371410484fc93a1714fa
6 files changed