Fix NPE when entering PIP from different orientation

1. handleRequest for TRANSIT_PIP will happen before the Task appeared,
so setting ENTRY_SCHEDULED in handleRequest will cause the rotation to
access the leash before Task appeared, which causes NPE.
2. We don't want to do fixed rotation launch in Core when Shell
transition is enabled. Otherwise it will stuck at waiting for continue
rotation.

TODO: handle PIP to Fullscreen rotation in Shell transition

Bug: 210965919
Test: manual test entering PIP from different orientation without NPE
Change-Id: Ie5e61a5cf05eff7a0c1adb731d5f3d8677e0f091
This commit is contained in:
Chris Li
2021-12-27 13:37:17 +08:00
parent 3e80334893
commit b9c1bc336c
2 changed files with 3 additions and 1 deletions

View File

@@ -219,7 +219,6 @@ public class PipTransition extends PipTransitionController {
@NonNull TransitionRequestInfo request) {
if (request.getType() == TRANSIT_PIP) {
WindowContainerTransaction wct = new WindowContainerTransaction();
mPipTransitionState.setTransitionState(PipTransitionState.ENTRY_SCHEDULED);
if (mOneShotAnimationType == ANIM_TYPE_ALPHA) {
wct.setActivityWindowingMode(request.getTriggerTask().token,
WINDOWING_MODE_UNDEFINED);

View File

@@ -1598,6 +1598,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
*/
@Rotation
int rotationForActivityInDifferentOrientation(@NonNull ActivityRecord r) {
if (mTransitionController.isShellTransitionsEnabled()) {
return ROTATION_UNDEFINED;
}
if (!WindowManagerService.ENABLE_FIXED_ROTATION_TRANSFORM) {
return ROTATION_UNDEFINED;
}