mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Move CameraParameters class to android.hardware.camera.common@1.0-helper
The CameraParamters class is widely used by many of the camera-related vendor libs. However, they have been using the class from the libcamera_client.so which is not a VNDK library. By moving the class to the common@1.0-helper, which is available to vendors, we can eliminate the dependency to libcamera_client.so from the vendor libs. Bug: 62523241 Test: 2016/2017 Pixel devices build and boots. Camera functionalities work. Change-Id: I3f69f1591663390c050d1e75ac2957d3ecc38ba7
This commit is contained in:
@@ -5,6 +5,7 @@ cc_library_static {
|
||||
srcs: [
|
||||
"CameraModule.cpp",
|
||||
"CameraMetadata.cpp",
|
||||
"CameraParameters.cpp",
|
||||
"VendorTagDescriptor.cpp",
|
||||
"HandleImporter.cpp"],
|
||||
cflags: [
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
#include <system/graphics.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace common {
|
||||
namespace V1_0 {
|
||||
namespace helper {
|
||||
|
||||
// Parameter keys to communicate between camera application and driver.
|
||||
const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size";
|
||||
const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values";
|
||||
@@ -534,4 +540,9 @@ bool CameraParameters::isEmpty() const {
|
||||
return mMap.isEmpty();
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}; // namespace android
|
||||
@@ -21,6 +21,11 @@
|
||||
#include <utils/String8.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace common {
|
||||
namespace V1_0 {
|
||||
namespace helper {
|
||||
|
||||
struct Size {
|
||||
int width;
|
||||
@@ -694,6 +699,11 @@ private:
|
||||
DefaultKeyedVector<String8,String8> mMap;
|
||||
};
|
||||
|
||||
}; // namespace android
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}; // namespace
|
||||
|
||||
#endif
|
||||
@@ -17,8 +17,7 @@
|
||||
cc_test {
|
||||
name: "VtsHalCameraProviderV2_4TargetTest",
|
||||
defaults: ["hidl_defaults"],
|
||||
srcs: ["VtsHalCameraProviderV2_4TargetTest.cpp",
|
||||
"CameraParameters.cpp" ],
|
||||
srcs: ["VtsHalCameraProviderV2_4TargetTest.cpp"],
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libhidlbase",
|
||||
@@ -33,7 +32,11 @@ cc_test {
|
||||
"libgui",
|
||||
"libui"
|
||||
],
|
||||
static_libs: ["VtsHalHidlTargetTestBase", "libgrallocusage"],
|
||||
static_libs: [
|
||||
"VtsHalHidlTargetTestBase",
|
||||
"libgrallocusage",
|
||||
"android.hardware.camera.common@1.0-helper",
|
||||
],
|
||||
cflags: [
|
||||
"-O0",
|
||||
"-g",
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <mutex>
|
||||
#include <regex>
|
||||
#include <unordered_map>
|
||||
#include "CameraParameters.h"
|
||||
#include <CameraParameters.h>
|
||||
#include "system/camera_metadata.h"
|
||||
|
||||
using ::android::hardware::Return;
|
||||
@@ -52,13 +52,14 @@ using ::android::IGraphicBufferConsumer;
|
||||
using ::android::BufferQueue;
|
||||
using ::android::BufferItemConsumer;
|
||||
using ::android::Surface;
|
||||
using ::android::CameraParameters;
|
||||
using ::android::hardware::graphics::common::V1_0::BufferUsage;
|
||||
using ::android::hardware::graphics::common::V1_0::PixelFormat;
|
||||
using ::android::hardware::camera::common::V1_0::Status;
|
||||
using ::android::hardware::camera::common::V1_0::CameraDeviceStatus;
|
||||
using ::android::hardware::camera::common::V1_0::TorchMode;
|
||||
using ::android::hardware::camera::common::V1_0::TorchModeStatus;
|
||||
using ::android::hardware::camera::common::V1_0::helper::CameraParameters;
|
||||
using ::android::hardware::camera::common::V1_0::helper::Size;
|
||||
using ::android::hardware::camera::provider::V2_4::ICameraProvider;
|
||||
using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
|
||||
using ::android::hardware::camera::device::V3_2::ICameraDevice;
|
||||
@@ -564,7 +565,7 @@ public:
|
||||
const std::vector<AvailableStream> &streamSizes,
|
||||
int32_t format, AvailableStream &result);
|
||||
static Status isAutoFocusModeAvailable(
|
||||
::android::CameraParameters &cameraParams, const char *mode) ;
|
||||
CameraParameters &cameraParams, const char *mode) ;
|
||||
|
||||
protected:
|
||||
std::mutex mLock; // Synchronize access to member variables
|
||||
@@ -1333,7 +1334,7 @@ TEST_F(CameraHidlTest, autoFocus) {
|
||||
openCameraDevice(name, env, &device1 /*out*/);
|
||||
ASSERT_NE(nullptr, device1.get());
|
||||
|
||||
::android::CameraParameters cameraParams;
|
||||
CameraParameters cameraParams;
|
||||
getParameters(device1, &cameraParams /*out*/);
|
||||
|
||||
if (Status::OK != isAutoFocusModeAvailable(cameraParams,
|
||||
@@ -1395,7 +1396,7 @@ TEST_F(CameraHidlTest, cancelAutoFocus) {
|
||||
openCameraDevice(name, env, &device1 /*out*/);
|
||||
ASSERT_NE(nullptr, device1.get());
|
||||
|
||||
::android::CameraParameters cameraParams;
|
||||
CameraParameters cameraParams;
|
||||
getParameters(device1, &cameraParams /*out*/);
|
||||
|
||||
if (Status::OK != isAutoFocusModeAvailable(cameraParams,
|
||||
@@ -1443,7 +1444,7 @@ TEST_F(CameraHidlTest, sendCommandFaceDetection) {
|
||||
openCameraDevice(name, env, &device1 /*out*/);
|
||||
ASSERT_NE(nullptr, device1.get());
|
||||
|
||||
::android::CameraParameters cameraParams;
|
||||
CameraParameters cameraParams;
|
||||
getParameters(device1, &cameraParams /*out*/);
|
||||
|
||||
int32_t hwFaces = cameraParams.getInt(
|
||||
@@ -1506,7 +1507,7 @@ TEST_F(CameraHidlTest, sendCommandSmoothZoom) {
|
||||
openCameraDevice(name, env, &device1 /*out*/);
|
||||
ASSERT_NE(nullptr, device1.get());
|
||||
|
||||
::android::CameraParameters cameraParams;
|
||||
CameraParameters cameraParams;
|
||||
getParameters(device1, &cameraParams /*out*/);
|
||||
|
||||
const char *smoothZoomStr = cameraParams.get(
|
||||
@@ -1557,7 +1558,7 @@ TEST_F(CameraHidlTest, getSetParameters) {
|
||||
openCameraDevice(name, env, &device1 /*out*/);
|
||||
ASSERT_NE(nullptr, device1.get());
|
||||
|
||||
::android::CameraParameters cameraParams;
|
||||
CameraParameters cameraParams;
|
||||
getParameters(device1, &cameraParams /*out*/);
|
||||
|
||||
int32_t width, height;
|
||||
@@ -1587,10 +1588,10 @@ TEST_F(CameraHidlTest, getSetParameters) {
|
||||
ASSERT_TRUE((nullptr == effect) || (strcmp(
|
||||
CameraParameters::EFFECT_NONE, effect) == 0));
|
||||
|
||||
::android::Vector<::android::Size> previewSizes;
|
||||
::android::Vector<Size> previewSizes;
|
||||
cameraParams.getSupportedPreviewSizes(previewSizes);
|
||||
ASSERT_FALSE(previewSizes.empty());
|
||||
::android::Vector<::android::Size> pictureSizes;
|
||||
::android::Vector<Size> pictureSizes;
|
||||
cameraParams.getSupportedPictureSizes(pictureSizes);
|
||||
ASSERT_FALSE(pictureSizes.empty());
|
||||
const char *previewFormats = cameraParams.get(
|
||||
@@ -3001,7 +3002,7 @@ Status CameraHidlTest::findLargestSize(
|
||||
|
||||
// Check whether the camera device supports specific focus mode.
|
||||
Status CameraHidlTest::isAutoFocusModeAvailable(
|
||||
::android::CameraParameters &cameraParams,
|
||||
CameraParameters &cameraParams,
|
||||
const char *mode) {
|
||||
::android::String8 focusModes(cameraParams.get(
|
||||
CameraParameters::KEY_SUPPORTED_FOCUS_MODES));
|
||||
|
||||
Reference in New Issue
Block a user