diff --git a/bundle.json b/bundle.json index f594c8677b9d62ff390a4e400f1864bc68961b6c..4d2f156934a69f8c535b99633854aff02964c740 100644 --- a/bundle.json +++ b/bundle.json @@ -16,7 +16,8 @@ "subsystem": "distributedhardware", "syscap": [], "features": [ - "distributed_camera_common" + "distributed_camera_common", + "distributed_camera_filter_front" ], "adapted_system_type": [ "standard" diff --git a/distributedcamera.gni b/distributedcamera.gni index 40b0b515824e3a84d033cdc0d8a0de3442bc291e..0b3ebc4830d4cd796e27448361b7cffaad40d740 100644 --- a/distributedcamera.gni +++ b/distributedcamera.gni @@ -44,6 +44,7 @@ build_flags = [ "-Werror" ] declare_args() { distributed_camera_common = true device_security_level_camera = true + distributed_camera_filter_front = false if (defined(global_parts_info) && !defined(global_parts_info.security_device_security_level)) { diff --git a/services/cameraservice/cameraoperator/handler/BUILD.gn b/services/cameraservice/cameraoperator/handler/BUILD.gn index cdcac506162f571b18df7812315b941134d2201d..3f7074327a85e0fd9b1962e7781d6ea0130b37ab 100644 --- a/services/cameraservice/cameraoperator/handler/BUILD.gn +++ b/services/cameraservice/cameraoperator/handler/BUILD.gn @@ -54,6 +54,10 @@ ohos_shared_library("distributed_camera_handler") { "LOG_DOMAIN=0xD004150", ] + if (distributed_camera_filter_front) { + cflags = [ "-DDCAMERA_FRONT" ] + } + external_deps = [ "av_codec:av_codec_client", "cJSON:cjson", diff --git a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp index 248be2c1a89e74abb075a7ddedfbf024bae0a44c..e7a922b66faac44ae14fd69740b1eb32141a7446 100644 --- a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp +++ b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp @@ -96,6 +96,13 @@ std::vector DCameraHandler::Query() DHLOGI("connection type: %{public}d", info->GetConnectionType()); continue; } +#ifdef DCAMERA_FRONT + std::string position = GetCameraPosition(info->GetPosition()); + if (position != CAMERA_POSITION_FRONT) { + DHLOGI("filter camera position is: %{public}s", position.c_str()); + continue; + } +#endif DHLOGI("get %{public}s, position: %{public}d, cameraType: %{public}d", GetAnonyString(info->GetID()).c_str(), info->GetPosition(), info->GetCameraType()); DHItem item;