diff --git a/universal7885-common/libshims/camera/Android.bp b/universal7885-common/libshims/camera/Android.bp new file mode 100644 index 0000000..4f2001d --- /dev/null +++ b/universal7885-common/libshims/camera/Android.bp @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2022 Eureka Team. +* https://github.com/eurekadevelopment +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +cc_library_shared { + name: "libcorrectcamera", + defaults: ["hidl_defaults"], + proprietary: true, + srcs: [ + "CorrectCameraID.cpp", + ], + shared_libs: [ + "libhidlbase", + "libhardware", + "camera.device@3.2-impl", + "libcamera_metadata", + "android.hardware.camera.device@3.2", + "android.hardware.camera.provider@2.4", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", + "liblog", + "libutils", + "libcutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], +} diff --git a/universal7885-common/libshims/camera/CorrectCameraID.cpp b/universal7885-common/libshims/camera/CorrectCameraID.cpp new file mode 100644 index 0000000..ac0f6f8 --- /dev/null +++ b/universal7885-common/libshims/camera/CorrectCameraID.cpp @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2022 Eureka Team. +* https://github.com/eurekadevelopment +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +#include "CameraDevice_3_2.h" +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace V3_2 { +namespace implementation { + +using ::android::hardware::camera::common::V1_0::Status; + +Return CameraDevice::getCameraCharacteristics(ICameraDevice::getCameraCharacteristics_cb _hidl_cb) { + Status status = initStatus(); + CameraMetadata cameraCharacteristics; + if (status == Status::OK) { + //Module 2.1+ codepath. + struct camera_info info; + if (mCameraIdInt == 2) mCameraIdInt = 1; + int ret = mModule->getCameraInfo(mCameraIdInt, &info); + if (ret == OK) { + convertToHidl(info.static_camera_characteristics, &cameraCharacteristics); + } else { + ALOGE("%s: get camera info failed!", __FUNCTION__); + status = Status::INTERNAL_ERROR; + } + } + _hidl_cb(status, cameraCharacteristics); + return Void(); +} + +} // namespace implementation +} // namespace V3_2 +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/universal7885-common/universal7885-common.mk b/universal7885-common/universal7885-common.mk index 3caf323..241afad 100644 --- a/universal7885-common/universal7885-common.mk +++ b/universal7885-common/universal7885-common.mk @@ -283,7 +283,8 @@ PRODUCT_PACKAGES += \ # Shims PRODUCT_PACKAGES += \ - libshim_sensorndkbridge + libshim_sensorndkbridge \ + libcorrectcamera # Skip Mount PRODUCT_PACKAGES += \