1# Copyright (c) 2021-2023 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("./../usbmgr.gni") 15 16config("usbsrv_private_config") { 17 include_dirs = [ "${usb_manager_path}/interfaces/innerkits/native/include" ] 18} 19 20config("usbsrv_public_config") { 21 include_dirs = [ 22 "native/include", 23 "${usb_manager_path}/services/zidl/include", 24 "${usb_manager_path}/utils/native/include", 25 ] 26} 27 28ohos_shared_library("usbservice") { 29 sanitize = { 30 integer_overflow = true 31 ubsan = true 32 boundary_sanitize = true 33 cfi = true 34 cfi_cross_dso = true 35 debug = false 36 } 37 branch_protector_ret = "pac_ret" 38 39 install_enable = true 40 sources = [ 41 "${usb_manager_path}/services/zidl/src/usb_srv_stub.cpp", 42 "${utils_path}/native/src/usb_settings_datashare.cpp", 43 "native/src/usb_accessory_manager.cpp", 44 "native/src/usb_descriptor_parser.cpp", 45 "native/src/usb_device_manager.cpp", 46 "native/src/usb_function_switch_window.cpp", 47 "native/src/usb_host_manager.cpp", 48 "native/src/usb_port_manager.cpp", 49 "native/src/usb_report_sys_event.cpp", 50 "native/src/usb_right_database.cpp", 51 "native/src/usb_right_db_helper.cpp", 52 "native/src/usb_right_manager.cpp", 53 "native/src/usb_serial_reader.cpp", 54 "native/src/usb_service.cpp", 55 "native/src/usb_service_subscriber.cpp", 56 "native/src/usbd_bulkcallback_impl.cpp", 57 ] 58 59 if (distributed_notification_enable) { 60 sources += [ "native/src/usb_mass_storage_notification.cpp" ] 61 } 62 63 configs = [ 64 "${utils_path}:utils_config", 65 ":usbsrv_private_config", 66 ] 67 68 public_configs = [ ":usbsrv_public_config" ] 69 70 defines = [] 71 72 external_deps = [ 73 "ability_base:base", 74 "ability_base:want", 75 "ability_base:zuri", 76 "ability_runtime:ability_connect_callback_stub", 77 "ability_runtime:ability_manager", 78 "ability_runtime:wantagent_innerkits", 79 "access_token:libaccesstoken_sdk", 80 "access_token:libtokenid_sdk", 81 "bundle_framework:appexecfwk_base", 82 "bundle_framework:appexecfwk_core", 83 "cJSON:cjson", 84 "c_utils:utils", 85 "common_event_service:cesfwk_innerkits", 86 "data_share:datashare_common", 87 "data_share:datashare_consumer", 88 "drivers_interface_usb:libusb_proxy_1.1", 89 "drivers_peripheral_usb:libusb_interface_service_1.1", 90 "hilog:libhilog", 91 "hisysevent:libhisysevent", 92 "hitrace:hitrace_meter", 93 "init:libbeget_proxy", 94 "init:libbegetutil", 95 "ipc:ipc_single", 96 "memmgr:memmgrclient", 97 "napi:ace_napi", 98 "os_account:os_account_innerkits", 99 "relational_store:native_rdb", 100 "safwk:system_ability_fwk", 101 "samgr:samgr_proxy", 102 ] 103 104 if (distributed_notification_enable) { 105 external_deps += [ 106 "distributed_notification_service:ans_innerkits", 107 "i18n:intl_util", 108 "resource_management:global_resmgr", 109 ] 110 defines += [ "USB_NOTIFICATION_ENABLE" ] 111 } 112 113 if (usb_manager_feature_pop_up_func_switch_model) { 114 defines += [ "USB_FUNC_SWITCH_MODE" ] 115 } 116 subsystem_name = "usb" 117 part_name = "usb_manager" 118} 119 120ohos_prebuilt_etc("usb_service.init") { 121 source = "usb_service.cfg" 122 relative_install_dir = "init" 123 subsystem_name = "usb" 124 part_name = "usb_manager" 125} 126