# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("//build/ohos_var.gni") import("../../memmgr.gni") ## Install .rc or .cfg file to /system/etc/init/ ohos_prebuilt_etc("memmgrservice_init") { if (use_musl) { source = "memmgrservice.cfg" } else { source = "memmgrservice.rc" } relative_install_dir = "init" part_name = "${memmgr_part_name}" subsystem_name = "${memmgr_subsystem_name}" } config("memory_memmgr_config") { visibility = [ ":*" ] visibility += [ "${memmgr_root_path}/test/*" ] include_dirs = [ "include", "${memmgr_root_path}/common/include", "${memmgr_root_path}/common/include/config", "${memmgr_root_path}/common/src/", "${memmgr_root_path}/common/src/config", "${memgr_innerkits_path}/include", "include/event/", "include/memory_level_manager/", "include/nandlife_controller", "include/reclaim_priority_manager/", "include/kill_strategy_manager/", "include/reclaim_strategy_manager/", ] defines = [] if (memmgr_report_has_bg_task_mgr) { defines += [ "CONFIG_BGTASK_MGR" ] } if (memmgr_purgeable_memory) { defines += [ "USE_PURGEABLE_MEMORY" ] include_dirs += [ "include/purgeable_mem_manager/" ] } if (memmgr_hyperhold_memory) { defines += [ "USE_HYPERHOLD_MEMORY" ] } } ohos_shared_library("memmgrservice") { install_enable = true use_exceptions = true sources = [ "${memmgr_common_path}/src/config/avail_buffer_config.cpp", "${memmgr_common_path}/src/config/kill_config.cpp", "${memmgr_common_path}/src/config/nand_life_config.cpp", "${memmgr_common_path}/src/config/purgeablemem_config.cpp", "${memmgr_common_path}/src/config/reclaim_config.cpp", "${memmgr_common_path}/src/config/reclaim_priority_config.cpp", "${memmgr_common_path}/src/config/switch_config.cpp", "${memmgr_common_path}/src/config/system_memory_level_config.cpp", "${memmgr_common_path}/src/kernel_interface.cpp", "${memmgr_common_path}/src/memmgr_config_manager.cpp", "${memmgr_common_path}/src/xml_helper.cpp", "src/event/account_observer.cpp", "src/event/app_state_observer.cpp", "src/event/common_event_observer.cpp", "src/event/extension_connection_observer.cpp", "src/event/kswapd_observer.cpp", "src/event/mem_mgr_event_center.cpp", "src/event/memory_pressure_observer.cpp", "src/event/window_visibility_observer.cpp", "src/kill_strategy_manager/low_memory_killer.cpp", "src/mem_mgr_service.cpp", "src/mem_mgr_stub.cpp", "src/memory_level_manager/memory_level_manager.cpp", "src/nandlife_controller/nandlife_controller.cpp", "src/reclaim_priority_manager/account_bundle_info.cpp", "src/reclaim_priority_manager/account_priority_info.cpp", "src/reclaim_priority_manager/bundle_priority_info.cpp", "src/reclaim_priority_manager/default_multi_account_priority.cpp", "src/reclaim_priority_manager/multi_account_manager.cpp", "src/reclaim_priority_manager/oom_score_adj_utils.cpp", "src/reclaim_priority_manager/process_priority_info.cpp", "src/reclaim_priority_manager/reclaim_priority_manager.cpp", "src/reclaim_strategy_manager/avail_buffer_manager.cpp", "src/reclaim_strategy_manager/memcg.cpp", "src/reclaim_strategy_manager/memcg_mgr.cpp", "src/reclaim_strategy_manager/reclaim_strategy_manager.cpp", ] configs = [ ":memory_memmgr_config" ] external_deps = [ "ability_base:want", "ability_runtime:app_context", "ability_runtime:app_manager", "ability_runtime:connection_obs_manager", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_core", "common_event_service:cesfwk_innerkits", "eventhandler:libeventhandler", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "json:nlohmann_json_static", "libxml2:libxml2", "memmgr:memmgrclient", "os_account:os_account_innerkits", "resource_management:global_resmgr", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (memmgr_report_has_bg_task_mgr) { sources += [ "src/event/bg_task_observer.cpp" ] external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] } if (memmgr_purgeable_memory) { sources += [ "src/purgeable_mem_manager/app_state_subscriber_proxy.cpp", "src/purgeable_mem_manager/app_state_subscriber_stub.cpp", "src/purgeable_mem_manager/purgeable_mem_manager.cpp", "src/purgeable_mem_manager/purgeable_mem_utils.cpp", ] external_deps += [ "access_token:libaccesstoken_sdk" ] } sanitize = { cfi = true cfi_cross_dso = true debug = false } branch_protector_ret = "pac_ret" part_name = "${memmgr_part_name}" subsystem_name = "${memmgr_subsystem_name}" }