# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("./../sensor.gni") ohos_shared_library("libsensor_service") { sources = [ "src/client_info.cpp", "src/fifo_cache_data.cpp", "src/flush_info_record.cpp", "src/sensor_dump.cpp", "src/sensor_manager.cpp", "src/sensor_power_policy.cpp", "src/sensor_service.cpp", "src/sensor_service_stub.cpp", "src/stream_server.cpp", ] include_dirs = [ "$SUBSYSTEM_DIR/frameworks/native/include", "$SUBSYSTEM_DIR/interfaces/inner_api", "$SUBSYSTEM_DIR/services/include", "$SUBSYSTEM_DIR/utils/common/include", "$SUBSYSTEM_DIR/utils/ipc/include", ] branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } defines = sensor_default_defines deps = [ "$SUBSYSTEM_DIR/utils/common:libsensor_utils", "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", ] if (sensor_rust_socket_ipc) { deps += [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ] } external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libtokenid_sdk", "c_utils:utils", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (sensor_memmgr_enable) { defines += [ "MEMMGR_ENABLE" ] external_deps += [ "memmgr:memmgrclient" ] } if (sensor_access_token_enable) { defines += [ "ACCESS_TOKEN_ENABLE" ] } if (hdf_drivers_interface_sensor) { sources += [ "hdi_connection/adapter/src/hdi_connection.cpp", "hdi_connection/adapter/src/sensor_event_callback.cpp", "hdi_connection/interface/src/sensor_hdi_connection.cpp", "src/sensor_data_processer.cpp", ] include_dirs += [ "$SUBSYSTEM_DIR/services/hdi_connection/interface/include", "$SUBSYSTEM_DIR/services/hdi_connection/adapter/include", ] if (sensor_build_eng) { sources += [ "hdi_connection/adapter/src/compatible_connection.cpp", "hdi_connection/hardware/src/hdi_service_impl.cpp", ] include_dirs += [ "$SUBSYSTEM_DIR/services/hdi_connection/hardware/include" ] } external_deps += [ "drivers_interface_sensor:libsensor_proxy_2.0" ] } shlib_type = "sa" part_name = "sensor" subsystem_name = "sensors" } ########################################################################## ohos_static_library("libsensor_service_static") { sources = [ "src/client_info.cpp", "src/fifo_cache_data.cpp", "src/flush_info_record.cpp", "src/sensor_dump.cpp", "src/sensor_manager.cpp", "src/sensor_power_policy.cpp", "src/sensor_service.cpp", "src/sensor_service_stub.cpp", "src/stream_server.cpp", ] include_dirs = [ "$SUBSYSTEM_DIR/frameworks/native/include", "$SUBSYSTEM_DIR/interfaces/inner_api", "$SUBSYSTEM_DIR/services/include", "$SUBSYSTEM_DIR/utils/common/include", "$SUBSYSTEM_DIR/utils/ipc/include", ] branch_protector_ret = "pac_ret" sanitize = { cfi = true cfi_cross_dso = true debug = false } defines = sensor_default_defines deps = [ "$SUBSYSTEM_DIR/utils/common:libsensor_utils", "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", ] if (sensor_rust_socket_ipc) { deps += [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ] } external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libtokenid_sdk", "c_utils:utils", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (sensor_memmgr_enable) { defines += [ "MEMMGR_ENABLE" ] external_deps += [ "memmgr:memmgrclient" ] } if (sensor_access_token_enable) { defines += [ "ACCESS_TOKEN_ENABLE" ] } if (hdf_drivers_interface_sensor) { sources += [ "hdi_connection/adapter/src/hdi_connection.cpp", "hdi_connection/adapter/src/sensor_event_callback.cpp", "hdi_connection/interface/src/sensor_hdi_connection.cpp", "src/sensor_data_processer.cpp", ] include_dirs += [ "$SUBSYSTEM_DIR/services/hdi_connection/interface/include", "$SUBSYSTEM_DIR/services/hdi_connection/adapter/include", ] if (sensor_build_eng) { sources += [ "hdi_connection/adapter/src/compatible_connection.cpp", "hdi_connection/hardware/src/hdi_service_impl.cpp", ] include_dirs += [ "$SUBSYSTEM_DIR/services/hdi_connection/hardware/include" ] } external_deps += [ "drivers_interface_sensor:libsensor_proxy_2.0" ] } part_name = "sensor" subsystem_name = "sensors" } group("sensor_service_target") { deps = [ ":libsensor_service", ":libsensor_service_static", ] }