Tailor GCE Camera to VSoC

Change-Id: If87fe86faff751a85f85329abe2fe6f7048491cc
diff --git a/guest/hals/camera/Android.mk b/guest/hals/camera/Android.mk
index 05acb5b..8cb5091 100644
--- a/guest/hals/camera/Android.mk
+++ b/guest/hals/camera/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 The Android Open Source Project
+# Copyright (C) 2017 The Android Open Source Project
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
 
 # Emulator camera module########################################################
 
-emulator_camera_module_relative_path := hw
 emulator_camera_cflags := -fno-short-enums $(GCE_VERSION_CFLAGS)
 emulator_camera_cflags += -Wno-unused-parameter -Wno-missing-field-initializers
 emulator_camera_clang_flags := -Wno-c++11-narrowing
@@ -31,28 +30,17 @@
     libui \
     libdl \
     libjpeg \
+    libjsoncpp \
     libcamera_metadata \
-    libhardware \
-    libgcecutils
-
-emulator_camera_static_libraries := \
-	libgcemetadata \
-	libbase_gce \
-	$(GCE_STLPORT_STATIC_LIBS)
-
-ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -le 22; echo $$?))
-emulator_camera_shared_libraries += libjsoncpp
-else
-emulator_camera_static_libraries += libjsoncpp
-endif
+    libhardware
 
 emulator_camera_c_includes := \
-	frameworks/native/include/media/hardware \
-	$(call include-path-for, camera) \
-	$(LOCAL_PATH)/../include \
-	$(GCE_STLPORT_INCLUDES) \
+    device/google/cuttlefish_common \
+    frameworks/native/include/media/hardware \
+    $(call include-path-for, camera) \
 
 emulator_camera_src := \
+	CameraConfiguration.cpp \
 	EmulatedCameraHal.cpp \
 	EmulatedCameraFactory.cpp \
 	EmulatedBaseCamera.cpp \
@@ -91,17 +79,11 @@
 emulator_camera_c_includes += external/jpeg
 endif
 
-ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -ge 21; echo $$?))
-LOCAL_MODULE_RELATIVE_PATH := ${emulator_camera_module_relative_path}
-else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/${emulator_camera_module_relative_path}
-endif
 LOCAL_MULTILIB := first
 LOCAL_CFLAGS := ${emulator_camera_cflags}
 LOCAL_CLANG_CFLAGS += ${emulator_camera_clang_flags}
 
 LOCAL_SHARED_LIBRARIES := ${emulator_camera_shared_libraries}
-LOCAL_STATIC_LIBRARIES := ${emulator_camera_static_libraries}
 LOCAL_C_INCLUDES += ${emulator_camera_c_includes}
 LOCAL_SRC_FILES := ${emulator_camera_src} ${emulator_camera_ext_src} \
 	$(if $(enable_emulated_camera2),$(emulated_camera2_src),) \
@@ -117,7 +99,6 @@
 
 include $(CLEAR_VARS)
 
-jpeg_module_relative_path := hw
 jpeg_cflags := -fno-short-enums
 jpeg_cflags += -Wno-unused-parameter
 jpeg_clang_flags += -Wno-c++11-narrowing
@@ -127,15 +108,16 @@
     libskia \
     libjpeg \
     libandroid_runtime
-jpeg_static_libraries := libgcecutils $(GCE_STLPORT_STATIC_LIBS) libyuv_static
-jpeg_c_includes := external/libyuv/files/include \
-                   external/skia/include/core/ \
-                   frameworks/base/core/jni/android/graphics \
-                   frameworks/native/include \
-                   $(LOCAL_PATH)/../include \
-                   $(GCE_STLPORT_INCLUDES)
-jpeg_src := JpegStub.cpp \
-            ExifMetadataBuilder.cpp
+jpeg_static_libraries := libyuv_static
+jpeg_c_includes := \
+    device/google/cuttlefish_common \
+    external/libyuv/files/include \
+    external/skia/include/core/ \
+    frameworks/base/core/jni/android/graphics \
+    frameworks/native/include
+jpeg_src := \
+    JpegStub.cpp \
+    ExifMetadataBuilder.cpp
 
 # JPEG stub - goldfish build####################################################
 
@@ -145,11 +127,6 @@
 jpeg_c_includes += external/jpeg
 endif
 
-ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -ge 21; echo $$?))
-LOCAL_MODULE_RELATIVE_PATH := ${emulator_camera_module_relative_path}
-else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/${emulator_camera_module_relative_path}
-endif
 LOCAL_MULTILIB := first
 LOCAL_CFLAGS += ${jpeg_cflags}
 LOCAL_CLANG_CFLAGS += ${jpeg_clangflags}
diff --git a/guest/hals/camera/CameraConfiguration.cpp b/guest/hals/camera/CameraConfiguration.cpp
index 767fd4f..48dfbd0 100644
--- a/guest/hals/camera/CameraConfiguration.cpp
+++ b/guest/hals/camera/CameraConfiguration.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2017 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,17 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "GceDevicePersonalityImpl.h"
+#include "CameraConfiguration.h"
 
-#define LOG_TAG "GceDevicePersonality"
+#define LOG_TAG "CameraConfiguration"
 
 #include <android-base/file.h>
 #include <android-base/strings.h>
 #include <cutils/log.h>
 #include <json/json.h>
 #include <json/reader.h>
-#include <GceMetadataAttributes.h>
-#include <GceResourceLocation.h>
 #include <stdlib.h>
 
 namespace avd {
@@ -65,6 +63,10 @@
 //   }
 // ]
 //
+
+// Location of the camera configuration files.
+const char* const kConfigurationFileLocation = "/vendor/etc/config/camera.json";
+
 //
 // Array of camera definitions for all cameras available on the device (array).
 // Top Level Key.
@@ -190,7 +192,7 @@
     const Json::Value& value,
     std::vector<personality::Camera>* cameras) {
   if (!value.isObject()) {
-    ALOGE("%s: Personality root is not an object", __FUNCTION__);
+    ALOGE("%s: Configuration root is not an object", __FUNCTION__);
     return false;
   }
 
@@ -275,96 +277,22 @@
 
   return true;
 }
-
-bool ConfigureCameraFromLegacySetting(
-    const std::string& setting,
-    personality::Camera* camera) {
-  std::stringstream prop_reader(setting);
-  std::string hal_version;
-  if (!std::getline(prop_reader, hal_version, ',')) return false;
-  if (!ValueToCameraHalVersion(hal_version, &camera->hal_version)) return false;
-
-  std::string width, height;
-  if (!std::getline(prop_reader, width, ',')) return false;
-  if (!std::getline(prop_reader, height, ',')) return false;
-
-  camera->resolutions.push_back(personality::Camera::Resolution());
-  if (!ValueToCameraResolution(width, height,
-                               &camera->resolutions.back())) return false;
-
-  // Final component: style. Ignore.
-
-  return true;
-}
-
-bool ConfigureCamerasFromLegacySettings(
-    InitialMetadataReader* reader,
-    std::vector<personality::Camera>* cameras) {
-  const char* value = reader->GetValueForKey(
-      GceMetadataAttributes::kFrontCameraConfigKey);
-  if (value) {
-    personality::Camera camera;
-    camera.orientation = personality::Camera::kFront;
-    if (ConfigureCameraFromLegacySetting(value, &camera)) {
-      cameras->push_back(camera);
-    }
-  }
-
-  value = reader->GetValueForKey(
-      GceMetadataAttributes::kBackCameraConfigKey);
-  if (value) {
-    personality::Camera camera;
-    camera.orientation = personality::Camera::kFront;
-    if (ConfigureCameraFromLegacySetting(value, &camera)) {
-      cameras->push_back(camera);
-    }
-  }
-
-  return true;
-}
-
 }  // namespace
 
-void GceDevicePersonalityImpl::Init() {
-  // Try parsing user supplied JSON.
-  Reset();
-  const char* personality = reader_->GetValueForKey(
-      GceMetadataAttributes::kDevicePersonalityDefinitionKey);
-  if (personality && InitFromJsonObject(personality)) {
-    return;
-  }
-
-  // Try parsing file selected by User.
-  Reset();
-  personality = reader_->GetValueForKey(
-      GceMetadataAttributes::kDevicePersonalityNameKey);
-  if (personality && InitFromPersonalityName(personality)) {
-    return;
-  }
-
-  // Fallback: Init from default file.
-  Reset();
-  if (InitFromPersonalityName("default")) {
-    return;
-  }
-
-  ALOGE("%s: Could not initialize device personality from any source.",
-        __FUNCTION__);
-
-  Reset();
-  InitFromLegacySettings();
-}
-
-void GceDevicePersonalityImpl::Reset() {
+bool CameraConfiguration::Init() {
   cameras_.clear();
-}
+  std::string config;
+  if (!android::base::ReadFileToString(
+      kConfigurationFileLocation, &personality)) {
+    ALOGE("%s: Could not open configuration file: %s",
+          __FUNCTION__, path.c_str());
+    return false;
+  }
 
-bool GceDevicePersonalityImpl::InitFromJsonObject(
-    const std::string& json_object) {
   Json::Reader personality_reader;
   Json::Value root;
-  if (!personality_reader.parse(json_object, root)) {
-    ALOGE("%s: Could not parse personality: %s", __FUNCTION__,
+  if (!personality_reader.parse(config, root)) {
+    ALOGE("Could not parse configuration file: %s", __FUNCTION__,
           personality_reader.getFormattedErrorMessages().c_str());
     return false;
   }
@@ -372,40 +300,6 @@
   return ConfigureCameras(root, &cameras_);
 }
 
-bool GceDevicePersonalityImpl::InitFromPersonalityName(
-    const std::string& personality_name) {
-  std::string path(GceResourceLocation::kDevicePersonalitiesPath);
-  path += "/";
-  path += personality_name;
-  path += ".json";
-
-  std::string personality;
-  if (!android::base::ReadFileToString(path, &personality)) {
-    ALOGE("%s: Could not open personality file: %s",
-          __FUNCTION__, path.c_str());
-    return false;
-  }
-
-  ALOGI("%s: Parsing personality file: %s",
-        __FUNCTION__, personality_name.c_str());
-
-  return InitFromJsonObject(personality);
-}
-
-bool GceDevicePersonalityImpl::InitFromLegacySettings() {
-  return ConfigureCamerasFromLegacySettings(reader_, &cameras_);
-}
-
-GceDevicePersonality* GceDevicePersonality::getInstance(
-    InitialMetadataReader* reader) {
-  static GceDevicePersonalityImpl* instance;
-  if (!instance) {
-    instance = new GceDevicePersonalityImpl(reader);
-    instance->Init();
-  }
-  return instance;
-}
-
 }  // namespace avd
 
 
diff --git a/guest/hals/camera/CameraConfiguration.h b/guest/hals/camera/CameraConfiguration.h
index 90a6dcb..2c766c4 100644
--- a/guest/hals/camera/CameraConfiguration.h
+++ b/guest/hals/camera/CameraConfiguration.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2017 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,35 +21,20 @@
 #include <UniquePtr.h>
 
 namespace avd {
-class GceDevicePersonalityImpl : public GceDevicePersonality {
+class CameraConfiguration {
  public:
-  GceDevicePersonalityImpl(InitialMetadataReader* reader)
+  CameraConfiguration(InitialMetadataReader* reader)
       : reader_(reader) {}
 
-  ~GceDevicePersonalityImpl() {}
+  ~CameraConfiguration() {}
 
-  virtual const std::vector<personality::Camera>& cameras() {
+  const std::vector<personality::Camera>& cameras() const {
     return cameras_;
   }
 
   void Init();
 
  private:
-  // Clear all properties.
-  void Reset();
-
-  // Initialize from supplied JSON object.
-  bool InitFromJsonObject(const std::string& json_object);
-
-  // Initialize from supplied device name.
-  // Will attempt to find configuration for this device in device personalities
-  // path.
-  bool InitFromPersonalityName(const std::string& device_name);
-
-  // Fallback to old settings. If not present, initialize with sane defaults.
-  bool InitFromLegacySettings();
-
-  InitialMetadataReader* reader_;
   std::vector<personality::Camera> cameras_;
 };
 
diff --git a/guest/hals/camera/EmulatedBaseCamera.cpp b/guest/hals/camera/EmulatedBaseCamera.cpp
index a37d7f8..b488088 100644
--- a/guest/hals/camera/EmulatedBaseCamera.cpp
+++ b/guest/hals/camera/EmulatedBaseCamera.cpp
@@ -79,7 +79,7 @@
     return INVALID_OPERATION;
 }
 
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
 camera_device_status_t EmulatedBaseCamera::getHotplugStatus() {
     return CAMERA_DEVICE_STATUS_PRESENT;
 }
diff --git a/guest/hals/camera/EmulatedBaseCamera.h b/guest/hals/camera/EmulatedBaseCamera.h
index 8384f3f..db23fe4 100644
--- a/guest/hals/camera/EmulatedBaseCamera.h
+++ b/guest/hals/camera/EmulatedBaseCamera.h
@@ -19,8 +19,8 @@
 
 #include <hardware/camera_common.h>
 #include <utils/Errors.h>
-#include <api_level_fixes.h>
-#include <GceDevicePersonality.h>
+#include "guest/libs/platform_support/api_level_fixes.h"
+#include "CameraConfiguration.h"
 #include "ImageMetadata.h"
 
 namespace android {
diff --git a/guest/hals/camera/EmulatedCameraDevice.cpp b/guest/hals/camera/EmulatedCameraDevice.cpp
index 3d42426..36de83a 100755
--- a/guest/hals/camera/EmulatedCameraDevice.cpp
+++ b/guest/hals/camera/EmulatedCameraDevice.cpp
@@ -342,7 +342,7 @@
       // If thread is running and readyToRun() has not finished running,
       //    then wait until it is done.
       Mutex::Autolock lock(mCameraDevice->mObjectLock);
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
       if (isRunning() && (mThreadControl < 0 || mControlFD < 0)) {
 #else
       if (getTid() != -1 && (mThreadControl < 0 || mControlFD < 0)) {
diff --git a/guest/hals/camera/EmulatedCameraFactory.cpp b/guest/hals/camera/EmulatedCameraFactory.cpp
index 81a3e81..67928fd 100755
--- a/guest/hals/camera/EmulatedCameraFactory.cpp
+++ b/guest/hals/camera/EmulatedCameraFactory.cpp
@@ -25,12 +25,12 @@
 #include <cutils/properties.h>
 #include "EmulatedFakeCamera.h"
 
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
 #include "EmulatedFakeCamera2.h"
 #include "EmulatedCameraHotplugThread.h"
 #endif
 
-#if GCE_PLATFORM_SDK_AFTER(L_MR1)
+#if VSOC_PLATFORM_SDK_AFTER(L_MR1)
 #include "EmulatedFakeCamera3.h"
 #endif
 
@@ -46,7 +46,7 @@
 
 EmulatedCameraFactory::EmulatedCameraFactory()
         :
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
           mCallbacks(NULL),
 #endif
           mGceDevicePersonality(avd::GceDevicePersonality::getInstance(
@@ -64,7 +64,7 @@
 
     ALOGV("%d cameras are being emulated.", getEmulatedCameraNum());
 
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
     /* Create hotplug thread */
     {
         mHotplugThread = new EmulatedCameraHotplugThread(getEmulatedCameraNum());
@@ -96,13 +96,13 @@
             camera = new EmulatedFakeCamera(cameraId, is_back_facing,
                                             &HAL_MODULE_INFO_SYM.common);
             break;
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
         case avd::personality::Camera::kHalV2:
             camera = new EmulatedFakeCamera2(cameraId, is_back_facing,
                                              &HAL_MODULE_INFO_SYM.common);
             break;
 #endif
-#if GCE_PLATFORM_SDK_AFTER(L_MR1)
+#if VSOC_PLATFORM_SDK_AFTER(L_MR1)
         case avd::personality::Camera::kHalV3:
             camera = new EmulatedFakeCamera3(cameraId, is_back_facing,
                                         &HAL_MODULE_INFO_SYM.common);
@@ -139,7 +139,7 @@
         }
     }
 
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
     if (mHotplugThread != NULL) {
         mHotplugThread->requestExit();
         mHotplugThread->join();
@@ -177,7 +177,7 @@
     return camera->getCameraInfo(info);
 }
 
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
 int EmulatedCameraFactory::setCallbacks(
         const camera_module_callbacks_t *callbacks)
 {
@@ -232,7 +232,7 @@
     return EmulatedCameraFactory::Instance().getCameraInfo(camera_id, info);
 }
 
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
 int EmulatedCameraFactory::set_callbacks(
         const camera_module_callbacks_t *callbacks)
 {
@@ -268,7 +268,7 @@
      * Send the callback first to framework, THEN close the camera.
      */
 
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
     if (newStatus == cam->getHotplugStatus()) {
         ALOGW("%s: Ignoring transition to the same status", __FUNCTION__);
         return;
diff --git a/guest/hals/camera/EmulatedCameraFactory.h b/guest/hals/camera/EmulatedCameraFactory.h
index 80c3779..dec6025 100755
--- a/guest/hals/camera/EmulatedCameraFactory.h
+++ b/guest/hals/camera/EmulatedCameraFactory.h
@@ -17,12 +17,12 @@
 #ifndef HW_EMULATOR_CAMERA_EMULATED_CAMERA_FACTORY_H
 #define HW_EMULATOR_CAMERA_EMULATED_CAMERA_FACTORY_H
 
-#include <api_level_fixes.h>
 #include <utils/RefBase.h>
 
-#include <GceDevicePersonality.h>
 #include <utils/Vector.h>
 #include <Pthread.h>
+#include "guest/libs/platform_support/api_level_fixes.h"
+#include "CameraConfiguration.h"
 #include "EmulatedBaseCamera.h"
 
 namespace android {
diff --git a/guest/hals/camera/EmulatedCameraHal.cpp b/guest/hals/camera/EmulatedCameraHal.cpp
index 5b1599d..d7413c0 100755
--- a/guest/hals/camera/EmulatedCameraHal.cpp
+++ b/guest/hals/camera/EmulatedCameraHal.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "EmulatedCameraFactory.h"
-#include "api_level_fixes.h"
+#include "guest/libs/platform_support/api_level_fixes.h"
 
 /*
  * Required HAL header.
@@ -32,9 +32,9 @@
 camera_module_t HAL_MODULE_INFO_SYM = {
     common: {
          tag:                HARDWARE_MODULE_TAG,
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
          module_api_version: CAMERA_MODULE_API_VERSION_2_3,
-#elif GCE_PLATFORM_SDK_AFTER(J_MR2)
+#elif VSOC_PLATFORM_SDK_AFTER(J_MR2)
          module_api_version: CAMERA_MODULE_API_VERSION_2_2,
 #else
          module_api_version: CAMERA_MODULE_API_VERSION_2_0,
@@ -49,11 +49,11 @@
     },
     get_number_of_cameras:  android::EmulatedCameraFactory::get_number_of_cameras,
     get_camera_info:        android::EmulatedCameraFactory::get_camera_info,
-#if GCE_PLATFORM_SDK_AFTER(J_MR2)
+#if VSOC_PLATFORM_SDK_AFTER(J_MR2)
     set_callbacks:          android::EmulatedCameraFactory::set_callbacks,
     get_vendor_tag_ops:     android::EmulatedCameraFactory::get_vendor_tag_ops,
 #endif
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
     open_legacy:            android::EmulatedCameraFactory::open_legacy
 #endif
 };
diff --git a/guest/hals/camera/EmulatedFakeCamera2.cpp b/guest/hals/camera/EmulatedFakeCamera2.cpp
index 2249ead..f6ebc66 100644
--- a/guest/hals/camera/EmulatedFakeCamera2.cpp
+++ b/guest/hals/camera/EmulatedFakeCamera2.cpp
@@ -20,7 +20,6 @@
  */
 
 #include <algorithm>
-#include <api_level_fixes.h>
 #include <AutoResources.h>
 #include <cstdint>
 #include <iterator>
@@ -29,6 +28,7 @@
 #define LOG_TAG "EmulatedCamera_FakeCamera2"
 #include <utils/Log.h>
 
+#include "guest/libs/platform_support/api_level_fixes.h"
 #include "EmulatedFakeCamera2.h"
 #include "EmulatedCameraFactory.h"
 #include "GrallocModule.h"
@@ -44,7 +44,7 @@
 const int64_t SEC = MSEC * 1000LL;
 
 const uint32_t EmulatedFakeCamera2::kAvailableFormats[] = {
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
         HAL_PIXEL_FORMAT_RAW16,
 #endif
         HAL_PIXEL_FORMAT_BLOB,
@@ -426,7 +426,7 @@
     const uint32_t *availableSizes;
     size_t availableSizeCount;
     switch (format) {
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
         case HAL_PIXEL_FORMAT_RAW16:
             availableSizes = &mAvailableRawSizes.front();
             availableSizeCount = mAvailableRawSizes.size();
@@ -460,7 +460,7 @@
     }
 
     switch (format) {
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
         case HAL_PIXEL_FORMAT_RAW16:
             if (mRawStreamCount >= kMaxRawStreamCount) {
                 ALOGE("%s: Cannot allocate another raw stream (%d already allocated)",
@@ -568,7 +568,7 @@
     }
 
     switch(mStreams.valueAt(streamIndex).format) {
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
         case HAL_PIXEL_FORMAT_RAW16:
             mRawStreamCount--;
             break;
@@ -1653,7 +1653,7 @@
     // disable all 3A
     if (mControlMode == ANDROID_CONTROL_MODE_OFF) {
         mEffectMode =   ANDROID_CONTROL_EFFECT_MODE_OFF;
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
         mSceneMode =    ANDROID_CONTROL_SCENE_MODE_DISABLED;
 #else
         mSceneMode =    ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED;
@@ -1678,7 +1678,7 @@
     res = find_camera_metadata_entry(request,
             ANDROID_CONTROL_SCENE_MODE,
             &mode);
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
     mSceneMode = READ_IF_OK(res, mode.data.u8[0],
                              ANDROID_CONTROL_SCENE_MODE_DISABLED);
 #else
@@ -2294,7 +2294,7 @@
     // android.control
 
     static const uint8_t availableSceneModes[] = {
-#if GCE_PLATFORM_SDK_AFTER(K)
+#if VSOC_PLATFORM_SDK_AFTER(K)
             ANDROID_CONTROL_SCENE_MODE_DISABLED
 #else
             ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED
diff --git a/guest/hals/camera/fake-pipeline2/Sensor.cpp b/guest/hals/camera/fake-pipeline2/Sensor.cpp
index fd229f3..4fd1293 100644
--- a/guest/hals/camera/fake-pipeline2/Sensor.cpp
+++ b/guest/hals/camera/fake-pipeline2/Sensor.cpp
@@ -30,10 +30,9 @@
 #include "Sensor.h"
 #include <cmath>
 #include <cstdlib>
-#include "api_level_fixes.h"
+#include "guest/libs/platform_support/api_level_fixes.h"
 #include "system/camera_metadata.h"
 
-
 namespace android {
 
 //const nsecs_t Sensor::kExposureTimeRange[2] =