Merge "Fix black screen while animating a closing and changing TF" into tm-qpr-dev

This commit is contained in:
Louis Chang
2023-03-24 08:04:53 +00:00
committed by Android (Google) Code Review
3 changed files with 15 additions and 4 deletions

View File

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

View File

@@ -2498,13 +2498,18 @@ class TaskFragment extends WindowContainer<WindowContainer> {
} }
} }
/** 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 if (isOrganizedTaskFragment() && mDisplayContent != null
&& mDisplayContent.mChangingContainers.remove(this)) { && mDisplayContent.mChangingContainers.remove(this)) {
mDisplayContent.mClosingChangingContainers.put( mDisplayContent.mClosingChangingContainers.put(
this, new Rect(mSurfaceFreezer.mFreezeBounds)); this, new Rect(mSurfaceFreezer.mFreezeBounds));
return true;
} }
return false;
} }
@Override @Override

View File

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