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 "hilog:libhilog", 58 "ipc:ipc_single", 59 "samgr:samgr_proxy", 60 ] 61 62 part_name = "${device_usage_statistics_part_name}" 63 subsystem_name = "resourceschedule" 64 innerapi_tags = [ "platformsdk" ] 65 version_script = "libusagestatsinner.versionscript" 66} 67 68ohos_prebuilt_etc("device_usage_statistics_service_init") { 69 source = "init/device_usage_statistics_service.cfg" 70 relative_install_dir = "init" 71 part_name = "${device_usage_statistics_part_name}" 72 subsystem_name = "resourceschedule" 73} 74 75ohos_shared_library("bundlestate") { 76 sources = [ 77 "frameworks/src/bundle_state_common.cpp", 78 "frameworks/src/bundle_state_init.cpp", 79 "frameworks/src/bundle_state_query.cpp", 80 ] 81 include_dirs = [ 82 "interfaces/kits/bundlestats/napi/include", 83 "services/common/include", 84 "interfaces/innerkits/include", 85 "services/packageusage/include", 86 "services/packagegroup/include", 87 ] 88 89 deps = [ 90 ":usagestatsinner", 91 ":usagestatsutils", 92 ] 93 94 external_deps = [ 95 "c_utils:utils", 96 "hilog:libhilog", 97 "ipc:ipc_single", 98 "napi:ace_napi", 99 ] 100 relative_install_dir = "module" 101 part_name = "${device_usage_statistics_part_name}" 102 subsystem_name = "resourceschedule" 103} 104 105ohos_shared_library("usagestatistics") { 106 sources = [ 107 "frameworks/src/app_group_observer_napi.cpp", 108 "frameworks/src/bundle_active_app_group_napi.cpp", 109 "frameworks/src/bundle_state_common.cpp", 110 "frameworks/src/bundle_state_query_napi.cpp", 111 "frameworks/src/usage_statistics_init.cpp", 112 ] 113 include_dirs = [ 114 "interfaces/kits/bundlestats/napi/include", 115 "services/common/include", 116 "interfaces/innerkits/include", 117 "services/packageusage/include", 118 "services/packagegroup/include", 119 ] 120 121 deps = [ 122 ":usagestatsinner", 123 ":usagestatsutils", 124 ] 125 126 external_deps = [ 127 "c_utils:utils", 128 "hilog:libhilog", 129 "ipc:ipc_single", 130 "napi:ace_napi", 131 ] 132 relative_install_dir = "module/resourceschedule" 133 part_name = "${device_usage_statistics_part_name}" 134 subsystem_name = "resourceschedule" 135} 136 137ohos_shared_library("usagestatservice") { 138 if (!use_clang_coverage) { 139 shlib_type = "sa" 140 } 141 142 cflags_cc = [] 143 sources = [ 144 "services/common/src/bundle_active_account_helper.cpp", 145 "services/common/src/bundle_active_app_state_obsever.cpp", 146 "services/common/src/bundle_active_binary_search.cpp", 147 "services/common/src/bundle_active_bundle_mgr_helper.cpp", 148 "services/common/src/bundle_active_continuous_task_observer.cpp", 149 "services/common/src/bundle_active_core.cpp", 150 "services/common/src/bundle_active_debug_mode.cpp", 151 "services/common/src/bundle_active_open_callback.cpp", 152 "services/common/src/bundle_active_power_state_callback_proxy.cpp", 153 "services/common/src/bundle_active_power_state_callback_service.cpp", 154 "services/common/src/bundle_active_power_state_callback_stub.cpp", 155 "services/common/src/bundle_active_service.cpp", 156 "services/common/src/bundle_active_shutdown_callback_service.cpp", 157 "services/common/src/bundle_active_stub.cpp", 158 "services/common/src/bundle_active_usage_database.cpp", 159 "services/packagegroup/src/bundle_active_group_controller.cpp", 160 "services/packagegroup/src/bundle_active_group_handler.cpp", 161 "services/packagegroup/src/bundle_active_user_history.cpp", 162 "services/packageusage/src/bundle_active_calendar.cpp", 163 "services/packageusage/src/bundle_active_event_list.cpp", 164 "services/packageusage/src/bundle_active_event_tracker.cpp", 165 "services/packageusage/src/bundle_active_period_stats.cpp", 166 "services/packageusage/src/bundle_active_report_handler.cpp", 167 "services/packageusage/src/bundle_active_stats_combiner.cpp", 168 "services/packageusage/src/bundle_active_user_service.cpp", 169 ] 170 public_configs = [ ":usagestats_public_config" ] 171 172 deps = [ 173 ":usagestatsinner", 174 ":usagestatsutils", 175 ] 176 177 external_deps = [ 178 "ability_base:want", 179 "ability_runtime:app_manager", 180 "ability_runtime:wantagent_innerkits", 181 "access_token:libaccesstoken_sdk", 182 "access_token:libtokenid_sdk", 183 "bundle_framework:appexecfwk_base", 184 "bundle_framework:appexecfwk_core", 185 "c_utils:utils", 186 "common_event_service:cesfwk_innerkits", 187 "eventhandler:libeventhandler", 188 "hilog:libhilog", 189 "init:libbegetutil", 190 "ipc:ipc_single", 191 "power_manager:powermgr_client", 192 "relational_store:native_rdb", 193 "safwk:system_ability_fwk", 194 "samgr:samgr_proxy", 195 "time_service:time_client", 196 ] 197 198 if (os_account_part_enabled) { 199 cflags_cc += [ "-DOS_ACCOUNT_PART_ENABLED" ] 200 external_deps += [ "os_account:os_account_innerkits" ] 201 } 202 203 defines = [] 204 if (bgtaskmgr_enable) { 205 external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] 206 defines += [ "BGTASKMGR_ENABLE" ] 207 } 208 part_name = "${device_usage_statistics_part_name}" 209 subsystem_name = "resourceschedule" 210} 211 212ohos_static_library("usagestatservice_static") { 213 cflags_cc = [ "-DDEVICE_USAGE_UNIT_TEST" ] 214 215 sources = [ 216 "services/common/src/bundle_active_account_helper.cpp", 217 "services/common/src/bundle_active_app_state_obsever.cpp", 218 "services/common/src/bundle_active_binary_search.cpp", 219 "services/common/src/bundle_active_bundle_mgr_helper.cpp", 220 "services/common/src/bundle_active_continuous_task_observer.cpp", 221 "services/common/src/bundle_active_core.cpp", 222 "services/common/src/bundle_active_debug_mode.cpp", 223 "services/common/src/bundle_active_open_callback.cpp", 224 "services/common/src/bundle_active_power_state_callback_proxy.cpp", 225 "services/common/src/bundle_active_power_state_callback_service.cpp", 226 "services/common/src/bundle_active_power_state_callback_stub.cpp", 227 "services/common/src/bundle_active_service.cpp", 228 "services/common/src/bundle_active_shutdown_callback_service.cpp", 229 "services/common/src/bundle_active_stub.cpp", 230 "services/common/src/bundle_active_usage_database.cpp", 231 "services/packagegroup/src/bundle_active_group_controller.cpp", 232 "services/packagegroup/src/bundle_active_group_handler.cpp", 233 "services/packagegroup/src/bundle_active_user_history.cpp", 234 "services/packageusage/src/bundle_active_calendar.cpp", 235 "services/packageusage/src/bundle_active_event_list.cpp", 236 "services/packageusage/src/bundle_active_event_tracker.cpp", 237 "services/packageusage/src/bundle_active_period_stats.cpp", 238 "services/packageusage/src/bundle_active_report_handler.cpp", 239 "services/packageusage/src/bundle_active_stats_combiner.cpp", 240 "services/packageusage/src/bundle_active_user_service.cpp", 241 ] 242 public_configs = [ ":usagestats_public_config" ] 243 244 deps = [ 245 ":usagestatsinner", 246 ":usagestatsutils", 247 ] 248 249 external_deps = [ 250 "ability_base:want", 251 "ability_runtime:app_manager", 252 "ability_runtime:wantagent_innerkits", 253 "access_token:libaccesstoken_sdk", 254 "access_token:libtokenid_sdk", 255 "bundle_framework:appexecfwk_base", 256 "bundle_framework:appexecfwk_core", 257 "c_utils:utils", 258 "common_event_service:cesfwk_innerkits", 259 "eventhandler:libeventhandler", 260 "hilog:libhilog", 261 "init:libbegetutil", 262 "ipc:ipc_single", 263 "power_manager:powermgr_client", 264 "relational_store:native_rdb", 265 "safwk:system_ability_fwk", 266 "samgr:samgr_proxy", 267 "time_service:time_client", 268 ] 269 270 if (os_account_part_enabled) { 271 cflags_cc += [ "-DOS_ACCOUNT_PART_ENABLED" ] 272 external_deps += [ "os_account:os_account_innerkits" ] 273 } 274 275 defines = [] 276 if (bgtaskmgr_enable) { 277 external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] 278 defines += [ "BGTASKMGR_ENABLE" ] 279 } 280 part_name = "${device_usage_statistics_part_name}" 281 subsystem_name = "resourceschedule" 282} 283 284ohos_shared_library("usagestatsutils") { 285 sources = [ "utils/src/bundle_active_log.cpp" ] 286 public_configs = [ ":usagestatsutils_public_config" ] 287 288 external_deps = [ 289 "c_utils:utils", 290 "hilog:libhilog", 291 ] 292 innerapi_tags = [ "platformsdk" ] 293 part_name = "${device_usage_statistics_part_name}" 294 subsystem_name = "resourceschedule" 295} 296