Ensure that a PIP activity gets stopped before MW/PIP mode changes.

- Adds a workaround to ensure that onStop() is dispatched to the PIP
  activities when the PIP is dismissed
- Consolidating dismiss PIP behavior to call moveTaskToFullscreen().
  Now we are consistent, and when we expand the PIP, we call
  moveTaskToFullscreen(top), and when dismissing the PIP we call
  moveTaskToFullscreen(bottom)
- Fixing issue where we were dispatching extra MW/PIP mode changes when
  just expanding the PIP
- Fixing typo in last commit where PIP mode change was not getting
  scheduled correctly
- Fixing issue where move-to-fullscreen log was sent for each task

Bug: 36567036
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testStopBeforeMultiWindowCallbacksOnDismiss

Change-Id: I303b88d75e9f136da0c238ef5987804e0684c78e
Signed-off-by: Winson Chung <winsonc@google.com>
3 files changed