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("//base/notification/common_event_service/event.gni") 15import("//build/ohos.gni") 16 17config("ces_services_config") { 18 visibility = [ ":*" ] 19 20 include_dirs = [ 21 "${ces_services_path}/include", 22 "${ffrt_path}/interfaces/kits", 23 ] 24 25 cflags = [ 26 "-fvisibility=hidden", 27 "-fvisibility-inlines-hidden", 28 "-fno-math-errno", 29 "-fno-unroll-loops", 30 "-fmerge-all-constants", 31 "-fno-ident", 32 "-Oz", 33 "-flto", 34 "-ffunction-sections", 35 "-fdata-sections", 36 ] 37 38 if (target_cpu == "arm") { 39 cflags += [ "-DBINDER_IPC_32BIT" ] 40 } 41} 42 43config("ces_services_public_config") { 44 visibility = [ ":*" ] 45 46 cflags = [] 47 48 include_dirs = [ 49 "${ces_services_path}/include", 50 "${ffrt_path}/interfaces/kits", 51 ] 52 53 if (target_cpu == "arm") { 54 cflags += [ "-DBINDER_IPC_32BIT" ] 55 } 56} 57 58cesfwk_services_sources = [ 59 "${ces_services_path}/src/ability_manager_death_recipient.cpp", 60 "${ces_services_path}/src/ability_manager_helper.cpp", 61 "${ces_services_path}/src/access_token_helper.cpp", 62 "${ces_services_path}/src/bms_death_recipient.cpp", 63 "${ces_services_path}/src/bundle_manager_helper.cpp", 64 "${ces_services_path}/src/common_event_control_manager.cpp", 65 "${ces_services_path}/src/common_event_manager_service.cpp", 66 "${ces_services_path}/src/common_event_manager_service_ability.cpp", 67 "${ces_services_path}/src/common_event_permission_manager.cpp", 68 "${ces_services_path}/src/common_event_sticky_manager.cpp", 69 "${ces_services_path}/src/common_event_subscriber_manager.cpp", 70 "${ces_services_path}/src/common_event_support_mapper.cpp", 71 "${ces_services_path}/src/event_report.cpp", 72 "${ces_services_path}/src/inner_common_event_manager.cpp", 73 "${ces_services_path}/src/ordered_event_handler.cpp", 74 "${ces_services_path}/src/os_account_manager_helper.cpp", 75 "${ces_services_path}/src/publish_manager.cpp", 76 "${ces_services_path}/src/static_subscriber_connection.cpp", 77 "${ces_services_path}/src/static_subscriber_data_manager.cpp", 78 "${ces_services_path}/src/static_subscriber_manager.cpp", 79 "${ces_services_path}/src/subscriber_death_recipient.cpp", 80 "${ces_services_path}/src/system_time.cpp", 81] 82 83ohos_shared_library("cesfwk_services") { 84 sanitize = { 85 integer_overflow = true 86 ubsan = true 87 boundary_sanitize = true 88 cfi = true 89 cfi_cross_dso = true 90 debug = false 91 } 92 branch_protector_ret = "pac_ret" 93 94 shlib_type = "sa" 95 96 cflags_cc = [] 97 defines = [] 98 99 if (build_variant == "user") { 100 defines += [ "BUILD_VARIANT_USER" ] 101 } 102 103 sources = cesfwk_services_sources 104 105 configs = [ ":ces_services_config" ] 106 107 deps = [ 108 "${ces_core_path}:cesfwk_core", 109 "${ces_extension_path}:static_subscriber_ipc", 110 "${ces_native_path}:cesfwk_innerkits", 111 "../services:ces.para", 112 "../services:ces.para.dac", 113 ] 114 115 external_deps = [ 116 "ability_base:want", 117 "ability_runtime:ability_manager", 118 "access_token:libaccesstoken_sdk", 119 "access_token:libprivacy_sdk", 120 "access_token:libtokenid_sdk", 121 "bundle_framework:appexecfwk_base", 122 "bundle_framework:appexecfwk_core", 123 "c_utils:utils", 124 "config_policy:configpolicy_util", 125 "eventhandler:libeventhandler", 126 "ffrt:libffrt", 127 "hicollie:libhicollie", 128 "hilog:libhilog", 129 "hisysevent:libhisysevent", 130 "init:libbegetutil", 131 "ipc:ipc_core", 132 "kv_store:distributeddata_inner", 133 "safwk:system_ability_fwk", 134 "samgr:samgr_proxy", 135 ] 136 137 if (has_os_account_part) { 138 cflags_cc += [ "-DHAS_OS_ACCOUNT_PART" ] 139 external_deps += [ "os_account:os_account_innerkits" ] 140 } 141 142 if (has_hisysevent_part) { 143 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 144 external_deps += [ "hisysevent:libhisysevent" ] 145 } 146 147 if (ces_hitrace_usage) { 148 external_deps += [ "hitrace:hitrace_meter" ] 149 defines += [ "HITRACE_METER_ENABLE" ] 150 } 151 152 if (ces_config_policy_enable) { 153 external_deps += [ "config_policy:configpolicy_util" ] 154 defines += [ "CONFIG_POLICY_ENABLE" ] 155 } 156 157 if (common_event_service_limit_screen_event) { 158 defines += [ "WATCH_CUSTOMIZED_SCREEN_EVENT_TO_OTHER_APP" ] 159 } 160 161 if (common_event_service_boot_complete_delay) { 162 defines += [ "WATCH_EVENT_BOOT_COMPLETED_DELAY" ] 163 } 164 165 subsystem_name = "notification" 166 part_name = "common_event_service" 167} 168 169# Note: Just for test 170ohos_static_library("cesfwk_services_static") { 171 cflags_cc = [] 172 defines = [] 173 sources = cesfwk_services_sources 174 175 public_configs = [ ":ces_services_public_config" ] 176 177 deps = [ 178 "${ces_core_path}:cesfwk_core", 179 "${ces_extension_path}:static_subscriber_ipc", 180 "${ces_native_path}:cesfwk_innerkits", 181 "../services:ces.para", 182 "../services:ces.para.dac", 183 ] 184 185 external_deps = [ 186 "ability_base:want", 187 "ability_runtime:ability_connect_callback_stub", 188 "ability_runtime:ability_manager", 189 "access_token:libaccesstoken_sdk", 190 "access_token:libprivacy_sdk", 191 "access_token:libtokenid_sdk", 192 "bundle_framework:appexecfwk_base", 193 "bundle_framework:appexecfwk_core", 194 "c_utils:utils", 195 "eventhandler:libeventhandler", 196 "ffrt:libffrt", 197 "hicollie:libhicollie", 198 "hilog:libhilog", 199 "hisysevent:libhisysevent", 200 "init:libbegetutil", 201 "ipc:ipc_core", 202 "kv_store:distributeddata_inner", 203 "safwk:system_ability_fwk", 204 "samgr:samgr_proxy", 205 ] 206 207 if (has_os_account_part) { 208 cflags_cc += [ "-DHAS_OS_ACCOUNT_PART" ] 209 external_deps += [ "os_account:os_account_innerkits" ] 210 } 211 212 if (has_hisysevent_part) { 213 cflags_cc += [ "-DHAS_HISYSEVENT_PART" ] 214 external_deps += [ "hisysevent:libhisysevent" ] 215 } 216 217 if (ces_hitrace_usage) { 218 external_deps += [ "hitrace:hitrace_meter" ] 219 defines += [ "HITRACE_METER_ENABLE" ] 220 } 221 222 if (ces_config_policy_enable) { 223 external_deps += [ "config_policy:configpolicy_util" ] 224 defines += [ "CONFIG_POLICY_ENABLE" ] 225 } 226 227 subsystem_name = "notification" 228 part_name = "common_event_service" 229} 230 231ohos_prebuilt_etc("ces.para") { 232 source = "etc/ces.para" 233 relative_install_dir = "param" 234 subsystem_name = "notification" 235 part_name = "common_event_service" 236} 237 238ohos_prebuilt_etc("ces.para.dac") { 239 source = "etc/ces.para.dac" 240 relative_install_dir = "param" 241 subsystem_name = "notification" 242 part_name = "common_event_service" 243} 244