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/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index 7b98b3e..aade4e0 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -78,9 +78,7 @@
class Device
{
public:
- // Service name is expected to be 'default' or 'vr' for normal use.
- // 'vr' will slightly modify the behavior of the mComposer.
- Device(const std::string& serviceName);
+ explicit Device(std::unique_ptr<android::Hwc2::Composer> composer);
void registerCallback(ComposerCallback* callback, int32_t sequenceId);
@@ -119,7 +117,7 @@
std::unique_ptr<android::Hwc2::Composer> mComposer;
std::unordered_set<Capability> mCapabilities;
std::unordered_map<hwc2_display_t, std::unique_ptr<Display>> mDisplays;
- bool mRegisteredCallback;
+ bool mRegisteredCallback = false;
};
// Convenience C++ class to access hwc2_device_t Display functions directly.