Reland "codec2: C2VDAAdaptorProxy Implementation"

This reverts commit 9900faa4256aec6debdcfbd05ba396847694967c.

Reason for revert: This CL doesn't break build now.

Change-Id: I04480777ac9af477ad844917974490c8d5fb8669
diff --git a/C2VDAComponent.cpp b/C2VDAComponent.cpp
index 0db1d79..c39dd01 100644
--- a/C2VDAComponent.cpp
+++ b/C2VDAComponent.cpp
@@ -5,7 +5,12 @@
 //#define LOG_NDEBUG 0
 #define LOG_TAG "C2VDAComponent"
 
+#ifdef V4L2_CODEC2_ARC
+#include <C2VDAAdaptorProxy.h>
+#else
 #include <C2VDAAdaptor.h>
+#endif
+
 #define __C2_GENERATE_GLOBAL_VARS__
 #include <C2VDAComponent.h>
 #include <C2VDASupport.h>
@@ -134,7 +139,11 @@
     // Get supported profiles from VDA.
     // TODO: re-think the suitable method of getting supported profiles for both pure Android and
     //       ARC++.
+#ifdef V4L2_CODEC2_ARC
+    mSupportedProfiles = arc::C2VDAAdaptorProxy::GetSupportedProfiles(inputFormatFourcc);
+#else
     mSupportedProfiles = C2VDAAdaptor::GetSupportedProfiles(inputFormatFourcc);
+#endif
     if (mSupportedProfiles.empty()) {
         ALOGE("No supported profile from input format: %u", inputFormatFourcc);
         mInitStatus = C2_BAD_VALUE;
@@ -505,7 +514,11 @@
 void C2VDAComponent::onCreate() {
     DCHECK(mTaskRunner->BelongsToCurrentThread());
     ALOGV("onCreate");
+#ifdef V4L2_CODEC2_ARC
+    mVDAAdaptor.reset(new arc::C2VDAAdaptorProxy());
+#else
     mVDAAdaptor.reset(new C2VDAAdaptor());
+#endif
 }
 
 void C2VDAComponent::onDestroy() {
@@ -993,8 +1006,11 @@
     for (uint32_t i = 0; i < passedNumPlanes; ++i) {
         ALOGV("plane %u: stride: %d, offset: %u", i, layout.planes[i].rowInc, offsets[i]);
     }
-
+#ifdef V4L2_CODEC2_ARC
+    info.mPixelFormat = arc::C2VDAAdaptorProxy::ResolveBufferFormat(crcb, semiplanar);
+#else
     info.mPixelFormat = C2VDAAdaptor::ResolveBufferFormat(crcb, semiplanar);
+#endif
     ALOGV("HAL pixel format: 0x%x", static_cast<uint32_t>(info.mPixelFormat));
 
     base::ScopedFD passedHandle(dup(info.mGraphicBlock->handle()->data[0]));