CE: Allow the final class to set the types used
Modifies the various CompositionEngine implementation classes so that
they no longer store instances of the state structures they manipulate.
Instead the implementation gets access to the state using an accessor,
which is only implemented by a final derived class type.
Doing this allows for implementation inheritance, where a derived
implementation can leverage covariance to work with a more specialized type.
Test: atest libsurfaceflinger_unittest libcompositionengine_test
Test: go/wm-smoke
Bug: 121291683
Change-Id: I26366900fc4c7869f4de91f25e43b3bec917f63d
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 2ada86b..b1fcff2 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -59,12 +59,13 @@
mSequenceId(args.sequenceId),
mDisplayInstallOrientation(args.displayInstallOrientation),
mCompositionDisplay{mFlinger->getCompositionEngine().createDisplay(
- compositionengine::DisplayCreationArgs{args.isSecure, args.isVirtual,
- args.displayId, args.powerAdvisor})},
+ compositionengine::DisplayCreationArgs{args.isVirtual, args.displayId,
+ args.powerAdvisor})},
mIsVirtual(args.isVirtual),
mOrientation(),
mActiveConfig(0),
mIsPrimary(args.isPrimary) {
+ mCompositionDisplay->editState().isSecure = args.isSecure;
mCompositionDisplay->createRenderSurface(
compositionengine::RenderSurfaceCreationArgs{ANativeWindow_getWidth(
args.nativeWindow.get()),