SF: Separate Hwc2::Composer into interface and impl
This makes the android::Hwc2::Composer substitutable. In this case the
intent is to allow a mock::Composer GMock class to be defined.
Hwc2::Composer now is a pure interface class. Hwc2::impl::Composer is
the normal implementation.
Also included is another minor change to allow HWC2::Device to be
constructed with a Hwc2::Composer (interface) pointer instead of a
service name. This means that now SurfaceFlinger itself constructs the
Hwc2::impl::Composer using the service name, rather than passing it down
a call chain.
Test: Code builds
Bug: None
Change-Id: Ic79f645cee40c534651b9c7b70f05497d98e51dc
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 1054c32..1380b01 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -593,7 +593,8 @@
LOG_ALWAYS_FATAL_IF(mVrFlingerRequestsDisplay,
"Starting with vr flinger active is not currently supported.");
- getBE().mHwc.reset(new HWComposer(getBE().mHwcServiceName));
+ getBE().mHwc.reset(
+ new HWComposer(std::make_unique<Hwc2::impl::Composer>(getBE().mHwcServiceName)));
getBE().mHwc->registerCallback(this, getBE().mComposerSequenceId);
// Process any initial hotplug and resulting display changes.
processDisplayHotplugEventsLocked();
@@ -1342,7 +1343,8 @@
resetDisplayState();
getBE().mHwc.reset(); // Delete the current instance before creating the new one
- getBE().mHwc.reset(new HWComposer(vrFlingerRequestsDisplay ? "vr" : getBE().mHwcServiceName));
+ getBE().mHwc.reset(new HWComposer(std::make_unique<Hwc2::impl::Composer>(
+ vrFlingerRequestsDisplay ? "vr" : getBE().mHwcServiceName)));
getBE().mHwc->registerCallback(this, ++getBE().mComposerSequenceId);
LOG_ALWAYS_FATAL_IF(!getBE().mHwc->getComposer()->isRemote(),