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("//foundation/resourceschedule/memmgr/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 include_dirs = [ 34 "include", 35 "${memmgr_root_path}/common/include", 36 "${memmgr_root_path}/common/include/config", 37 "${memmgr_root_path}/common/src/", 38 "${memmgr_root_path}/common/src/config", 39 "${memgr_innerkits_path}/include", 40 "include/event/", 41 "include/memory_level_manager/", 42 "include/nandlife_controller", 43 "include/reclaim_priority_manager/", 44 "include/kill_strategy_manager/", 45 "include/reclaim_strategy_manager/", 46 ] 47 48 defines = [] 49 if (memmgr_report_has_bg_task_mgr) { 50 defines += [ "CONFIG_BGTASK_MGR" ] 51 } 52} 53 54ohos_shared_library("memmgrservice") { 55 install_enable = true 56 use_exceptions = true 57 sources = [ 58 "${memmgr_common_path}/src/config/avail_buffer_config.cpp", 59 "${memmgr_common_path}/src/config/kill_config.cpp", 60 "${memmgr_common_path}/src/config/nand_life_config.cpp", 61 "${memmgr_common_path}/src/config/reclaim_config.cpp", 62 "${memmgr_common_path}/src/config/reclaim_priority_config.cpp", 63 "${memmgr_common_path}/src/config/switch_config.cpp", 64 "${memmgr_common_path}/src/config/system_memory_level_config.cpp", 65 "${memmgr_common_path}/src/kernel_interface.cpp", 66 "${memmgr_common_path}/src/memmgr_config_manager.cpp", 67 "${memmgr_common_path}/src/xml_helper.cpp", 68 "src/event/account_observer.cpp", 69 "src/event/app_state_observer.cpp", 70 "src/event/common_event_observer.cpp", 71 "src/event/extension_connection_observer.cpp", 72 "src/event/mem_mgr_event_center.cpp", 73 "src/event/memory_pressure_observer.cpp", 74 "src/kill_strategy_manager/low_memory_killer.cpp", 75 "src/mem_mgr_service.cpp", 76 "src/mem_mgr_stub.cpp", 77 "src/memory_level_manager/memory_level_manager.cpp", 78 "src/nandlife_controller/nandlife_controller.cpp", 79 "src/reclaim_priority_manager/account_bundle_info.cpp", 80 "src/reclaim_priority_manager/account_priority_info.cpp", 81 "src/reclaim_priority_manager/bundle_priority_info.cpp", 82 "src/reclaim_priority_manager/default_multi_account_priority.cpp", 83 "src/reclaim_priority_manager/multi_account_manager.cpp", 84 "src/reclaim_priority_manager/oom_score_adj_utils.cpp", 85 "src/reclaim_priority_manager/process_priority_info.cpp", 86 "src/reclaim_priority_manager/reclaim_priority_manager.cpp", 87 "src/reclaim_strategy_manager/avail_buffer_manager.cpp", 88 "src/reclaim_strategy_manager/memcg.cpp", 89 "src/reclaim_strategy_manager/memcg_mgr.cpp", 90 "src/reclaim_strategy_manager/reclaim_strategy_manager.cpp", 91 ] 92 93 configs = [ ":memory_memmgr_config" ] 94 95 deps = [ "//third_party/libxml2:libxml2" ] 96 97 include_dirs = [ 98 "//foundation/ability/ability_runtime/interfaces/inner_api/wantagent/include", 99 "//foundation/ability/ability_runtime/interfaces/kits/native/appkit/ability_runtime", 100 "//base/global/resource_management/interfaces/inner_api/include", 101 "//foundation/ability/ability_runtime/services/abilitymgr/include", 102 ] 103 104 external_deps = [ 105 "ability_base:want", 106 "ability_runtime:app_manager", 107 "ability_runtime:connection_obs_manager", 108 "bundle_framework:appexecfwk_base", 109 "bundle_framework:appexecfwk_core", 110 "c_utils:utils", 111 "common_event_service:cesfwk_core", 112 "common_event_service:cesfwk_innerkits", 113 "eventhandler:libeventhandler", 114 "hiviewdfx_hilog_native:libhilog", 115 "init:libbegetutil", 116 "ipc:ipc_core", 117 "memmgr:memmgrclient", 118 "os_account:os_account_innerkits", 119 "safwk:system_ability_fwk", 120 "samgr:samgr_proxy", 121 ] 122 123 if (memmgr_report_has_bg_task_mgr) { 124 sources += [ "src/event/bg_task_observer.cpp" ] 125 external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] 126 } 127 128 part_name = "${memmgr_part_name}" 129 subsystem_name = "${memmgr_subsystem_name}" 130} 131