universal7885: Add libcorrectcamera shim

* Supposed to map camera ID 2's info to camera ID 1

Change-Id: I154b0a3357ac689530f53dbf4d251aa7f60c6a2f
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2022-02-23 17:12:30 +09:00
commit e9d83bf897
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
3 changed files with 85 additions and 1 deletions

View file

@ -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",
],
}

View file

@ -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/convert.h>
#include <log/log.h>
namespace android {
namespace hardware {
namespace camera {
namespace device {
namespace V3_2 {
namespace implementation {
using ::android::hardware::camera::common::V1_0::Status;
Return<void> 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

View file

@ -283,7 +283,8 @@ PRODUCT_PACKAGES += \
# Shims
PRODUCT_PACKAGES += \
libshim_sensorndkbridge
libshim_sensorndkbridge \
libcorrectcamera
# Skip Mount
PRODUCT_PACKAGES += \