Merge "Consider last parent when compose transition." into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5831c74c4c
@@ -720,9 +720,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
|
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
if (!a.isInitialized()) {
|
if (!a.isInitialized()) {
|
||||||
final int width = endBounds.width();
|
final Rect animationRange = TransitionUtil.isClosingType(changeMode)
|
||||||
final int height = endBounds.height();
|
? change.getStartAbsBounds() : change.getEndAbsBounds();
|
||||||
a.initialize(width, height, width, height);
|
a.initialize(animationRange.width(), animationRange.height(),
|
||||||
|
endBounds.width(), endBounds.height());
|
||||||
}
|
}
|
||||||
a.restrictDuration(MAX_ANIMATION_DURATION);
|
a.restrictDuration(MAX_ANIMATION_DURATION);
|
||||||
a.scaleCurrentDuration(mTransitionAnimationScaleSetting);
|
a.scaleCurrentDuration(mTransitionAnimationScaleSetting);
|
||||||
|
|||||||
@@ -3290,6 +3290,12 @@ class Task extends TaskFragment {
|
|||||||
scheduleAnimation();
|
scheduleAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Let organizer manage task visibility for shell transition. So don't change it's
|
||||||
|
// visibility during collecting.
|
||||||
|
if (mTransitionController.isCollecting() && mCreatedByOrganizer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// We intend to let organizer manage task visibility but it doesn't
|
// We intend to let organizer manage task visibility but it doesn't
|
||||||
// have enough information until we finish shell transitions.
|
// have enough information until we finish shell transitions.
|
||||||
// In the mean time we do an easy fix here.
|
// In the mean time we do an easy fix here.
|
||||||
@@ -5687,17 +5693,28 @@ class Task extends TaskFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean moveTaskToBackInner(@NonNull Task task) {
|
private boolean moveTaskToBackInner(@NonNull Task task) {
|
||||||
moveToBack("moveTaskToBackInner", task);
|
if (mTransitionController.isShellTransitionsEnabled()) {
|
||||||
|
// Preventing from update surface position for WindowState if configuration changed,
|
||||||
if (inPinnedWindowingMode()) {
|
// because the position is depends on WindowFrame, so update the position before
|
||||||
mTaskSupervisor.removeRootTask(this);
|
// relayout will only update it to "old" position.
|
||||||
return true;
|
mAtmService.deferWindowLayout();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
moveToBack("moveTaskToBackInner", task);
|
||||||
|
|
||||||
mRootWindowContainer.ensureVisibilityAndConfig(null /* starting */,
|
if (inPinnedWindowingMode()) {
|
||||||
mDisplayContent.mDisplayId, false /* markFrozenIfConfigChanged */,
|
mTaskSupervisor.removeRootTask(this);
|
||||||
false /* deferResume */);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
mRootWindowContainer.ensureVisibilityAndConfig(null /* starting */,
|
||||||
|
mDisplayContent.mDisplayId, false /* markFrozenIfConfigChanged */,
|
||||||
|
false /* deferResume */);
|
||||||
|
} finally {
|
||||||
|
if (mTransitionController.isShellTransitionsEnabled()) {
|
||||||
|
mAtmService.continueWindowLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
ActivityRecord topActivity = getDisplayArea().topRunningActivity();
|
ActivityRecord topActivity = getDisplayArea().topRunningActivity();
|
||||||
Task topRootTask = topActivity.getRootTask();
|
Task topRootTask = topActivity.getRootTask();
|
||||||
if (topRootTask != null && topRootTask != this && topActivity.isState(RESUMED)) {
|
if (topRootTask != null && topRootTask != this && topActivity.isState(RESUMED)) {
|
||||||
|
|||||||
@@ -2244,11 +2244,17 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
|
|||||||
WindowContainer<?> ancestor = findCommonAncestor(sortedTargets, wc);
|
WindowContainer<?> ancestor = findCommonAncestor(sortedTargets, wc);
|
||||||
|
|
||||||
// Make leash based on highest (z-order) direct child of ancestor with a participant.
|
// Make leash based on highest (z-order) direct child of ancestor with a participant.
|
||||||
|
// Check whether the ancestor is belonged to last parent, shouldn't happen.
|
||||||
|
final boolean hasReparent = !wc.isDescendantOf(ancestor);
|
||||||
WindowContainer leashReference = wc;
|
WindowContainer leashReference = wc;
|
||||||
while (leashReference.getParent() != ancestor) {
|
if (hasReparent) {
|
||||||
leashReference = leashReference.getParent();
|
Slog.e(TAG, "Did not find common ancestor! Ancestor= " + ancestor
|
||||||
|
+ " target= " + wc);
|
||||||
|
} else {
|
||||||
|
while (leashReference.getParent() != ancestor) {
|
||||||
|
leashReference = leashReference.getParent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final SurfaceControl rootLeash = leashReference.makeAnimationLeash().setName(
|
final SurfaceControl rootLeash = leashReference.makeAnimationLeash().setName(
|
||||||
"Transition Root: " + leashReference.getName()).build();
|
"Transition Root: " + leashReference.getName()).build();
|
||||||
rootLeash.setUnreleasedWarningCallSite("Transition.calculateTransitionRoots");
|
rootLeash.setUnreleasedWarningCallSite("Transition.calculateTransitionRoots");
|
||||||
@@ -2453,6 +2459,20 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
|
|||||||
// Skip the non-app window or windows on a different display
|
// Skip the non-app window or windows on a different display
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Re-initiate the last parent as the initial ancestor instead of the top target.
|
||||||
|
// When move a leaf task from organized task to display area, try to keep the transition
|
||||||
|
// root be the original organized task for close transition animation.
|
||||||
|
// Otherwise, shell will use wrong root layer to play animation.
|
||||||
|
// Note: Since the target is sorted, so only need to do this at the lowest target.
|
||||||
|
if (change.mStartParent != null && wc.getParent() != null
|
||||||
|
&& change.mStartParent.isAttached() && wc.getParent() != change.mStartParent
|
||||||
|
&& i == targets.size() - 1) {
|
||||||
|
final int transitionMode = change.getTransitMode(wc);
|
||||||
|
if (transitionMode == TRANSIT_CLOSE || transitionMode == TRANSIT_TO_BACK) {
|
||||||
|
ancestor = change.mStartParent;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
while (!wc.isDescendantOf(ancestor)) {
|
while (!wc.isDescendantOf(ancestor)) {
|
||||||
ancestor = ancestor.getParent();
|
ancestor = ancestor.getParent();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user