Introduce ComposerBase interface to allow custom Hwc implementations

Decouples the ComposerClient code which deals with parsing the command buffer
messages sent by SurfaceFlinger from the Hwc code that handles the
commands.

Bug: 33297270
Test: Compiled and verified on device that hwcomposer-2-1 service can
start correctly. SurfaceFlinger can connect to the service and the
system boots up. Also verified SurfaceFlinger runs correctly without
hwcomposer-2-1.
Change-Id: I43357306caea57d262735f4756c379ba9d0138cd
diff --git a/graphics/composer/2.1/default/Hwc.cpp b/graphics/composer/2.1/default/Hwc.cpp
index 4efb12b..cf82967 100644
--- a/graphics/composer/2.1/default/Hwc.cpp
+++ b/graphics/composer/2.1/default/Hwc.cpp
@@ -20,8 +20,8 @@
 
 #include <log/log.h>
 
+#include "ComposerClient.h"
 #include "Hwc.h"
-#include "HwcClient.h"
 
 namespace android {
 namespace hardware {
@@ -184,14 +184,15 @@
 Return<void> HwcHal::createClient(createClient_cb hidl_cb)
 {
     Error err = Error::NONE;
-    sp<HwcClient> client;
+    sp<ComposerClient> client;
 
     {
         std::lock_guard<std::mutex> lock(mClientMutex);
 
         // only one client is allowed
         if (mClient == nullptr) {
-            client = new HwcClient(*this);
+            client = new ComposerClient(*this);
+            client->initialize();
             mClient = client;
         } else {
             err = Error::NO_RESOURCES;
@@ -203,7 +204,7 @@
     return Void();
 }
 
-sp<HwcClient> HwcHal::getClient()
+sp<ComposerClient> HwcHal::getClient()
 {
     std::lock_guard<std::mutex> lock(mClientMutex);
     return (mClient != nullptr) ? mClient.promote() : nullptr;