Merge "Validate target view surface in PipDismissTargetHandler" into tm-dev

This commit is contained in:
Hongwei Wang
2022-04-20 04:28:26 +00:00
committed by Android (Google) Code Review

View File

@@ -220,10 +220,16 @@ public class PipDismissTargetHandler implements ViewTreeObserver.OnPreDrawListen
return;
}
final SurfaceControl targetViewLeash =
mTargetViewContainer.getViewRootImpl().getSurfaceControl();
if (!targetViewLeash.isValid()) {
// The surface of mTargetViewContainer is somehow not ready, bail early
return;
}
// Put the dismiss target behind the task
SurfaceControl.Transaction t = new SurfaceControl.Transaction();
t.setRelativeLayer(mTargetViewContainer.getViewRootImpl().getSurfaceControl(),
mTaskLeash, -1);
t.setRelativeLayer(targetViewLeash, mTaskLeash, -1);
t.apply();
}