Adding ability for an app to request auto-enter picture-in-picture.

- If an activity requests that it can auto-enter PIP, then we will trigger
  it to enter PIP when the task is effectively being occluded.  This does
  not affect the activity when the screen is locking, or if it starts new
  activities within its own task, or if it finishes itself, or if there is
  already a PIP activity.
- Changed setPictureInPictureAspectRatio to also specify the aspect ratio
  to use when auto-entering PIP.  If the activity is not PIP'ed and has
  not requested auto-enter, then the call continues to fail.

Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testAutoEnterPictureInPicture
Test: #testAutoEnterPictureInPictureLaunchActivity
Test: #testAutoEnterPictureInPictureFinish
Test: #testAutoEnterPictureInPictureAspectRatio
Test: #testAutoEnterPictureInPictureOverPip

Change-Id: I6477b6d1f160cf0219d935123bbb505f57ee7a56
diff --git a/services/core/java/com/android/server/wm/PinnedStackController.java b/services/core/java/com/android/server/wm/PinnedStackController.java
index 01a50b7..0ad4e0a 100644
--- a/services/core/java/com/android/server/wm/PinnedStackController.java
+++ b/services/core/java/com/android/server/wm/PinnedStackController.java
@@ -135,7 +135,7 @@
         mService = service;
         mDisplayContent = displayContent;
         mSnapAlgorithm = new PipSnapAlgorithm(service.mContext);
-        mMotionHelper = new PipMotionHelper(BackgroundThread.getHandler());
+        mMotionHelper = new PipMotionHelper(UiThread.getHandler());
         mDisplayInfo.copyFrom(mDisplayContent.getDisplayInfo());
         reloadResources();
     }