Files
ability_ability_runtime/ability_runtime.gni
ohci1 197d7605ec !18161 merge master into master
fix: 不规范字段inner_api整改为inner_kits

Created-by: xietingwei
Commit-by: xietingwei
Merged-by: ohci1
Description: **IssueNo**:
https://gitcode.com/openharmony/ability_ability_runtime/issues/14332
**Description**:

**稳定性自检:**
| 自检项                                                       | 自检结果  |
| ------------------------------------------------------------ | -------- |
| 涉及跨进程调用的相关操作需要抛至主线程或加锁防止并发              |          |
| 成员变量进行赋值或创建需要排查并发                               |          |
| 谨慎在lambda表达式中使用引用捕获                                |          |
| 谨慎在未经拷贝的情况下使用外部传入的string、C字符串               |          |
| map\vector\list\set等stl模板类使用时需要排查并发                |          |
| 谨慎考虑加锁范围                                               |          |
| 在IPC通信中谨慎使用同步通信方式                                 |          |
| 禁止传递this指针至其他模块或线程(特别是eventhandler任务)        |          |
| 禁止将外部传入的裸指针在内部直接构造智能指针                      |          |
| 禁止多个独立创建的智能指针管理同一地址                           |          |
| 禁止在析构函数中抛异步任务                                      |          |
| 禁止js对象在非js线程(例如在IPC线程)创建、使用或销毁             |          |
| 禁止在对外接口中未经判空直接使用外部传入的指针                    |          |
| 禁止接口返回局部变量引用                                        |          |
| 禁止在信号函数中加锁                                            |          |
| 禁止在关键流程(SA启动、应用启动等主流程)执行耗时的操作           |          |
| 禁止将同一个cpp编译在不同的so中                                 |          |

**安全编码自检:**
| 自检项                                                          | 自检结果 |
| -------------------------------------------------------------- | -------- |
| 裸指针避免通过隐式转换构造为sptr                                 |          |
| json对象在取值之前必须先判断类型,避免类型不匹配                   |          |
| 序列化时必须对传入的数组大小进行校验,避免出现超大数组              |          |
| 避免使用未明确位宽的整型,选择使用int8_t、uint8_t等类型            |          |
| 外部传入的路径要做规范化校验,对路径中的.、..、../等特殊字符严格校验 |          |
| 指针变量、表示资源描述符的变量、bool变量必须赋初值                  |          |
| readParcelable获取的对象使用前需要判空                            |          |
| 分配和释放内存的函数需要成对出现                                   |          |
| 申请内存后异常退出前需要及时进行内存释放                            |          |
| 内存申请前必须对内存大小进行合法性校验                              |          |
| 内存分配后必须判断是否成功                                         |          |
| 禁止使用realloc、alloca函数                                       |          |
| 禁止打印文件路径、口令等敏感信息,如有需要,使用private修饰          |          |
| 禁止打印内存地址                                                  |          |
| 整数之间运算时必须严格检查,确保不会出现溢出、反转、除0               |          |
| 禁止对有符号整数进行位操作符运算                                    |          |
| 禁止对指针进行逻辑或位运算                                         |          |
| 循环次数如果收外部数据控制,需要检验其合法性                         |          |
| 禁止使用内存操作类危险函数,需要使用安全函数                         |          |
| 谨慎使用不可重入函数                                               |          |
| 必须检查安全函数的返回值,并进行正确处理                             |          |
| 禁止仅通过TokenType类型判断绕过权限校验                             |          |

**TDD Result**:

**XTS Result**:

### 是否已执行L0用例
- [ ] 已验证
- [ ] 不涉及。如不涉及,请写明理由


See merge request: openharmony/ability_ability_runtime!18161
2026-06-27 09:58:46 +08:00

271 lines
10 KiB
Plaintext

# Copyright (c) 2021-2025 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")
ability_runtime_path = "//foundation/ability/ability_runtime"
ability_runtime_napi_path = "${ability_runtime_path}/frameworks/js/napi"
ability_base_path = "//foundation/ability/ability_base"
form_fwk_path = "//foundation/ability/form_fwk"
ability_runtime_innerkits_path = "${ability_runtime_path}/interfaces/inner_api"
ability_runtime_ndk_path = "${ability_runtime_path}/interfaces/kits/c"
ability_runtime_native_path = "${ability_runtime_path}/frameworks/native"
ability_runtime_services_path = "${ability_runtime_path}/services"
ability_runtime_abilitymgr_path = "${ability_runtime_services_path}/abilitymgr"
ability_runtime_test_path = "${ability_runtime_path}/test"
ability_runtime_utils_path = "${ability_runtime_path}/utils"
ace_engine_path = "//foundation/arkui/ace_engine"
agent_runtime_framework_path = "//foundation/ability/ability_runtime/agent_runtime_framework"
cli_tool_framework_path = "//foundation/ability/ability_runtime/cli_tool_framework"
arkui_path = "//foundation/arkui"
previewer_path = "//ide/tools/previewer"
simulator_path = "//foundation/ability/ability_runtime/frameworks/simulator"
bundlefwk_path = "//foundation/bundlemanager/bundle_framework"
bundlefwk_inner_api_path = "${bundlefwk_path}/interfaces/inner_api"
c_utils_base_path = "//commonlibrary/c_utils/base"
ets_utils_path = "//commonlibrary/ets_utils"
print_fwk_path = "//base/print/print_fwk"
imf_path = "//base/inputmethod/imf"
wallpaper_mgr_path = "//base/theme/wallpaper_mgr"
os_account_path = "//base/account/os_account"
distributed_notification_service_path =
"//base/notification/distributed_notification_service"
power_manager_path = "//base/powermgr/power_manager"
request_path = "//base/request/request"
hiebpf_path = "//developtools/profiler/hiebpf"
multimedia_path = "//foundation/multimedia/image_framework"
multimodalinput_path = "//foundation/multimodalinput/input"
windowmanager_path = "//foundation/window/window_manager"
graphic_path = "//foundation/graphic/graphic_2d"
global_path = "//base/global"
distributedschedule_path = "//foundation/systemabilitymgr"
eventhandler_path = "//base/notification/eventhandler"
distributeddatamgr_path = "//foundation/distributeddatamgr"
form_fwk_napi_path = "${form_fwk_path}/frameworks/js/napi"
ability_base_kits_path = "${ability_base_path}/interfaces/kits/native"
ability_base_native_path = "${ability_base_path}/frameworks/native"
appspawn_path = "//base/startup/appspawn"
init_path = "//base/startup/init"
ipc_native_path = "//foundation/communication/ipc/ipc/native"
third_party_path = "//third_party"
hiviewdfx_path = "//base/hiviewdfx/hiview"
hilog_path = "//base/hiviewdfx/hilog"
webview_path = "//base/web/webview"
resource_management_path = "//base/global/resource_management"
common_event_service_path = "//base/notification/common_event_service"
safwk_path = "//utils/system/safwk"
user_file_service_innerkits_path =
"//foundation/filemanagement/user_file_service/interfaces/inner_api"
resourceschedule_path = "//foundation/resourceschedule"
device_usage_statistics_path =
"//foundation/resourceschedule/device_usage_statistics"
device_manager_path = "//foundation/distributedhardware/device_manager"
graphic_2d_path = "//foundation/graphic/graphic_2d"
srms_inner_api_path =
"${ability_runtime_path}/service_router_framework/interfaces/inner_api"
fuzz_test_output_path = "ability_runtime/ability_runtime"
accessibility_path = "//foundation/barrierfree/accessibility"
relational_store_base_path = "//foundation/distributeddatamgr/relational_store"
relational_store_napi_path = "${relational_store_base_path}/frameworks/js/napi"
common_tool_path = "//foundation/distributeddatamgr/kv_store/frameworks/common"
relational_store_common_path = "${relational_store_base_path}/frameworks/common"
ability_base_path = "//foundation/ability/ability_base"
ability_base_innerapi_path = "${ability_base_path}/interfaces/inner_api"
relational_store_innerapi_path =
"${relational_store_base_path}/interfaces/inner_api"
bgtaskmgr_root_path = "//foundation/resourceschedule/background_task_mgr"
bgtaskmgr_interfaces_path = "${bgtaskmgr_root_path}/interfaces"
bgtaskmgr_frameworks_path = "${bgtaskmgr_root_path}/frameworks"
os_account_path = "//base/account/os_account"
access_token_path = "//base/security/access_token"
declare_args() {
background_task_mgr_continuous_task_enable = true
resource_schedule_service_enable = true
memmgr_override_enable = true
ability_runtime_feature_sandboxmanager = false
ability_runtime_power = true
ability_runtime_relational = true
ability_runtime_ces = true
ability_runtime_resource = true
ability_runtime_action_extension = true
ability_runtime_photo_editor_extension = true
ability_runtime_share_extension = true
ability_runtime_ui_service_extension = true
ability_runtime_appspawn = true
ability_runtime_auto_fill = true
ability_runtime_child_process = true
ability_fault_and_exit_test = false
ability_command_for_test = false
ability_runtime_feature_coverage = false
ability_runtime_auto_fill_ability =
"com.ohos.passwordbox/entry/AutoFillAbility"
ability_runtime_smart_auto_fill_ability =
"com.ohos.textautofill/entry/TextAutoFillAbility"
ability_runtime_upms = true
cj_frontend = true
ability_runtime_app_no_response_dialog = false
ability_runtime_app_no_response_dialog_wearable = false
ability_runtime_app_no_response_bundlename = "com.ohos.taskmanager"
include_app_domain_verify = true
ability_runtime_start_window_options_with_pixelmap = false
ability_runtime_check_internet_permission = false
ability_runtime_media_library_enable = true
ability_runtime_forbid_start_enabled = false
ability_runtime_enable_clone_for_account = false
ability_runtime_no_screen = false
ability_runtime_hitrace_enable = true
ability_runtime_hiperf_enable = true
ability_runtime_screenlock_enable = true
ability_runtime_udmf_enable = true
ability_runtime_dsoftbus_enable = false
if (!defined(global_parts_info) ||
defined(global_parts_info.communication_dsoftbus)) {
ability_runtime_dsoftbus_enable = true
}
if (!defined(global_parts_info) ||
defined(global_parts_info.account_os_account)) {
os_account_part_enabled = true
} else {
os_account_part_enabled = false
}
if (!defined(global_parts_info) ||
defined(global_parts_info.hiviewdfx_hiappevent)) {
hiappevent_part_enabled = true
} else {
hiappevent_part_enabled = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.resourceschedule_background_task_mgr)) {
background_task_mgr_continuous_task_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.resourceschedule_resource_schedule_service)) {
resource_schedule_service_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.resourceschedule_memmgr_override)) {
memmgr_override_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.powermgr_power_manager)) {
ability_runtime_power = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.distributeddatamgr_relational_store)) {
ability_runtime_relational = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.notification_common_event_service)) {
ability_runtime_ces = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.global_resource_management)) {
ability_runtime_resource = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.startup_appspawn)) {
ability_runtime_appspawn = false
}
if (!defined(global_parts_info) ||
defined(global_parts_info.security_dlp_permission_service)) {
os_dlp_part_enabled = true
} else {
os_dlp_part_enabled = false
}
if (!defined(global_parts_info) ||
defined(global_parts_info.barrierfree_accessibility)) {
accessibility_enable = true
} else {
accessibility_enable = false
}
if (!defined(global_parts_info) ||
defined(global_parts_info.hiviewdfx_hichecker)) {
hichecker_enabled = true
} else {
hichecker_enabled = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.bundlemanager_app_domain_verify)) {
include_app_domain_verify = false
}
if (!defined(global_parts_info) ||
defined(global_parts_info.ability_form_fwk)) {
form_fwk_enable = true
} else {
form_fwk_enable = false
}
if (defined(global_parts_info) &&
defined(global_parts_info.accesscontrol_sandbox_manager)) {
ability_runtime_feature_sandboxmanager = true
}
if (defined(global_parts_info) &&
defined(global_parts_info.hiviewdfx_hicollie)) {
app_mgr_service_hicollie_enable = true
} else {
app_mgr_service_hicollie_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.multimedia_media_library)) {
ability_runtime_media_library_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.hiviewdfx_hitrace)) {
ability_runtime_hitrace_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.developtools_hiperf)) {
ability_runtime_hiperf_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.theme_screenlock_mgr)) {
ability_runtime_screenlock_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.distributeddatamgr_udmf)) {
ability_runtime_udmf_enable = false
}
hiviewdfx_runtime_api_metrics_enable = true
if (defined(global_parts_info) &&
!defined(global_parts_info.hiviewdfx_api_metrics)) {
hiviewdfx_runtime_api_metrics_enable = false
}
}