Add a root layer in DisplayContent

To enable surface animation on the overlay layer and the windowing
layer, a leash needs to be created on top of them, but because they have
no parent, there is nothing to reattache them to after the leash is
destroyed.

Adding a root layer as a container layer enbale us to workaround this
issue.

Test: presubmit and manually with the new rotation animation running on
with SurfaceAnimator (in upcoming CL)
Bug: 131727512

Change-Id: I156a7a479a055341a67eafcc203ee2c83d88a30e
This commit is contained in:
Vadim Caen
2019-08-12 11:38:22 +02:00
parent 053c2ebeaa
commit 1812c76943

View File

@@ -942,14 +942,17 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession)
.setOpaque(true)
.setContainerLayer();
mWindowingLayer = b.setName("Display Root").build();
mOverlayLayer = b.setName("Display Overlays").build();
mSurfaceControl = b.setName("Root").setContainerLayer().build();
mWindowingLayer = b.setName("Display Windows").setParent(mSurfaceControl).build();
mOverlayLayer = b.setName("Display Overlays").setParent(mSurfaceControl).build();
getPendingTransaction().setLayer(mWindowingLayer, 0)
.setLayerStack(mWindowingLayer, mDisplayId)
getPendingTransaction()
.setLayer(mSurfaceControl, 0)
.setLayerStack(mSurfaceControl, mDisplayId)
.show(mSurfaceControl)
.setLayer(mWindowingLayer, 0)
.show(mWindowingLayer)
.setLayer(mOverlayLayer, 1)
.setLayerStack(mOverlayLayer, mDisplayId)
.show(mOverlayLayer);
getPendingTransaction().apply();
@@ -4880,7 +4883,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
mPortalWindowHandle = createPortalWindowHandle(sc.toString());
}
getPendingTransaction().setInputWindowInfo(sc, mPortalWindowHandle)
.reparent(mWindowingLayer, sc).reparent(mOverlayLayer, sc);
.reparent(mSurfaceControl, sc);
}
/**