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