modules: camera: add vendor tag functionality

Vendor Tag operations were added in module api v2.2

Change-Id: I352a50759d8bb9389d904bb774659e4be883794b
diff --git a/modules/camera/CameraHAL.cpp b/modules/camera/CameraHAL.cpp
index 9a13c98..148f99c 100644
--- a/modules/camera/CameraHAL.cpp
+++ b/modules/camera/CameraHAL.cpp
@@ -18,6 +18,7 @@
 #include <hardware/camera_common.h>
 #include <hardware/hardware.h>
 #include "ExampleCamera.h"
+#include "VendorTags.h"
 
 //#define LOG_NDEBUG 0
 #define LOG_TAG "DefaultCameraHAL"
@@ -38,6 +39,8 @@
 
 // Default Camera HAL has 2 cameras, front and rear.
 static CameraHAL gCameraHAL(2);
+// Handle containing vendor tag functionality
+static VendorTags gVendorTags;
 
 CameraHAL::CameraHAL(int num_cameras)
   : mNumberOfCameras(num_cameras),
@@ -121,6 +124,41 @@
     return gCameraHAL.setCallbacks(callbacks);
 }
 
+static int get_tag_count(const vendor_tag_ops_t* ops)
+{
+    return gVendorTags.getTagCount(ops);
+}
+
+static void get_all_tags(const vendor_tag_ops_t* ops, uint32_t* tag_array)
+{
+    gVendorTags.getAllTags(ops, tag_array);
+}
+
+static const char* get_section_name(const vendor_tag_ops_t* ops, uint32_t tag)
+{
+    return gVendorTags.getSectionName(ops, tag);
+}
+
+static const char* get_tag_name(const vendor_tag_ops_t* ops, uint32_t tag)
+{
+    return gVendorTags.getTagName(ops, tag);
+}
+
+static int get_tag_type(const vendor_tag_ops_t* ops, uint32_t tag)
+{
+    return gVendorTags.getTagType(ops, tag);
+}
+
+static void get_vendor_tag_ops(vendor_tag_ops_t* ops)
+{
+    ALOGV("%s : ops=%p", __func__, ops);
+    ops->get_tag_count      = get_tag_count;
+    ops->get_all_tags       = get_all_tags;
+    ops->get_section_name   = get_section_name;
+    ops->get_tag_name       = get_tag_name;
+    ops->get_tag_type       = get_tag_type;
+}
+
 static int open_dev(const hw_module_t* mod, const char* name, hw_device_t** dev)
 {
     return gCameraHAL.open(mod, name, dev);
@@ -133,7 +171,7 @@
 camera_module_t HAL_MODULE_INFO_SYM __attribute__ ((visibility("default"))) = {
     common : {
         tag                : HARDWARE_MODULE_TAG,
-        module_api_version : CAMERA_MODULE_API_VERSION_2_0,
+        module_api_version : CAMERA_MODULE_API_VERSION_2_2,
         hal_api_version    : HARDWARE_HAL_API_VERSION,
         id                 : CAMERA_HARDWARE_MODULE_ID,
         name               : "Default Camera HAL",
@@ -144,7 +182,8 @@
     },
     get_number_of_cameras : get_number_of_cameras,
     get_camera_info       : get_camera_info,
-    set_callbacks         : set_callbacks
+    set_callbacks         : set_callbacks,
+    get_vendor_tag_ops    : get_vendor_tag_ops
 };
 } // extern "C"