Merge "Reparent bounds layer if surface was replaced." into rvc-dev am: ab3d80c98d am: fa48a156c7 am: 75a12e747c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12123266 Change-Id: Id7a415d1cc24dc9f114402d25a0de2e7dfcdc77e
This commit is contained in:
@@ -1824,13 +1824,19 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
/**
|
/**
|
||||||
* Called after window layout to update the bounds surface. If the surface insets have changed
|
* Called after window layout to update the bounds surface. If the surface insets have changed
|
||||||
* or the surface has resized, update the bounds surface.
|
* or the surface has resized, update the bounds surface.
|
||||||
|
*
|
||||||
|
* @param shouldReparent Whether it should reparent the bounds layer to the main SurfaceControl.
|
||||||
*/
|
*/
|
||||||
private void updateBoundsLayer() {
|
private void updateBoundsLayer(boolean shouldReparent) {
|
||||||
if (mBoundsLayer != null) {
|
if (mBoundsLayer != null) {
|
||||||
setBoundsLayerCrop();
|
setBoundsLayerCrop();
|
||||||
mTransaction.deferTransactionUntil(mBoundsLayer,
|
mTransaction.deferTransactionUntil(mBoundsLayer, getRenderSurfaceControl(),
|
||||||
getRenderSurfaceControl(), mSurface.getNextFrameNumber())
|
mSurface.getNextFrameNumber());
|
||||||
.apply();
|
|
||||||
|
if (shouldReparent) {
|
||||||
|
mTransaction.reparent(mBoundsLayer, getRenderSurfaceControl());
|
||||||
|
}
|
||||||
|
mTransaction.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2912,7 +2918,16 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (surfaceSizeChanged || surfaceReplaced || surfaceCreated || windowAttributesChanged) {
|
if (surfaceSizeChanged || surfaceReplaced || surfaceCreated || windowAttributesChanged) {
|
||||||
updateBoundsLayer();
|
// If the surface has been replaced, there's a chance the bounds layer is not parented
|
||||||
|
// to the new layer. When updating bounds layer, also reparent to the main VRI
|
||||||
|
// SurfaceControl to ensure it's correctly placed in the hierarchy.
|
||||||
|
//
|
||||||
|
// This needs to be done on the client side since WMS won't reparent the children to the
|
||||||
|
// new surface if it thinks the app is closing. WMS gets the signal that the app is
|
||||||
|
// stopping, but on the client side it doesn't get stopped since it's restarted quick
|
||||||
|
// enough. WMS doesn't want to keep around old children since they will leak when the
|
||||||
|
// client creates new children.
|
||||||
|
updateBoundsLayer(surfaceReplaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw);
|
final boolean didLayout = layoutRequested && (!mStopped || mReportNextDraw);
|
||||||
|
|||||||
Reference in New Issue
Block a user