已合并
ischildprocess #4703
renjh5496创建于 3月9日
ischildprocess #4703
已合并
共 2 个文件变更+12-0
| @@ -50,5 +50,9 @@ | |||
| 50 | { | 50 | { |
| 51 | "first_introduced": "22", | 51 | "first_introduced": "22", |
| 52 | "name": "OH_Ability_KillChildProcess" | 52 | "name": "OH_Ability_KillChildProcess" |
| 53 | + }, | ||
| 54 | + { | ||
| 55 | + "first_introduced": "26.0.0", | ||
| 56 | + "name": "OH_Ability_IsNativeChildProcessSupported" | ||
| 53 | } | 57 | } |
| 54 | ] | 58 | ] |
| @@ -503,6 +503,14 @@ Ability_NativeChildProcess_ErrCode OH_Ability_UnregisterNativeChildProcessExitCa | |||
| 503 | */ | 503 | */ |
| 504 | Ability_NativeChildProcess_ErrCode OH_Ability_KillChildProcess(int32_t pid); | 504 | Ability_NativeChildProcess_ErrCode OH_Ability_KillChildProcess(int32_t pid); |
| 505 | 505 | ||
| 506 | +/** | ||
| 507 | + * @brief Check whether the caller is allowed to use native process capabilities. | ||
| 508 | + * | ||
| 509 | + * @return true if the caller is allowed to create native child processes, false otherwise. | ||
| 510 | + * @since 26.0.0 | ||
| 511 | + */ | ||
| 512 | +bool OH_Ability_IsNativeChildProcessSupported(); | ||
徐 | |||
| 513 | + | ||
| 506 | 514 | ||
| 507 | } // extern "C" | 515 | } // extern "C" |
| 508 | 516 | ||
这里的命名和语义不一致:
Supported表示设备/平台能力,但注释写的是“调用方是否被允许创建”,这更像权限/授权判断。公共 C API 的查询名需要准确表达返回值语义,否则调用者会把能力检测和权限检测混为一谈。建议把函数名改成能直接表达“允许/可创建”的语义,或把注释改成明确的设备支持能力说明。