Merge "Fix black screen while animating a closing and changing TF" into udc-dev am: 3e12034586

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22223384

Change-Id: Ie2b980a5a9f8c7cf1e6fa8945d4f3c845d361a6f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Louis Chang
2023-03-24 01:10:43 +00:00
committed by Automerger Merge Worker
4 changed files with 16 additions and 6 deletions

View File

@@ -214,7 +214,8 @@ class TaskFragmentAnimationRunner extends IRemoteAnimationRunner.Stub {
openingWholeScreenBounds.union(target.screenSpaceBounds);
} else {
closingTargets.add(target);
closingWholeScreenBounds.union(target.screenSpaceBounds);
// Union the start bounds since this may be the ClosingChanging animation.
closingWholeScreenBounds.union(target.startBounds);
}
}

View File

@@ -224,7 +224,7 @@ class ActivityEmbeddingAnimationRunner {
openingWholeScreenBounds.union(change.getEndAbsBounds());
} else {
closingChanges.add(change);
closingWholeScreenBounds.union(change.getEndAbsBounds());
closingWholeScreenBounds.union(change.getStartAbsBounds());
}
}

View File

@@ -2553,13 +2553,18 @@ class TaskFragment extends WindowContainer<WindowContainer> {
return task != null && !task.isDragResizing() && super.canStartChangeTransition();
}
/** Records the starting bounds of the closing organized TaskFragment. */
void setClosingChangingStartBoundsIfNeeded() {
/**
* Returns {@code true} if the starting bounds of the closing organized TaskFragment is
* recorded. Otherwise, return {@code false}.
*/
boolean setClosingChangingStartBoundsIfNeeded() {
if (isOrganizedTaskFragment() && mDisplayContent != null
&& mDisplayContent.mChangingContainers.remove(this)) {
mDisplayContent.mClosingChangingContainers.put(
this, new Rect(mSurfaceFreezer.mFreezeBounds));
return true;
}
return false;
}
@Override

View File

@@ -1336,14 +1336,18 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
// If we are losing visibility, then a snapshot isn't necessary and we are no-longer
// part of a change transition.
if (!visible) {
boolean skipUnfreeze = false;
if (asTaskFragment() != null) {
// If the organized TaskFragment is closing while resizing, we want to keep track of
// its starting bounds to make sure the animation starts at the correct position.
// This should be called before unfreeze() because we record the starting bounds
// in SurfaceFreezer.
asTaskFragment().setClosingChangingStartBoundsIfNeeded();
skipUnfreeze = asTaskFragment().setClosingChangingStartBoundsIfNeeded();
}
if (!skipUnfreeze) {
mSurfaceFreezer.unfreeze(getSyncTransaction());
}
mSurfaceFreezer.unfreeze(getSyncTransaction());
}
WindowContainer parent = getParent();
if (parent != null) {