From 8b91dd9b0ad290a4d9412ea86bfc29fa34813a50 Mon Sep 17 00:00:00 2001 From: chenminghui Date: Thu, 12 Sep 2024 16:05:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=8F=B7=EF=BC=9A#IAQVLE=20=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0:distributed=5Fcamera=E8=A7=A3=E8=80=A6device=5Fsecuri?= =?UTF-8?q?ty=5Flevel=20=E9=97=AE=E9=A2=98=E6=A0=B9=E5=9B=A0=EF=BC=9Adistr?= =?UTF-8?q?ibuted=5Fcamera=E8=A7=A3=E8=80=A6device=5Fsecurity=5Flevel=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88=EF=BC=9A=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=8E=A7=E5=88=B6=E5=AE=8F=E8=A7=A3=E8=80=A6?= =?UTF-8?q?device=5Fsecurity=5Flevel=20=E6=98=AF=E5=90=A6=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=8F=98=E6=88=90=E8=A7=84=E8=8C=83=E8=87=AA=E6=A3=80?= =?UTF-8?q?=EF=BC=9AY=20=E6=98=AF=E5=90=A6=E7=BC=96=E8=AF=91=E4=B8=94?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E9=80=9A=E8=BF=87=EF=BC=9AY=20=E5=BD=B1?= =?UTF-8?q?=E5=93=8D=E7=9A=84=E8=AE=BE=E5=A4=87=E4=B8=8E=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=EF=BC=9Ark3568?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenminghui Change-Id: If354e4359f0d90ec1601a8de07ec2faecf16816f --- distributedcamera.gni | 6 ++++++ services/cameraservice/sinkservice/BUILD.gn | 6 +++++- .../src/distributedcameramgr/dcamera_sink_controller.cpp | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/distributedcamera.gni b/distributedcamera.gni index 650ce0ac..598cd8c8 100644 --- a/distributedcamera.gni +++ b/distributedcamera.gni @@ -42,4 +42,10 @@ build_flags = [ "-Werror" ] declare_args() { distributed_camera_common = true + device_security_level_camera = true + + if (defined(global_parts_info) && + !defined(global_parts_info.security_device_security_level)) { + device_security_level_camera = false + } } diff --git a/services/cameraservice/sinkservice/BUILD.gn b/services/cameraservice/sinkservice/BUILD.gn index 441ac3f4..fdf1276a 100644 --- a/services/cameraservice/sinkservice/BUILD.gn +++ b/services/cameraservice/sinkservice/BUILD.gn @@ -106,7 +106,6 @@ ohos_shared_library("distributed_camera_sink") { "c_utils:utils", "camera_framework:camera_framework", "device_manager:devicemanagersdk", - "device_security_level:dslm_sdk", "distributed_hardware_fwk:distributed_av_receiver", "distributed_hardware_fwk:distributedhardwareutils", "drivers_interface_camera:metadata", @@ -122,6 +121,11 @@ ohos_shared_library("distributed_camera_sink") { "samgr:samgr_proxy", ] + if (device_security_level_camera) { + external_deps += [ "device_security_level:dslm_sdk" ] + defines += [ "DEVICE_SECURITY_LEVEL_ENABLE" ] + } + subsystem_name = "distributedhardware" part_name = "distributed_camera" diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index 7b258cc9..d883992d 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -34,8 +34,10 @@ #include "distributed_camera_constants.h" #include "distributed_camera_errno.h" #include "distributed_hardware_log.h" +#ifdef DEVICE_SECURITY_LEVEL_ENABLE #include "device_security_defines.h" #include "device_security_info.h" +#endif #include "idistributed_camera_source.h" #include "ipc_skeleton.h" #include "dcamera_low_latency.h" @@ -686,6 +688,7 @@ bool DCameraSinkController::CheckDeviceSecurityLevel(const std::string &srcDevic int32_t DCameraSinkController::GetDeviceSecurityLevel(const std::string &udid) { + #ifdef DEVICE_SECURITY_LEVEL_ENABLE DeviceIdentify devIdentify; devIdentify.length = DEVICE_ID_MAX_LEN; int32_t ret = memcpy_s(devIdentify.identity, DEVICE_ID_MAX_LEN, udid.c_str(), DEVICE_ID_MAX_LEN); @@ -701,7 +704,9 @@ int32_t DCameraSinkController::GetDeviceSecurityLevel(const std::string &udid) info = nullptr; return DEFAULT_DEVICE_SECURITY_LEVEL; } + #endif int32_t level = 0; + #ifdef DEVICE_SECURITY_LEVEL_ENABLE ret = GetDeviceSecurityLevelValue(info, &level); DHLOGD("Get device security level, level is %{public}d", level); FreeDeviceSecurityInfo(info); @@ -710,6 +715,7 @@ int32_t DCameraSinkController::GetDeviceSecurityLevel(const std::string &udid) DHLOGE("Get device security level failed %{public}d", ret); return DEFAULT_DEVICE_SECURITY_LEVEL; } + #endif return level; } -- Gitee