Skip to content
Commit 25457d42 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Support PiP with fixed rotation

Add 2 cases with rotation change:
(a) Enter PiP from fullscreen.
    http://recall/-/d6GxE5mVL8Ww2IPnx7Nk0o/hDfmdrhrBFjJNOdi1s66OW
(b) Launch fullscreen app with the existing PiP.
    http://recall/-/d6GxE5mVL8Ww2IPnx7Nk0o/bUpHZ6Sh98zKZJnRM7oFy9

Steps of (a):
1. Task#setWindowingMode to PiP. If the next fullscreen activity
   will change display orientation, start fixed rotation on it.
   And start deferring orientation change.
2. PipTaskOrganizer#onFixedRotationStarted is called to mark it
   will be a special case.
3. PipTaskOrganizer#onTaskAppeared is called and starts the PiP
   rotation animation by animateResizePip with rotated destination
   bounds from rotated DisplayLayout.
4. When onPipAnimationEnd, use WCT#scheduleFinishEnterPip to notify
   that the animation is done, so the deferred orientation change
   can continue to update (PinnedTaskController#setEnterPipBounds).
   The end transaction of animation (reset matrix) is deferred
   until fixed rotation is finished. Also freeze the PiP task
   configuration one time, to avoid extra configuration change
   (letterboxed) by rotation change.
5. The seamless rotation starts, the PiP surface is transformed
   to previous rotation based on the bounds of previous step. So
   the PiP task can show the same orientation as rotated display.
   The frozen flag of PiP task configuration is cleared.
6. PipTaskOrganizer#onFixedRotationFinished is called. The final
   PiP destination bounds and the deferred transaction of step 4
   will be sent to WM.

Steps of (b):
1. Fixed rotation happens (PipTaskOrganizer#onFixedRotationStarted)
   when there is an existing PiP. Apply fade-out animation.
2. PipTaskOrganizer#onMovementBoundsChanged is called to update
   rotated destination bounds.
3. PipTaskOrganizer#onFixedRotationFinished is called to apply
   fade-in animation with new bounds.

Other changes:
- WCT#scheduleFinishEnterPip was used to set bounds and notify
  windowing mode change. That is already done by other config
  change oepration of WCT. So this redundant operation is changed
  to be a signal to notify that the PiP animation is done.
- Ignore calculating letterbox bounds for PiP activity because
  it should fill the task.
- Add PinnedTaskController#DEFER_ORIENTATION_CHANGE_TIMEOUT_MS
  to avoid using alpha animation after swiping from any task.
- Consider source rect hint with rotation.

Bug: 165794724
Bug: 175836469
Test: DisplayContentTests#testFixedRotationWithPip
      PipAnimationControllerTest#pipTransitionAnimator_rotatedEndValue

Change-Id: I2c26b5d93996193caaf020bd0e2314c8e1789545
parent 32a48b01
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment