aboutsummaryrefslogtreecommitdiff
path: root/camera/CameraWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'camera/CameraWrapper.cpp')
-rw-r--r--camera/CameraWrapper.cpp132
1 files changed, 0 insertions, 132 deletions
diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp
deleted file mode 100644
index c49ddf0..0000000
--- a/camera/CameraWrapper.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2017, The LineageOS Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_NDEBUG 0
-
-#define LOG_TAG "CameraWrapper"
-#include <cutils/log.h>
-
-#include "CameraWrapper.h"
-#include "Camera3Wrapper.h"
-
-static camera_module_t *gVendorModule = 0;
-static char prop[PROPERTY_VALUE_MAX];
-
-static int check_vendor_module()
-{
- int rv = 0;
- ALOGV("%s", __FUNCTION__);
-
- if(gVendorModule)
- return 0;
-
- rv = hw_get_module_by_class("camera", "vendor", (const hw_module_t **)&gVendorModule);
- if (rv)
- ALOGE("failed to open vendor camera module");
- return rv;
-}
-
-static struct hw_module_methods_t camera_module_methods = {
- .open = camera_device_open
-};
-
-camera_module_t HAL_MODULE_INFO_SYM = {
- .common = {
- .tag = HARDWARE_MODULE_TAG,
- .module_api_version = CAMERA_MODULE_API_VERSION_2_4,
- .hal_api_version = HARDWARE_HAL_API_VERSION,
- .id = CAMERA_HARDWARE_MODULE_ID,
- .name = "LineageOS Camera Wrapper",
- .author = "The LineageOS Project",
- .methods = &camera_module_methods,
- .dso = NULL,
- .reserved = {0},
- },
- .get_number_of_cameras = camera_get_number_of_cameras,
- .get_camera_info = camera_get_camera_info,
- .set_callbacks = camera_set_callbacks,
- .get_vendor_tag_ops = camera_get_vendor_tag_ops,
- .open_legacy = NULL,
- .set_torch_mode = camera_set_torch_mode,
- .init = NULL,
- .reserved = {0},
-};
-
-static int camera_device_open(const hw_module_t* module, const char* name,
- hw_device_t** device)
-{
- int rv = -EINVAL;
-
- property_get("persist.camera.HAL3.enabled", prop, "1");
- int isHAL3Enabled = atoi(prop);
-
- ALOGV("%s: property persist.camera.HAL3.enabled is set to %d", __FUNCTION__, isHAL3Enabled);
-
- if (name != NULL) {
- if (check_vendor_module())
- return -EINVAL;
-
- if (isHAL3Enabled) {
- ALOGV("%s: using HAL3", __FUNCTION__);
- rv = camera3_device_open(module, name, device);
- } else {
- ALOGV("%s: Only HAL3 is supported", __FUNCTION__);
- return -EINVAL;
- }
- }
-
- return rv;
-}
-
-static int camera_get_number_of_cameras(void)
-{
- ALOGV("%s", __FUNCTION__);
- if (check_vendor_module())
- return 0;
- return gVendorModule->get_number_of_cameras();
-}
-
-static int camera_get_camera_info(int camera_id, struct camera_info *info)
-{
- ALOGV("%s", __FUNCTION__);
- if (check_vendor_module())
- return 0;
- return gVendorModule->get_camera_info(camera_id, info);
-}
-
-static int camera_set_callbacks(const camera_module_callbacks_t *callbacks)
-{
- ALOGV("%s", __FUNCTION__);
- if (check_vendor_module())
- return 0;
- return gVendorModule->set_callbacks(callbacks);
-}
-
-static void camera_get_vendor_tag_ops(vendor_tag_ops_t* ops)
-{
- ALOGV("%s", __FUNCTION__);
- if (check_vendor_module())
- return;
- return gVendorModule->get_vendor_tag_ops(ops);
-}
-
-static int camera_set_torch_mode(const char* camera_id, bool on)
-{
- ALOGV("%s", __FUNCTION__);
- if (check_vendor_module())
- return -EINVAL;
- return gVendorModule->set_torch_mode(camera_id, on);
-}