diff --git a/distributedcamera.gni b/distributedcamera.gni index 650ce0ac64ebb2c832078a052192d2e3b33c2a6c..598cd8c84714f7506c77867674d3c6020a66fb70 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 af190f2d9a9e8d67cda9a610ffd186429e87b8b3..6cc0b1574d92265f8ec854bed4619e891f3f530c 100644 --- a/services/cameraservice/sinkservice/BUILD.gn +++ b/services/cameraservice/sinkservice/BUILD.gn @@ -129,7 +129,6 @@ ohos_shared_library("distributed_camera_sink") { "c_utils:utils", "camera_framework:camera_framework", "device_manager:devicemanagersdk", - "device_security_level:dslm_sdk", "drivers_interface_distributed_camera:libdistributed_camera_provider_proxy_1.0", "drivers_peripheral_display:hdi_gralloc_client", "eventhandler:libeventhandler", @@ -139,6 +138,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 97211e5d7e1b15e4bc1e01424c81cb48d34e531c..693eaf2c4f845c49f408c68a5aaea012a62c9498 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 "json/json.h" @@ -643,6 +645,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); @@ -658,7 +661,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 %d", level); FreeDeviceSecurityInfo(info); @@ -667,6 +672,7 @@ int32_t DCameraSinkController::GetDeviceSecurityLevel(const std::string &udid) DHLOGE("Get device security level failed %d", ret); return DEFAULT_DEVICE_SECURITY_LEVEL; } + #endif return level; }