• 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/purgeablemem_config.cpp",
67    "${memmgr_common_path}/src/config/reclaim_config.cpp",
68    "${memmgr_common_path}/src/config/reclaim_priority_config.cpp",
69    "${memmgr_common_path}/src/config/switch_config.cpp",
70    "${memmgr_common_path}/src/config/system_memory_level_config.cpp",
71    "${memmgr_common_path}/src/kernel_interface.cpp",
72    "${memmgr_common_path}/src/memmgr_config_manager.cpp",
73    "${memmgr_common_path}/src/xml_helper.cpp",
74    "src/event/account_observer.cpp",
75    "src/event/app_state_observer.cpp",
76    "src/event/common_event_observer.cpp",
77    "src/event/extension_connection_observer.cpp",
78    "src/event/kswapd_observer.cpp",
79    "src/event/mem_mgr_event_center.cpp",
80    "src/event/memory_pressure_observer.cpp",
81    "src/event/window_visibility_observer.cpp",
82    "src/kill_strategy_manager/low_memory_killer.cpp",
83    "src/mem_mgr_service.cpp",
84    "src/mem_mgr_stub.cpp",
85    "src/memory_level_manager/memory_level_manager.cpp",
86    "src/nandlife_controller/nandlife_controller.cpp",
87    "src/reclaim_priority_manager/account_bundle_info.cpp",
88    "src/reclaim_priority_manager/account_priority_info.cpp",
89    "src/reclaim_priority_manager/bundle_priority_info.cpp",
90    "src/reclaim_priority_manager/default_multi_account_priority.cpp",
91    "src/reclaim_priority_manager/multi_account_manager.cpp",
92    "src/reclaim_priority_manager/oom_score_adj_utils.cpp",
93    "src/reclaim_priority_manager/process_priority_info.cpp",
94    "src/reclaim_priority_manager/reclaim_priority_manager.cpp",
95    "src/reclaim_strategy_manager/avail_buffer_manager.cpp",
96    "src/reclaim_strategy_manager/memcg.cpp",
97    "src/reclaim_strategy_manager/memcg_mgr.cpp",
98    "src/reclaim_strategy_manager/reclaim_strategy_manager.cpp",
99  ]
100
101  configs = [ ":memory_memmgr_config" ]
102
103  deps = [ "//third_party/libxml2:libxml2" ]
104
105  external_deps = [
106    "ability_base:want",
107    "ability_runtime:app_context",
108    "ability_runtime:app_manager",
109    "ability_runtime:connection_obs_manager",
110    "ability_runtime:wantagent_innerkits",
111    "bundle_framework:appexecfwk_base",
112    "bundle_framework:appexecfwk_core",
113    "c_utils:utils",
114    "common_event_service:cesfwk_core",
115    "common_event_service:cesfwk_innerkits",
116    "eventhandler:libeventhandler",
117    "hilog:libhilog",
118    "init:libbegetutil",
119    "ipc:ipc_core",
120    "memmgr:memmgrclient",
121    "os_account:os_account_innerkits",
122    "resource_management:global_resmgr",
123    "safwk:system_ability_fwk",
124    "samgr:samgr_proxy",
125  ]
126
127  if (memmgr_report_has_bg_task_mgr) {
128    sources += [ "src/event/bg_task_observer.cpp" ]
129    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
130  }
131
132  if (memmgr_purgeable_memory) {
133    sources += [
134      "src/purgeable_mem_manager/app_state_subscriber_proxy.cpp",
135      "src/purgeable_mem_manager/app_state_subscriber_stub.cpp",
136      "src/purgeable_mem_manager/purgeable_mem_manager.cpp",
137      "src/purgeable_mem_manager/purgeable_mem_utils.cpp",
138    ]
139    external_deps += [ "access_token:libaccesstoken_sdk" ]
140  }
141
142  sanitize = {
143    cfi = true
144    cfi_cross_dso = true
145    debug = false
146  }
147  branch_protector_ret = "pac_ret"
148
149  part_name = "${memmgr_part_name}"
150  subsystem_name = "${memmgr_subsystem_name}"
151}
152