Merge "Fix the jumpcut surface position" into main
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
index ec58292..29e4b5b 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java
@@ -395,10 +395,17 @@
continue;
}
// No default animation for this, so just update bounds/position.
- final int rootIdx = TransitionUtil.rootIndexFor(change, info);
- startTransaction.setPosition(change.getLeash(),
- change.getEndAbsBounds().left - info.getRoot(rootIdx).getOffset().x,
- change.getEndAbsBounds().top - info.getRoot(rootIdx).getOffset().y);
+ if (change.getParent() == null) {
+ // For independent change without a parent, we have reparented it to the root
+ // leash in Transitions#setupAnimHierarchy.
+ final int rootIdx = TransitionUtil.rootIndexFor(change, info);
+ startTransaction.setPosition(change.getLeash(),
+ change.getEndAbsBounds().left - info.getRoot(rootIdx).getOffset().x,
+ change.getEndAbsBounds().top - info.getRoot(rootIdx).getOffset().y);
+ } else {
+ startTransaction.setPosition(change.getLeash(),
+ change.getEndRelOffset().x, change.getEndRelOffset().y);
+ }
// Seamless display transition doesn't need to animate.
if (isSeamlessDisplayChange) continue;
if (isTask || (change.hasFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY)