1# Copyright (c) 2022 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/sa_profile/sa_profile.gni") 15import("device_usage_statistics.gni") 16 17ohos_sa_profile("device_usage_statistics_sa_profile") { 18 sources = [ "sa_profile/1907.json" ] 19 part_name = "${device_usage_statistics_part_name}" 20} 21 22config("usagestats_public_config") { 23 include_dirs = [ 24 "services/common/include", 25 "services/packageusage/include", 26 "services/packagegroup/include", 27 "interfaces/innerkits/include", 28 "interfaces/kits/bundlestats/napi/include", 29 ] 30} 31 32config("usagestatsutils_public_config") { 33 include_dirs = [ "utils/include" ] 34} 35 36ohos_shared_library("usagestatsinner") { 37 sources = [ 38 "interfaces/innerkits/src/app_group_callback_info.cpp", 39 "interfaces/innerkits/src/app_group_callback_proxy.cpp", 40 "interfaces/innerkits/src/app_group_callback_stub.cpp", 41 "interfaces/innerkits/src/bundle_active_client.cpp", 42 "interfaces/innerkits/src/bundle_active_event.cpp", 43 "interfaces/innerkits/src/bundle_active_event_stats.cpp", 44 "interfaces/innerkits/src/bundle_active_form_record.cpp", 45 "interfaces/innerkits/src/bundle_active_module_record.cpp", 46 "interfaces/innerkits/src/bundle_active_package_stats.cpp", 47 "interfaces/innerkits/src/bundle_active_proxy.cpp", 48 ] 49 public_configs = [ 50 ":usagestats_public_config", 51 ":usagestatsutils_public_config", 52 ] 53 deps = [ ":usagestatsutils" ] 54 external_deps = [ 55 "c_utils:utils", 56 "eventhandler:libeventhandler", 57 "ffrt:libffrt", 58 "hilog:libhilog", 59 "ipc:ipc_single", 60 "samgr:samgr_proxy", 61 ] 62 63 part_name = "${device_usage_statistics_part_name}" 64 subsystem_name = "resourceschedule" 65 innerapi_tags = [ "platformsdk" ] 66 version_script = "libusagestatsinner.versionscript" 67 branch_protector_ret = "pac_ret" 68 69 sanitize = { 70 cfi = true 71 cfi_cross_dso = true 72 debug = false 73 } 74} 75 76ohos_prebuilt_etc("device_usage_statistics_service_init") { 77 source = "init/device_usage_statistics_service.cfg" 78 relative_install_dir = "init" 79 part_name = "${device_usage_statistics_part_name}" 80 subsystem_name = "resourceschedule" 81} 82 83ohos_shared_library("bundlestate") { 84 sources = [ 85 "frameworks/src/bundle_state_common.cpp", 86 "frameworks/src/bundle_state_init.cpp", 87 "frameworks/src/bundle_state_query.cpp", 88 ] 89 include_dirs = [ 90 "interfaces/kits/bundlestats/napi/include", 91 "services/common/include", 92 "interfaces/innerkits/include", 93 "services/packageusage/include", 94 "services/packagegroup/include", 95 ] 96 97 deps = [ 98 ":usagestatsinner", 99 ":usagestatsutils", 100 ] 101 102 external_deps = [ 103 "c_utils:utils", 104 "hilog:libhilog", 105 "ipc:ipc_single", 106 "napi:ace_napi", 107 ] 108 relative_install_dir = "module" 109 part_name = "${device_usage_statistics_part_name}" 110 subsystem_name = "resourceschedule" 111 branch_protector_ret = "pac_ret" 112 113 sanitize = { 114 cfi = true 115 cfi_cross_dso = true 116 debug = false 117 } 118} 119 120ohos_shared_library("usagestatistics") { 121 sources = [ 122 "frameworks/src/app_group_observer_napi.cpp", 123 "frameworks/src/bundle_active_app_group_napi.cpp", 124 "frameworks/src/bundle_state_common.cpp", 125 "frameworks/src/bundle_state_query_napi.cpp", 126 "frameworks/src/usage_statistics_init.cpp", 127 ] 128 include_dirs = [ 129 "interfaces/kits/bundlestats/napi/include", 130 "services/common/include", 131 "interfaces/innerkits/include", 132 "services/packageusage/include", 133 "services/packagegroup/include", 134 ] 135 136 deps = [ 137 ":usagestatsinner", 138 ":usagestatsutils", 139 ] 140 141 external_deps = [ 142 "c_utils:utils", 143 "hilog:libhilog", 144 "ipc:ipc_single", 145 "napi:ace_napi", 146 ] 147 relative_install_dir = "module/resourceschedule" 148 part_name = "${device_usage_statistics_part_name}" 149 subsystem_name = "resourceschedule" 150 branch_protector_ret = "pac_ret" 151 152 sanitize = { 153 cfi = true 154 cfi_cross_dso = true 155 debug = false 156 } 157} 158 159ohos_shared_library("usagestatservice") { 160 if (!use_clang_coverage) { 161 shlib_type = "sa" 162 } 163 164 cflags_cc = [] 165 sources = [ 166 "services/common/src/bundle_active_account_helper.cpp", 167 "services/common/src/bundle_active_app_state_obsever.cpp", 168 "services/common/src/bundle_active_binary_search.cpp", 169 "services/common/src/bundle_active_bundle_mgr_helper.cpp", 170 "services/common/src/bundle_active_continuous_task_observer.cpp", 171 "services/common/src/bundle_active_core.cpp", 172 "services/common/src/bundle_active_debug_mode.cpp", 173 "services/common/src/bundle_active_open_callback.cpp", 174 "services/common/src/bundle_active_power_state_callback_proxy.cpp", 175 "services/common/src/bundle_active_power_state_callback_service.cpp", 176 "services/common/src/bundle_active_power_state_callback_stub.cpp", 177 "services/common/src/bundle_active_service.cpp", 178 "services/common/src/bundle_active_shutdown_callback_service.cpp", 179 "services/common/src/bundle_active_stub.cpp", 180 "services/common/src/bundle_active_usage_database.cpp", 181 "services/packagegroup/src/bundle_active_group_controller.cpp", 182 "services/packagegroup/src/bundle_active_group_handler.cpp", 183 "services/packagegroup/src/bundle_active_user_history.cpp", 184 "services/packageusage/src/bundle_active_calendar.cpp", 185 "services/packageusage/src/bundle_active_event_list.cpp", 186 "services/packageusage/src/bundle_active_event_tracker.cpp", 187 "services/packageusage/src/bundle_active_period_stats.cpp", 188 "services/packageusage/src/bundle_active_report_handler.cpp", 189 "services/packageusage/src/bundle_active_stats_combiner.cpp", 190 "services/packageusage/src/bundle_active_user_service.cpp", 191 ] 192 public_configs = [ ":usagestats_public_config" ] 193 194 deps = [ 195 ":usagestatsinner", 196 ":usagestatsutils", 197 ] 198 199 external_deps = [ 200 "ability_base:want", 201 "ability_runtime:app_manager", 202 "ability_runtime:wantagent_innerkits", 203 "access_token:libaccesstoken_sdk", 204 "access_token:libtokenid_sdk", 205 "bundle_framework:appexecfwk_base", 206 "bundle_framework:appexecfwk_core", 207 "c_utils:utils", 208 "common_event_service:cesfwk_innerkits", 209 "eventhandler:libeventhandler", 210 "hilog:libhilog", 211 "init:libbegetutil", 212 "ipc:ipc_single", 213 "relational_store:native_rdb", 214 "safwk:system_ability_fwk", 215 "samgr:samgr_proxy", 216 "time_service:time_client", 217 ] 218 219 if (os_account_part_enabled) { 220 cflags_cc += [ "-DOS_ACCOUNT_PART_ENABLED" ] 221 external_deps += [ "os_account:os_account_innerkits" ] 222 } 223 224 defines = [] 225 if (bgtaskmgr_enable) { 226 external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] 227 defines += [ "BGTASKMGR_ENABLE" ] 228 } 229 if (device_usage_statistics_with_powermgr_power_manager_enable) { 230 defines += [ "DEVICE_USAGES_STATISTICS_POWERMANGER_ENABLE" ] 231 external_deps += [ "power_manager:powermgr_client" ] 232 } 233 part_name = "${device_usage_statistics_part_name}" 234 subsystem_name = "resourceschedule" 235 branch_protector_ret = "pac_ret" 236 237 sanitize = { 238 cfi = true 239 cfi_cross_dso = true 240 debug = false 241 } 242} 243 244ohos_static_library("usagestatservice_static") { 245 cflags_cc = [ "-DDEVICE_USAGE_UNIT_TEST" ] 246 247 sources = [ 248 "services/common/src/bundle_active_account_helper.cpp", 249 "services/common/src/bundle_active_app_state_obsever.cpp", 250 "services/common/src/bundle_active_binary_search.cpp", 251 "services/common/src/bundle_active_bundle_mgr_helper.cpp", 252 "services/common/src/bundle_active_continuous_task_observer.cpp", 253 "services/common/src/bundle_active_core.cpp", 254 "services/common/src/bundle_active_debug_mode.cpp", 255 "services/common/src/bundle_active_open_callback.cpp", 256 "services/common/src/bundle_active_power_state_callback_proxy.cpp", 257 "services/common/src/bundle_active_power_state_callback_service.cpp", 258 "services/common/src/bundle_active_power_state_callback_stub.cpp", 259 "services/common/src/bundle_active_service.cpp", 260 "services/common/src/bundle_active_shutdown_callback_service.cpp", 261 "services/common/src/bundle_active_stub.cpp", 262 "services/common/src/bundle_active_usage_database.cpp", 263 "services/packagegroup/src/bundle_active_group_controller.cpp", 264 "services/packagegroup/src/bundle_active_group_handler.cpp", 265 "services/packagegroup/src/bundle_active_user_history.cpp", 266 "services/packageusage/src/bundle_active_calendar.cpp", 267 "services/packageusage/src/bundle_active_event_list.cpp", 268 "services/packageusage/src/bundle_active_event_tracker.cpp", 269 "services/packageusage/src/bundle_active_period_stats.cpp", 270 "services/packageusage/src/bundle_active_report_handler.cpp", 271 "services/packageusage/src/bundle_active_stats_combiner.cpp", 272 "services/packageusage/src/bundle_active_user_service.cpp", 273 ] 274 public_configs = [ ":usagestats_public_config" ] 275 276 deps = [ 277 ":usagestatsinner", 278 ":usagestatsutils", 279 ] 280 281 external_deps = [ 282 "ability_base:want", 283 "ability_runtime:app_manager", 284 "ability_runtime:wantagent_innerkits", 285 "access_token:libaccesstoken_sdk", 286 "access_token:libtokenid_sdk", 287 "bundle_framework:appexecfwk_base", 288 "bundle_framework:appexecfwk_core", 289 "c_utils:utils", 290 "common_event_service:cesfwk_innerkits", 291 "eventhandler:libeventhandler", 292 "hilog:libhilog", 293 "init:libbegetutil", 294 "ipc:ipc_single", 295 "relational_store:native_rdb", 296 "safwk:system_ability_fwk", 297 "samgr:samgr_proxy", 298 "time_service:time_client", 299 ] 300 301 if (os_account_part_enabled) { 302 cflags_cc += [ "-DOS_ACCOUNT_PART_ENABLED" ] 303 external_deps += [ "os_account:os_account_innerkits" ] 304 } 305 306 defines = [] 307 if (bgtaskmgr_enable) { 308 external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] 309 defines += [ "BGTASKMGR_ENABLE" ] 310 } 311 if (device_usage_statistics_with_powermgr_power_manager_enable) { 312 defines += [ "DEVICE_USAGES_STATISTICS_POWERMANGER_ENABLE" ] 313 external_deps += [ "power_manager:powermgr_client" ] 314 } 315 part_name = "${device_usage_statistics_part_name}" 316 subsystem_name = "resourceschedule" 317 branch_protector_ret = "pac_ret" 318 319 sanitize = { 320 cfi = true 321 cfi_cross_dso = true 322 debug = false 323 } 324} 325 326ohos_shared_library("usagestatsutils") { 327 sources = [ "utils/src/bundle_active_log.cpp" ] 328 public_configs = [ ":usagestatsutils_public_config" ] 329 330 external_deps = [ 331 "c_utils:utils", 332 "hilog:libhilog", 333 ] 334 innerapi_tags = [ "platformsdk" ] 335 part_name = "${device_usage_statistics_part_name}" 336 subsystem_name = "resourceschedule" 337 branch_protector_ret = "pac_ret" 338 339 sanitize = { 340 cfi = true 341 cfi_cross_dso = true 342 debug = false 343 } 344} 345