• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2025 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("./../../multimedia_camera_framework.gni")
16
17ohos_shared_library("camera_service") {
18  branch_protector_ret = "pac_ret"
19  install_enable = true
20  sources = [
21    "${multimedia_camera_framework_path}/frameworks/native/camera/base/src/ability/camera_ability_parse_util.cpp",
22    "${multimedia_camera_framework_path}/frameworks/native/camera/base/src/output/camera_photo_proxy.cpp",
23    "${multimedia_camera_framework_path}/dynamic_libs/moving_photo/src/moving_photo_surface_wrapper.cpp",
24    "${multimedia_camera_framework_path}/dynamic_libs/moving_photo/src/common/frame_record.cpp",
25    "binder/client/src/hcamera_listener_proxy.cpp",
26    "binder/client/src/window_manager_service_proxy_impl/hcamera_mock_session_manager_interface_proxy.cpp",
27    "binder/client/src/window_manager_service_proxy_impl/hcamera_scene_session_manager_proxy.cpp",
28    "binder/client/src/window_manager_service_proxy_impl/hcamera_window_session_manager_service_proxy.cpp",
29    "binder/server/src/hcamera_broker_stub.cpp",
30    "binder/server/src/window_manager_service_callback_stub_impl/hcamera_window_manager_callback_stub.cpp",
31    "src/adapter/bms_adapter.cpp",
32    "src/app_manager_utils/camera_app_manager_client.cpp",
33    "src/app_manager_utils/camera_app_manager_utils.cpp",
34    "src/camera_buffer_manager/photo_asset_auxiliary_consumer.cpp",
35    "src/camera_buffer_manager/photo_asset_buffer_consumer.cpp",
36    "src/camera_buffer_manager/photo_buffer_consumer.cpp",
37    "src/camera_buffer_manager/picture_assembler.cpp",
38    "src/camera_buffer_manager/thumbnail_buffer_consumer.cpp",
39    "src/camera_common_event_manager.cpp",
40    "src/camera_datashare_helper.cpp",
41    "src/camera_fwk_metadata_utils.cpp",
42    "src/camera_info_dumper.cpp",
43    "src/camera_privacy.cpp",
44    "src/camera_rotate_strategy_parser.cpp",
45    "src/camera_sensor_plugin.cpp",
46    "src/camera_server_photo_proxy.cpp",
47    "src/camera_util.cpp",
48    "src/camera_xml_parser.cpp",
49    "src/device_protection_ability_connection.cpp",
50    "src/dfx/camera_report_dfx_uitls.cpp",
51    "src/dfx/camera_report_uitls.cpp",
52    "src/hcamera_device.cpp",
53    "src/hcamera_device_manager.cpp",
54    "src/hcamera_host_manager.cpp",
55    "src/hcamera_preconfig.cpp",
56    "src/hcamera_restore_param.cpp",
57    "src/hcamera_service.cpp",
58    "src/hcamera_session_manager.cpp",
59    "src/hcapture_session.cpp",
60    "src/hmech_session.cpp",
61    "src/hstream_capture.cpp",
62    "src/hstream_common.cpp",
63    "src/hstream_depth_data.cpp",
64    "src/hstream_metadata.cpp",
65    "src/hstream_operator.cpp",
66    "src/hstream_operator_manager.cpp",
67    "src/hstream_repeat.cpp",
68    "src/param_update/camera_rotate_param_manager.cpp",
69    "src/param_update/camera_rotate_param_reader.cpp",
70    "src/param_update/camera_rotate_param_sign_tools.cpp",
71    "src/smooth_zoom/cubic_bezier.cpp",
72    "src/smooth_zoom/smooth_zoom.cpp",
73    "src/window_manager_utils/camera_window_manager_agent.cpp",
74    "src/window_manager_utils/camera_window_manager_client.cpp",
75    "src/camera_dialog_connection.cpp",
76    "src/camera_dialog_manager.cpp",
77  ]
78  cflags = [
79    "-fPIC",
80    "-Wall",
81    "-Os",
82    "-fstack-protector-strong",
83    "-fno-merge-all-constants",
84    "-flto",
85    "-ffunction-sections"
86  ]
87
88  ldflags = [
89    "-Wl,-z,relro,-z,now",
90    "-Wl,--gc-sections",
91    "-fPIE",
92  ]
93
94  if (!fwk_no_hidden && !use_clang_coverage && !use_libfuzzer && using_hb_new) {
95    cflags += [ "-fvisibility=hidden" ]
96  }
97
98  stack_protector_ret = true
99
100  sanitize = {
101    boundary_sanitize = true  # Enable boundary san detection
102    cfi = true  # Enable/disable control flow integrity detection
103    cfi_cross_dso = true  # Cross-SO CFI Checks
104    debug = false
105    integer_overflow = true  # Enable integer overflow detection
106    ubsan = true  # Enable some Ubsan
107    blocklist = "./camera_cfi_blocklist.txt"
108  }
109
110  include_dirs = [
111    "${multimedia_camera_framework_path}/services/camera_service/include",
112    "${multimedia_camera_framework_path}/common/utils",
113    "${multimedia_camera_framework_path}/dynamic_libs/moving_photo/include",
114    "${multimedia_camera_framework_path}/dynamic_libs/moving_photo/include/avcodec",
115    "${multimedia_camera_framework_path}/dynamic_libs/moving_photo/include/common",
116    "${multimedia_camera_framework_path}/services/camera_service/binder/base/include/window_manager_service_utils",
117    "${multimedia_camera_framework_path}/services/camera_service/binder/client/include/window_manager_service_proxy",
118    "${multimedia_camera_framework_path}/services/camera_service/binder/server/include/window_manager_service_callback_stub",
119    "${multimedia_camera_framework_path}/services/camera_service/include/adapter",
120    "${multimedia_camera_framework_path}/services/camera_service/include/app_manager_utils",
121    "${multimedia_camera_framework_path}/services/camera_service/include/camera_buffer_manager",
122    "${multimedia_camera_framework_path}/services/camera_service/include/dfx",
123    "${multimedia_camera_framework_path}/services/camera_service/include/smooth_zoom",
124    "${multimedia_camera_framework_path}/services/camera_service/include/param_update",
125    "${multimedia_camera_framework_path}/services/camera_service/include/window_manager_utils",
126    "${multimedia_camera_framework_path}/services/camera_service/binder/base/include",
127    "${multimedia_camera_framework_path}/services/camera_service/binder/client/include",
128    "${multimedia_camera_framework_path}/services/camera_service/binder/server/include",
129    "${multimedia_camera_framework_path}/interfaces/inner_api/native/camera/include",
130    "${multimedia_camera_framework_path}/interfaces/inner_api/native/camera/include/utils/",
131    "${multimedia_camera_framework_path}/services/deferred_processing_service/include",
132    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base",
133    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base/task_manager",
134    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base/task_manager/task_group",
135    "${multimedia_camera_framework_path}/services/deferred_processing_service/binder/base/include",
136    "${multimedia_camera_framework_path}/services/deferred_processing_service/binder/client/include",
137    "${multimedia_camera_framework_path}/services/deferred_processing_service/binder/server/include",
138    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/base/buffer_manager",
139    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/dfx",
140    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/event_monitor",
141    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/post_processor",
142    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/post_processor/command",
143    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule",
144    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule/base",
145    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule/state",
146    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule/photo_processor",
147    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule/photo_processor/photo_job_repository",
148    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule/photo_processor/strategy",
149    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule/video_processor",
150    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule/video_processor/strategy",
151    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/schedule/video_processor/video_job_repository",
152    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/session",
153    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/session/photo_session",
154    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/session/video_session",
155    "${multimedia_camera_framework_path}/services/deferred_processing_service/include/utils",
156  ]
157
158  if (target_cpu == "arm") {
159    cflags += [ "-DBINDER_IPC_32BIT" ]
160  }
161  if (build_variant == "user") {
162    cflags += [ "-DIS_RELEASE_VERSION" ]
163  }
164
165  public_configs = [ "${multimedia_camera_framework_path}/services/camera_service/idls:camera_sa_idl_config" ]
166
167  deps = [
168    "${multimedia_camera_framework_path}/common:camera_utils",
169    "${multimedia_camera_framework_path}/services/deferred_processing_service:deferred_processing_service",
170    "${multimedia_camera_framework_path}/services/camera_service/idls:camera_idl_sa_stub"
171  ]
172
173  external_deps = [
174    "ability_base:base",
175    "ability_base:want",
176    "ability_base:zuri",
177    "ability_runtime:ability_connect_callback_stub",
178    "ability_runtime:app_manager",
179    "ability_runtime:extension_manager",
180    "ability_runtime:ability_manager",
181    "access_token:libaccesstoken_sdk",
182    "access_token:libprivacy_sdk",
183    "access_token:libtokenid_sdk",
184    "access_token:libtokensetproc_shared",
185    "av_codec:native_media_acodec",
186    "av_codec:native_media_aenc",
187    "av_codec:native_media_avcencinfo",
188    "av_codec:native_media_avmuxer",
189    "av_codec:native_media_codecbase",
190    "av_codec:native_media_venc",
191    "bundle_framework:appexecfwk_base",
192    "bundle_framework:appexecfwk_core",
193    "c_utils:utils",
194    "common_event_service:cesfwk_innerkits",
195    "data_share:datashare_common",
196    "data_share:datashare_consumer",
197    "drivers_interface_camera:libbuffer_handle_sequenceable_1.0",
198    "drivers_interface_camera:libcamera_proxy_1.0",
199    "drivers_interface_camera:libcamera_proxy_1.1",
200    "drivers_interface_camera:libcamera_proxy_1.2",
201    "drivers_interface_camera:libcamera_proxy_1.3",
202    "drivers_interface_camera:libcamera_proxy_1.4",
203    "drivers_interface_camera:libmap_data_sequenceable_1.0",
204    "drivers_interface_camera:metadata",
205    "drivers_interface_display:libdisplay_commontype_proxy_1.0",
206    "drivers_interface_display:libdisplay_composer_hdi_impl_1.3",
207    "e2fsprogs:libext2_uuid",
208    "graphic_2d:librender_service_client",
209    "graphic_surface:buffer_handle",
210    "graphic_surface:surface",
211    "graphic_surface:sync_fence",
212    "hdf_core:libhdi",
213    "hilog:libhilog",
214    "hisysevent:libhisysevent",
215    "hitrace:hitrace_meter",
216    "i18n:intl_util",
217    "init:libbegetutil",
218    "ipc:ipc_core",
219    "ipc:ipc_single",
220    "libxml2:libxml2",
221    "media_foundation:native_media_core",
222    "media_library:media_library",
223    "memmgr:memmgrclient",
224    "openssl:libcrypto_shared",
225    "os_account:libaccountkits",
226    "os_account:os_account_innerkits",
227    "resource_schedule_service:ressched_client",
228    "safwk:system_ability_fwk",
229    "samgr:samgr_proxy",
230    "window_manager:libdm",
231    "window_manager:libwm",
232  ]
233
234  defines = []
235  if (use_sensor) {
236    external_deps += [ "sensor:sensor_interface_native" ]
237    defines += [ "CAMERA_USE_SENSOR" ]
238  }
239
240  if (defined(global_parts_info) &&
241      defined(global_parts_info.distributedhardware_device_manager)) {
242    external_deps += [ "device_manager:devicemanagersdk" ]
243    defines += [ "DEVICE_MANAGER" ]
244  }
245
246  if (defined(global_parts_info) &&
247      defined(global_parts_info.resourceschedule_memmgr_override)) {
248    defines += [ "MEMMGR_OVERRID" ]
249  }
250
251  if (hicollie_enable) {
252    external_deps += [ "hicollie:libhicollie" ]
253    defines += [ "HICOLLIE_ENABLE" ]
254  }
255
256  if (defined(global_parts_info) &&
257      defined(
258          global_parts_info.notification_distributed_notification_service)) {
259    external_deps += [ "distributed_notification_service:ans_innerkits" ]
260    defines += [ "NOTIFICATION_ENABLE" ]
261    sources += [ "src/camera_beauty_notification.cpp" ]
262  }
263
264  if (config_policy_ext_enable) {
265    defines += [ "CONFIG_POLICY_EXT_ENABLE" ]
266  }
267
268  defines += [ "MOVING_PHOTO_ADD_AUDIO" ]
269
270  if (use_musl) {
271    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
272      cflags += [ "-DCONFIG_USE_JEMALLOC_DFX_INTF" ]
273    }
274  }
275
276  if (camera_framework_feature_camera_rotate_plugin) {
277    defines += [ "HOOK_CAMERA_OPERATOR"]
278    sources += [  "src/rotate_plugin/camera_rotate_plugin.cpp"]
279    include_dirs += ["${multimedia_camera_framework_path}/services/camera_service/include/rotate_plugin"]
280  }
281
282  cflags_cc = cflags
283
284  part_name = "camera_framework"
285  subsystem_name = "multimedia"
286}
287