• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.gni")
15import("//build/ohos_var.gni")
16
17import("../../memmgr.gni")
18
19## Install .rc or .cfg file to /system/etc/init/
20ohos_prebuilt_etc("memmgrservice_init") {
21  if (use_musl) {
22    source = "memmgrservice.cfg"
23  } else {
24    source = "memmgrservice.rc"
25  }
26  relative_install_dir = "init"
27  part_name = "${memmgr_part_name}"
28  subsystem_name = "${memmgr_subsystem_name}"
29}
30
31config("memory_memmgr_config") {
32  visibility = [ ":*" ]
33  visibility += [ "${memmgr_root_path}/test/*" ]
34  include_dirs = [
35    "include",
36    "${memmgr_root_path}/common/include",
37    "${memmgr_root_path}/common/include/config",
38    "${memmgr_root_path}/common/src/",
39    "${memmgr_root_path}/common/src/config",
40    "${memgr_innerkits_path}/include",
41    "include/event/",
42    "include/memory_level_manager/",
43    "include/nandlife_controller",
44    "include/reclaim_priority_manager/",
45    "include/kill_strategy_manager/",
46    "include/reclaim_strategy_manager/",
47  ]
48
49  defines = []
50  if (memmgr_report_has_bg_task_mgr) {
51    defines += [ "CONFIG_BGTASK_MGR" ]
52  }
53  if (memmgr_purgeable_memory) {
54    defines += [ "USE_PURGEABLE_MEMORY" ]
55    include_dirs += [ "include/purgeable_mem_manager/" ]
56  }
57}
58
59ohos_shared_library("memmgrservice") {
60  install_enable = true
61  use_exceptions = true
62  sources = [
63    "${memmgr_common_path}/src/config/avail_buffer_config.cpp",
64    "${memmgr_common_path}/src/config/kill_config.cpp",
65    "${memmgr_common_path}/src/config/nand_life_config.cpp",
66    "${memmgr_common_path}/src/config/reclaim_config.cpp",
67    "${memmgr_common_path}/src/config/reclaim_priority_config.cpp",
68    "${memmgr_common_path}/src/config/switch_config.cpp",
69    "${memmgr_common_path}/src/config/system_memory_level_config.cpp",
70    "${memmgr_common_path}/src/kernel_interface.cpp",
71    "${memmgr_common_path}/src/memmgr_config_manager.cpp",
72    "${memmgr_common_path}/src/xml_helper.cpp",
73    "src/event/account_observer.cpp",
74    "src/event/app_state_observer.cpp",
75    "src/event/common_event_observer.cpp",
76    "src/event/extension_connection_observer.cpp",
77    "src/event/kswapd_observer.cpp",
78    "src/event/mem_mgr_event_center.cpp",
79    "src/event/memory_pressure_observer.cpp",
80    "src/event/window_visibility_observer.cpp",
81    "src/kill_strategy_manager/low_memory_killer.cpp",
82    "src/mem_mgr_service.cpp",
83    "src/mem_mgr_stub.cpp",
84    "src/memory_level_manager/memory_level_manager.cpp",
85    "src/nandlife_controller/nandlife_controller.cpp",
86    "src/reclaim_priority_manager/account_bundle_info.cpp",
87    "src/reclaim_priority_manager/account_priority_info.cpp",
88    "src/reclaim_priority_manager/bundle_priority_info.cpp",
89    "src/reclaim_priority_manager/default_multi_account_priority.cpp",
90    "src/reclaim_priority_manager/multi_account_manager.cpp",
91    "src/reclaim_priority_manager/oom_score_adj_utils.cpp",
92    "src/reclaim_priority_manager/process_priority_info.cpp",
93    "src/reclaim_priority_manager/reclaim_priority_manager.cpp",
94    "src/reclaim_strategy_manager/avail_buffer_manager.cpp",
95    "src/reclaim_strategy_manager/memcg.cpp",
96    "src/reclaim_strategy_manager/memcg_mgr.cpp",
97    "src/reclaim_strategy_manager/reclaim_strategy_manager.cpp",
98  ]
99
100  configs = [ ":memory_memmgr_config" ]
101
102  deps = [ "//third_party/libxml2:libxml2" ]
103
104  external_deps = [
105    "ability_base:want",
106    "ability_runtime:app_context",
107    "ability_runtime:app_manager",
108    "ability_runtime:connection_obs_manager",
109    "ability_runtime:wantagent_innerkits",
110    "bundle_framework:appexecfwk_base",
111    "bundle_framework:appexecfwk_core",
112    "c_utils:utils",
113    "common_event_service:cesfwk_core",
114    "common_event_service:cesfwk_innerkits",
115    "eventhandler:libeventhandler",
116    "hilog:libhilog",
117    "init:libbegetutil",
118    "ipc:ipc_core",
119    "memmgr:memmgrclient",
120    "os_account:os_account_innerkits",
121    "resource_management:global_resmgr",
122    "safwk:system_ability_fwk",
123    "samgr:samgr_proxy",
124  ]
125
126  if (memmgr_report_has_bg_task_mgr) {
127    sources += [ "src/event/bg_task_observer.cpp" ]
128    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
129  }
130
131  if (memmgr_purgeable_memory) {
132    sources += [
133      "src/purgeable_mem_manager/app_state_subscriber_proxy.cpp",
134      "src/purgeable_mem_manager/app_state_subscriber_stub.cpp",
135      "src/purgeable_mem_manager/purgeable_mem_manager.cpp",
136      "src/purgeable_mem_manager/purgeable_mem_utils.cpp",
137    ]
138    external_deps += [ "access_token:libaccesstoken_sdk" ]
139  }
140
141  part_name = "${memmgr_part_name}"
142  subsystem_name = "${memmgr_subsystem_name}"
143}
144