Do not create extend surface for transfer starting window change.

There could transfer starting window when launch a trampoline activity,
and the trampoline activity could be removed before it add a window.
So a possible sequence would be:

1. Activity A start a trampoline activity B, and transfer the starting
window to B.
2. B finish itself before add window, so the starting window transfer
back to A.

And there will create a close transition when finish B, but actually
this activity never draw anything on it. So if there attemp to create
an edge extend surface for it, that thread would be stuck in
Surface.unlockAndPost because nothing will draw.
Note: Not sure if above reasoning is correct, but in any case, it
should be reasonable to not need to prepare edge extend surface for the
surface which could never been drawn.

Bug: 244260394
Test: atest ActivityLifecycleTests --rerun-until-failure 10
Change-Id: I31a36398bec86cb439396ad93108487cd6479139
This commit is contained in:
wilsonshih
2022-08-30 12:33:18 +08:00
parent dd2f290170
commit e252ffde09

View File

@@ -554,6 +554,12 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
private void edgeExtendWindow(TransitionInfo.Change change,
Animation a, SurfaceControl.Transaction startTransaction,
SurfaceControl.Transaction finishTransaction) {
// Do not create edge extension surface for transfer starting window change.
// The app surface could be empty thus nothing can draw on the hardware renderer, which will
// block this thread when calling Surface#unlockCanvasAndPost.
if ((change.getFlags() & FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT) != 0) {
return;
}
final Transformation transformationAtStart = new Transformation();
a.getTransformationAt(0, transformationAtStart);
final Transformation transformationAtEnd = new Transformation();