Merge "graphics: get rid of BINDERIZED"
diff --git a/graphics/composer/2.1/default/Android.bp b/graphics/composer/2.1/default/Android.bp
index a366fa2..46cd0c4 100644
--- a/graphics/composer/2.1/default/Android.bp
+++ b/graphics/composer/2.1/default/Android.bp
@@ -2,7 +2,6 @@
     name: "libhwcomposer-client",
     export_include_dirs: ["."],
     srcs: ["ComposerClient.cpp"],
-    cppflags: ["-DBINDERIZED"],
     shared_libs: [
         "android.hardware.graphics.allocator@2.0",
         "android.hardware.graphics.composer@2.1",
@@ -22,7 +21,8 @@
 cc_library_shared {
     name: "android.hardware.graphics.composer@2.1-impl",
     relative_install_path: "hw",
-    srcs: ["Hwc.cpp", "ComposerClient.cpp"],
+    srcs: ["Hwc.cpp"],
+    static_libs: ["libhwcomposer-client"],
     shared_libs: [
         "android.hardware.graphics.allocator@2.0",
         "android.hardware.graphics.composer@2.1",
@@ -42,13 +42,9 @@
 cc_binary {
     name: "android.hardware.graphics.composer@2.1-service",
     relative_install_path: "hw",
-    srcs: ["service.cpp", "Hwc.cpp"],
-    cppflags: ["-DBINDERIZED"],
+    srcs: ["service.cpp"],
     init_rc: ["android.hardware.graphics.composer@2.1-service.rc"],
-
-    static_libs: [
-        "libhwcomposer-client",
-    ],
+    static_libs: ["libhwcomposer-client"],
     shared_libs: [
         "android.hardware.graphics.allocator@2.0",
         "android.hardware.graphics.composer@2.1",
diff --git a/graphics/composer/2.1/default/ComposerClient.cpp b/graphics/composer/2.1/default/ComposerClient.cpp
index 49415ee..7a2cb25 100644
--- a/graphics/composer/2.1/default/ComposerClient.cpp
+++ b/graphics/composer/2.1/default/ComposerClient.cpp
@@ -99,7 +99,6 @@
 
     // Some existing gralloc drivers do not support retaining more than once,
     // when we are in passthrough mode.
-#ifdef BINDERIZED
     bool openGralloc()
     {
         const hw_module_t* module = nullptr;
@@ -188,12 +187,6 @@
 
     // gralloc0
     const gralloc_module_t* mModule;
-#else
-    bool openGralloc() { return true; }
-    void closeGralloc() {}
-    buffer_handle_t cloneBuffer(buffer_handle_t handle) { return handle; }
-    void releaseBuffer(buffer_handle_t) {}
-#endif
 };
 
 HandleImporter sHandleImporter;
diff --git a/graphics/composer/2.1/default/service.cpp b/graphics/composer/2.1/default/service.cpp
index c2a2b19..a31decd 100644
--- a/graphics/composer/2.1/default/service.cpp
+++ b/graphics/composer/2.1/default/service.cpp
@@ -14,41 +14,20 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "HWComposerService"
+#define LOG_TAG "android.hardware.graphics.composer@2.1-service"
+
+#include <android/hardware/graphics/composer/2.1/IComposer.h>
 
 #include <binder/ProcessState.h>
-#include <hidl/HidlTransportSupport.h>
-#include <utils/StrongPointer.h>
-#include "Hwc.h"
+#include <hidl/LegacySupport.h>
 
-using android::hardware::configureRpcThreadpool;
-using android::hardware::joinRpcThreadpool;
-using android::sp;
 using android::hardware::graphics::composer::V2_1::IComposer;
-using android::hardware::graphics::composer::V2_1::implementation::HIDL_FETCH_IComposer;
+using android::hardware::defaultPassthroughServiceImplementation;
 
-int main()
-{
-    const char instance[] = "hwcomposer";
-
-    ALOGI("Service is starting.");
-
-    configureRpcThreadpool(1, true /* callerWillJoin */);
-    sp<IComposer> service = HIDL_FETCH_IComposer(instance);
-    if (service == nullptr) {
-        ALOGI("getService returned NULL");
-        return -1;
-    }
-
-    LOG_FATAL_IF(service->isRemote(), "Service is REMOTE!");
-
-    service->registerAsService(instance);
-
+int main() {
     // the conventional HAL might start binder services
     android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
     android::ProcessState::self()->startThreadPool();
 
-    joinRpcThreadpool();
-
-    return 0;
+    return defaultPassthroughServiceImplementation<IComposer>("hwcomposer");
 }