From db2927c3bc0c86d2c15db0b6d221bfdc5ee480ee Mon Sep 17 00:00:00 2001 From: "liuzongze@huawei.com" Date: Thu, 15 May 2025 10:53:07 +0800 Subject: [PATCH 1/3] c api fix Signed-off-by: liuzongze@huawei.com --- .../ability_runtime/application_context.h | 109 ++++++++++++++++++ .../ability_runtime/context_constant.h | 2 +- 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/AbilityKit/ability_runtime/application_context.h b/zh-cn/native_sdk/AbilityKit/ability_runtime/application_context.h index a4137157..5890b046 100644 --- a/zh-cn/native_sdk/AbilityKit/ability_runtime/application_context.h +++ b/zh-cn/native_sdk/AbilityKit/ability_runtime/application_context.h @@ -42,6 +42,7 @@ #include #include "ability_runtime_common.h" #include "context_constant.h" +#include "start_options.h" #ifdef __cplusplus extern "C" { @@ -56,6 +57,7 @@ extern "C" { * @return The error code. * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 * @since 13 */ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCacheDir( @@ -68,6 +70,7 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCacheDir( * @return The error code. * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参areaMode为空。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 * @since 13 */ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetAreaMode(AbilityRuntime_AreaMode* areaMode); @@ -81,11 +84,117 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetAreaMode(Ability * @return The error code. * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 * @since 13 */ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName( char* buffer, int32_t bufferSize, int32_t* writeLength); +/** + * @brief 获取应用级别临时目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetTempDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief 获取应用级别文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetFilesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief 获取应用级别数据库目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDatabaseDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief 获取应用级别的首选项文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetPreferencesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief 获取应用级别的安装文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleCodeDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief 获取应用级别的分布式文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief 获取应用级别的云文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCloudFileDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + /** * @brief 启动当前应用的UIAbility。 * diff --git a/zh-cn/native_sdk/AbilityKit/ability_runtime/context_constant.h b/zh-cn/native_sdk/AbilityKit/ability_runtime/context_constant.h index a7557bba..01c69d08 100644 --- a/zh-cn/native_sdk/AbilityKit/ability_runtime/context_constant.h +++ b/zh-cn/native_sdk/AbilityKit/ability_runtime/context_constant.h @@ -17,7 +17,7 @@ * @addtogroup AbilityRuntime * @{ * - * @brief 提供AbilityRuntime模块上下文常量的定义。 + * @brief 提供AbilityRuntime模块上下文常量的描述。 * * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 13 -- Gitee From f14b697059cc2330997f0f53f0913bb8f313ccaf Mon Sep 17 00:00:00 2001 From: liuzongze Date: Thu, 15 May 2025 16:01:39 +0800 Subject: [PATCH 2/3] c api fix Signed-off-by: liuzongze --- .../ability_runtime/application_context.h | 455 +++++++++--------- .../ability_runtime/context_constant.h | 205 ++++---- 2 files changed, 331 insertions(+), 329 deletions(-) diff --git a/zh-cn/native_sdk/AbilityKit/ability_runtime/application_context.h b/zh-cn/native_sdk/AbilityKit/ability_runtime/application_context.h index 5890b046..5da62b88 100644 --- a/zh-cn/native_sdk/AbilityKit/ability_runtime/application_context.h +++ b/zh-cn/native_sdk/AbilityKit/ability_runtime/application_context.h @@ -34,230 +34,231 @@ * @since 13 */ -#ifndef ABILITY_RUNTIME_APPLICATION_CONTEXT_H -#define ABILITY_RUNTIME_APPLICATION_CONTEXT_H - -#include -#include -#include -#include "ability_runtime_common.h" -#include "context_constant.h" -#include "start_options.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief 获取应用级别上下文的缓存目录。 - * - * @param buffer 指向缓冲区的指针,用于接收应用级别上下文的缓存目录。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 13 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCacheDir( - char* buffer, int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 获取应用级别上下文的文件数据加密等级。 - * - * @param areaMode 指向接收数据加密等级的指针 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参areaMode为空。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 13 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetAreaMode(AbilityRuntime_AreaMode* areaMode); - -/** - * @brief 获取应用包名。 - * - * @param buffer 指向缓冲区的指针,用于接收应用包名。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 13 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName( - char* buffer, int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 获取应用级别临时目录。 - * - * @param buffer 指向缓冲区的指针,用于接收应用包名。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 16 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetTempDir( - char* buffer, const int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 获取应用级别文件目录。 - * - * @param buffer 指向缓冲区的指针,用于接收应用包名。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 16 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetFilesDir( - char* buffer, const int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 获取应用级别数据库目录。 - * - * @param buffer 指向缓冲区的指针,用于接收应用包名。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 16 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDatabaseDir( - char* buffer, const int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 获取应用级别的首选项文件目录。 - * - * @param buffer 指向缓冲区的指针,用于接收应用包名。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 16 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetPreferencesDir( - char* buffer, const int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 获取应用级别的安装文件目录。 - * - * @param buffer 指向缓冲区的指针,用于接收应用包名。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 16 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleCodeDir( - char* buffer, const int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 获取应用级别的分布式文件目录。 - * - * @param buffer 指向缓冲区的指针,用于接收应用包名。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 16 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir( - char* buffer, const int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 获取应用级别的云文件目录。 - * - * @param buffer 指向缓冲区的指针,用于接收应用包名。 - * @param bufferSize 缓冲区大小,单位为字节。 - * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 - * @return The error code. - * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 - * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 - * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 - * @since 16 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCloudFileDir( - char* buffer, const int32_t bufferSize, int32_t* writeLength); - -/** - * @brief 启动当前应用的UIAbility。 - * - * @permission {@code ohos.permission.NDK_START_SELF_UI_ABILITY} - * @param want 启动当前应用UIAbility时需要的Want信息。 - * 详细内容参考 {@link AbilityBase_Want}. - * @return 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示接口调用成功。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED} 时,表示调用方权限校验失败。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 时,表示调用方入参校验失败。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED} 时,表示设备类型不支持。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY} 时,表示指定的Ability名称不存在。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE} 时,表示接口调用Ability类型错误。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED} 时,表示众测应用到期。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE} 时,表示Wukong模式,不允许启动/停止Ability。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CONTROLLED} 时,表示应用被管控。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED} 时,表示应用被EDM管控。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CROSS_APP} 时,表示限制API 11以上版本三方应用跳转。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} 时,表示内部错误。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY} 时,表示非顶层应用。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED} 时,表示应用多实例已达到上限(从API17开始)。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED} 时,表示不允许设置APP_INSTANCE_KEY(从API17开始)。 - * 详细内容参考 {@link AbilityRuntime_ErrorCode}. - * @since 15 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbility(AbilityBase_Want *want); - -/** - * @brief 通过StartOptions启动当前应用的UIAbility。 - * - * @permission {@code ohos.permission.NDK_START_SELF_UI_ABILITY} - * @param want 启动当前应用UIAbility时需要的Want信息。 - * 详细内容参考 {@link AbilityBase_Want}。 - * @param options 启动当前应用UIAbility时需要的StartOptions信息。如果该参数中startVisibility属性的值不为空,必须确保当前应用已添加到状态栏, - * 否则会返回ABILITY_RUNTIME_ERROR_VISIBILITY_SETTING_DISABLED错误码。 - * 详细内容参考 {@link AbilityRuntime_StartOptions}。 - * @return 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示接口调用成功。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED} 时,表示调用方权限校验失败。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 时,表示调用方入参校验失败。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED} 时,表示设备类型不支持。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY} 时,表示指定的Ability名称不存在。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE} 时,表示接口调用Ability类型错误。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED} 时,表示众测应用到期。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE} 时,表示Wukong模式,不允许启动/停止Ability。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CONTROLLED} 时,表示应用被管控。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED} 时,表示应用被EDM管控。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CROSS_APP} 时,表示限制API 11以上版本三方应用跳转。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} 时,表示内部错误。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY} 时,表示非顶层应用。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_VISIBILITY_SETTING_DISABLED} 时,表示不允许设置窗口启动可见性。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED} 时,表示不支持应用分身和多实例。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INVALID_APP_INSTANCE_KEY} 时,表示无效多实例。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED} 时,表示应用多实例以达到上限。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_MULTI_INSTANCE_NOT_SUPPORTED} 时,表示不支持应用多实例。 - * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED} 时,表示不允许设置APP_INSTANCE_KEY。 - * 详细内容参考 {@link AbilityRuntime_ErrorCode}。 - * @since 17 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbilityWithStartOptions(AbilityBase_Want *want, - AbilityRuntime_StartOptions *options); - -#ifdef __cplusplus -} // extern "C" -#endif - -/** @} */ -#endif // ABILITY_RUNTIME_APPLICATION_CONTEXT_H + #ifndef ABILITY_RUNTIME_APPLICATION_CONTEXT_H + #define ABILITY_RUNTIME_APPLICATION_CONTEXT_H + + #include + #include + #include + #include "ability_runtime_common.h" + #include "context_constant.h" + #include "start_options.h" + + #ifdef __cplusplus + extern "C" { + #endif + + /** + * @brief 获取应用级别上下文的缓存目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用级别上下文的缓存目录。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 13 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCacheDir( + char* buffer, int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 获取应用级别上下文的文件数据加密等级。 + * + * @param areaMode 指向接收数据加密等级的指针 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参areaMode为空。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 13 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetAreaMode(AbilityRuntime_AreaMode* areaMode); + + /** + * @brief 获取应用包名。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 13 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName( + char* buffer, int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 获取应用级别临时目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetTempDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 获取应用级别文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetFilesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 获取应用级别数据库目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDatabaseDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 获取应用级别的首选项文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetPreferencesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 获取应用级别的安装文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleCodeDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 获取应用级别的分布式文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 获取应用级别的云文件目录。 + * + * @param buffer 指向缓冲区的指针,用于接收应用包名。 + * @param bufferSize 缓冲区大小,单位为字节。 + * @param writeLength 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示实际写入到缓冲区的字符串长度。 + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 查询成功。 + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 入参buffer或者writeLength为空,或者缓冲区大小小于需要写入的大小。 + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} 应用上下文不存在。 + * @since 16 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCloudFileDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + + /** + * @brief 启动当前应用的UIAbility。 + * + * @permission {@code ohos.permission.NDK_START_SELF_UI_ABILITY} + * @param want 启动当前应用UIAbility时需要的Want信息。 + * 详细内容参考 {@link AbilityBase_Want}. + * @return 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示接口调用成功。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED} 时,表示调用方权限校验失败。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 时,表示调用方入参校验失败。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED} 时,表示设备类型不支持。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY} 时,表示指定的Ability名称不存在。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE} 时,表示接口调用Ability类型错误。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED} 时,表示众测应用到期。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE} 时,表示Wukong模式,不允许启动/停止Ability。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CONTROLLED} 时,表示应用被管控。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED} 时,表示应用被EDM管控。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CROSS_APP} 时,表示限制API 11以上版本三方应用跳转。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} 时,表示内部错误。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY} 时,表示非顶层应用。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED} 时,表示应用多实例已达到上限(从API17开始)。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED} 时,表示不允许设置APP_INSTANCE_KEY(从API17开始)。 + * 详细内容参考 {@link AbilityRuntime_ErrorCode}. + * @since 15 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbility(AbilityBase_Want *want); + + /** + * @brief 通过StartOptions启动当前应用的UIAbility。 + * + * @permission {@code ohos.permission.NDK_START_SELF_UI_ABILITY} + * @param want 启动当前应用UIAbility时需要的Want信息。 + * 详细内容参考 {@link AbilityBase_Want}。 + * @param options 启动当前应用UIAbility时需要的StartOptions信息。如果该参数中startVisibility属性的值不为空,必须确保当前应用已添加到状态栏, + * 否则会返回ABILITY_RUNTIME_ERROR_VISIBILITY_SETTING_DISABLED错误码。 + * 详细内容参考 {@link AbilityRuntime_StartOptions}。 + * @return 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} 时,表示接口调用成功。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED} 时,表示调用方权限校验失败。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} 时,表示调用方入参校验失败。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED} 时,表示设备类型不支持。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY} 时,表示指定的Ability名称不存在。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE} 时,表示接口调用Ability类型错误。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED} 时,表示众测应用到期。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE} 时,表示Wukong模式,不允许启动/停止Ability。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CONTROLLED} 时,表示应用被管控。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED} 时,表示应用被EDM管控。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_CROSS_APP} 时,表示限制API 11以上版本三方应用跳转。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} 时,表示内部错误。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY} 时,表示非顶层应用。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_VISIBILITY_SETTING_DISABLED} 时,表示不允许设置窗口启动可见性。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED} 时,表示不支持应用分身和多实例。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_INVALID_APP_INSTANCE_KEY} 时,表示无效多实例。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED} 时,表示应用多实例以达到上限。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_MULTI_INSTANCE_NOT_SUPPORTED} 时,表示不支持应用多实例。 + * 在返回 {@link ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED} 时,表示不允许设置APP_INSTANCE_KEY。 + * 详细内容参考 {@link AbilityRuntime_ErrorCode}。 + * @since 17 + */ + AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbilityWithStartOptions(AbilityBase_Want *want, + AbilityRuntime_StartOptions *options); + + #ifdef __cplusplus + } // extern "C" + #endif + + /** @} */ + #endif // ABILITY_RUNTIME_APPLICATION_CONTEXT_H + \ No newline at end of file diff --git a/zh-cn/native_sdk/AbilityKit/ability_runtime/context_constant.h b/zh-cn/native_sdk/AbilityKit/ability_runtime/context_constant.h index 01c69d08..0643b099 100644 --- a/zh-cn/native_sdk/AbilityKit/ability_runtime/context_constant.h +++ b/zh-cn/native_sdk/AbilityKit/ability_runtime/context_constant.h @@ -34,110 +34,111 @@ * @since 13 */ -#ifndef ABILITY_RUNTIME_CONTEXT_CONSTANT_H -#define ABILITY_RUNTIME_CONTEXT_CONSTANT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief 文件数据加密等级。 + #ifndef ABILITY_RUNTIME_CONTEXT_CONSTANT_H + #define ABILITY_RUNTIME_CONTEXT_CONSTANT_H + + #ifdef __cplusplus + extern "C" { + #endif + + /** + * @brief 文件数据加密等级。 + * + * @since 13 + */ + typedef enum { + /** + * 设备级加密区,设备开机后可访问的数据区。 + */ + ABILITY_RUNTIME_AREA_MODE_EL1 = 0, + /** + * 用户级加密区,设备开机,首次输入密码后才能够访问的数据区。 + */ + ABILITY_RUNTIME_AREA_MODE_EL2 = 1, + /** + * 用户级加密区,不同场景的文件权限如下: + * 已打开文件:锁屏时,可读写;解锁后,可读写。 + * 未打开文件:锁屏时,不可打开、不可读写;解锁后,可打开、可读写。 + * 创建新文件:锁屏时,可创建、可打开、可写不可读;解锁后,可创建、可打开、可读写。 + */ + ABILITY_RUNTIME_AREA_MODE_EL3 = 2, + /** + * 用户级加密区,不同场景的文件权限如下: + * 已打开文件:锁屏时,FEB2.0可读写、FEB3.0不可读写;解锁后,可读写。 + * 未打开文件:锁屏时,不可打开、不可读写;解锁后,可打开、可读写。 + * 创建新文件:锁屏时,不可创建;解锁后,可创建、可打开、可读写。 + */ + ABILITY_RUNTIME_AREA_MODE_EL4 = 3, + /** + * 应用级加密区,不同场景的文件权限如下: + * 已打开文件:锁屏时,可读写;解锁后,可读写。 + * 未打开文件:锁屏时,获取DataAccessLock(JS API)下可打开、可读写,否则不可打开、不可读写;解锁后,可打开、可读写。 + * 创建新文件:锁屏时,可创建、可打开、可读写;解锁后,可创建、可打开、可读写。 + */ + ABILITY_RUNTIME_AREA_MODE_EL5 = 4, + } AbilityRuntime_AreaMode; + + /** + * @brief 启动Ability时的窗口和dock栏图标的显示模式。 + * + * @since 17 + */ + typedef enum { + /** + * 隐藏窗口及dock栏图标。仅在2in1设备上生效。 + */ + ABILITY_RUNTIME_HIDE_UPON_START = 0, + + /** + * 显示窗口及dock栏图标。仅在2in1设备上生效。 + */ + ABILITY_RUNTIME_SHOW_UPON_START = 1, + } AbilityRuntime_StartVisibility; + + /** + * @brief 窗口模式。 * - * @since 13 + * @since 17 */ -typedef enum { - /** - * 设备级加密区,设备开机后可访问的数据区。 - */ - ABILITY_RUNTIME_AREA_MODE_EL1 = 0, - /** - * 用户级加密区,设备开机,首次输入密码后才能够访问的数据区。 - */ - ABILITY_RUNTIME_AREA_MODE_EL2 = 1, - /** - * 用户级加密区,不同场景的文件权限如下: - * 已打开文件:锁屏时,可读写;解锁后,可读写。 - * 未打开文件:锁屏时,不可打开、不可读写;解锁后,可打开、可读写。 - * 创建新文件:锁屏时,可创建、可打开、可写不可读;解锁后,可创建、可打开、可读写。 - */ - ABILITY_RUNTIME_AREA_MODE_EL3 = 2, - /** - * 用户级加密区,不同场景的文件权限如下: - * 已打开文件:锁屏时,FEB2.0可读写、FEB3.0不可读写;解锁后,可读写。 - * 未打开文件:锁屏时,不可打开、不可读写;解锁后,可打开、可读写。 - * 创建新文件:锁屏时,不可创建;解锁后,可创建、可打开、可读写。 - */ - ABILITY_RUNTIME_AREA_MODE_EL4 = 3, - /** - * 应用级加密区,不同场景的文件权限如下: - * 已打开文件:锁屏时,可读写;解锁后,可读写。 - * 未打开文件:锁屏时,获取DataAccessLock(JS API)下可打开、可读写,否则不可打开、不可读写;解锁后,可打开、可读写。 - * 创建新文件:锁屏时,可创建、可打开、可读写;解锁后,可创建、可打开、可读写。 - */ - ABILITY_RUNTIME_AREA_MODE_EL5 = 4, -} AbilityRuntime_AreaMode; - -/** - * @brief 启动Ability时的窗口和dock栏图标的显示模式。 + typedef enum { + /** + * 窗口模式未定义。 + */ + ABILITY_RUNTIME_WINDOW_MODE_UNDEFINED = 0, + /** + * 全屏模式。 + */ + ABILITY_RUNTIME_WINDOW_MODE_FULL_SCREEN = 1, + } AbilityRuntime_WindowMode; + + /** + * 组件所支持的窗口模式。 + * 在应用内启动UIAbility时,指定窗口是否显示最大化/窗口化/分屏按键。 * * @since 17 */ -typedef enum { - /** - * 隐藏窗口及dock栏图标。仅在2in1设备上生效。 - */ - ABILITY_RUNTIME_HIDE_UPON_START = 0, - - /** - * 显示窗口及dock栏图标。仅在2in1设备上生效。 - */ - ABILITY_RUNTIME_SHOW_UPON_START = 1, -} AbilityRuntime_StartVisibility; - -/** -* @brief 窗口模式。 -* -* @since 17 -*/ -typedef enum { - /** - * 窗口模式未定义。 - */ - ABILITY_RUNTIME_WINDOW_MODE_UNDEFINED = 0, - /** - * 全屏模式。 - */ - ABILITY_RUNTIME_WINDOW_MODE_FULL_SCREEN = 1, -} AbilityRuntime_WindowMode; - -/** -* 组件所支持的窗口模式。 -* 在应用内启动UIAbility时,指定窗口是否显示最大化/窗口化/分屏按键。 -* -* @since 17 -*/ -typedef enum { - /** - * 窗口支持全屏显示。 - */ - ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FULL_SCREEN = 0, - /** - * 窗口支持分屏显示。 - * 通常需要配合ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FULL_SCREEN或ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FLOATING一起使用, - * 不建议只配置ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_SPLIT。 - * 当仅配置ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_SPLIT时,2in1设备上的窗口默认为悬浮窗模式,支持进入分屏模式。 - */ - ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_SPLIT = 1, - /** - * 支持窗口化显示。 - */ - ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FLOATING = 2, -} AbilityRuntime_SupportedWindowMode; - -#ifdef __cplusplus -} // extern "C" -#endif - -/** @} */ -#endif // ABILITY_RUNTIME_CONTEXT_CONSTANT_H + typedef enum { + /** + * 窗口支持全屏显示。 + */ + ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FULL_SCREEN = 0, + /** + * 窗口支持分屏显示。 + * 通常需要配合ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FULL_SCREEN或ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FLOATING一起使用, + * 不建议只配置ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_SPLIT。 + * 当仅配置ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_SPLIT时,2in1设备上的窗口默认为悬浮窗模式,支持进入分屏模式。 + */ + ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_SPLIT = 1, + /** + * 支持窗口化显示。 + */ + ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FLOATING = 2, + } AbilityRuntime_SupportedWindowMode; + + #ifdef __cplusplus + } // extern "C" + #endif + + /** @} */ + #endif // ABILITY_RUNTIME_CONTEXT_CONSTANT_H + \ No newline at end of file -- Gitee From 14e865bec93488f647c30fb0a472ef5001c96299 Mon Sep 17 00:00:00 2001 From: liuzongze Date: Thu, 15 May 2025 08:04:17 +0000 Subject: [PATCH 3/3] add LICENSE. Signed-off-by: liuzongze --- LICENSE | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..f6c26977 --- /dev/null +++ b/LICENSE @@ -0,0 +1,194 @@ +木兰宽松许可证,第2版 + +木兰宽松许可证,第2版 + +2020年1月 http://license.coscl.org.cn/MulanPSL2 + +您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: + +0. 定义 + +“软件” 是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 + +“贡献” 是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 + +“贡献者” 是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 + +“法人实体” 是指提交贡献的机构及其“关联实体”。 + +“关联实体” 是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是 +指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 + +1. 授予版权许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可 +以复制、使用、修改、分发其“贡献”,不论修改与否。 + +2. 授予专利许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定 +撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡 +献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软 +件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“ +关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或 +其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权 +行动之日终止。 + +3. 无商标许可 + +“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定 +的声明义务而必须使用除外。 + +4. 分发限制 + +您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“ +本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 + +5. 免责声明与责任限制 + +“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对 +任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于 +何种法律理论,即使其曾被建议有此种损失的可能性。 + +6. 语言 + +“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文 +版为准。 + +条款结束 + +如何将木兰宽松许可证,第2版,应用到您的软件 + +如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: + +1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; + +2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; + +3, 请将如下声明文本放入每个源文件的头部注释中。 + +Copyright (c) [Year] [name of copyright holder] +[Software Name] is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan +PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. + +Mulan Permissive Software License,Version 2 + +Mulan Permissive Software License,Version 2 (Mulan PSL v2) + +January 2020 http://license.coscl.org.cn/MulanPSL2 + +Your reproduction, use, modification and distribution of the Software shall +be subject to Mulan PSL v2 (this License) with the following terms and +conditions: + +0. Definition + +Software means the program and related documents which are licensed under +this License and comprise all Contribution(s). + +Contribution means the copyrightable work licensed by a particular +Contributor under this License. + +Contributor means the Individual or Legal Entity who licenses its +copyrightable work under this License. + +Legal Entity means the entity making a Contribution and all its +Affiliates. + +Affiliates means entities that control, are controlled by, or are under +common control with the acting entity under this License, ‘control’ means +direct or indirect ownership of at least fifty percent (50%) of the voting +power, capital or other securities of controlled or commonly controlled +entity. + +1. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to you a perpetual, worldwide, royalty-free, non-exclusive, +irrevocable copyright license to reproduce, use, modify, or distribute its +Contribution, with modification or not. + +2. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to you a perpetual, worldwide, royalty-free, non-exclusive, +irrevocable (except for revocation under this Section) patent license to +make, have made, use, offer for sale, sell, import or otherwise transfer its +Contribution, where such patent license is only limited to the patent claims +owned or controlled by such Contributor now or in future which will be +necessarily infringed by its Contribution alone, or by combination of the +Contribution with the Software to which the Contribution was contributed. +The patent license shall not apply to any modification of the Contribution, +and any other combination which includes the Contribution. If you or your +Affiliates directly or indirectly institute patent litigation (including a +cross claim or counterclaim in a litigation) or other patent enforcement +activities against any individual or entity by alleging that the Software or +any Contribution in it infringes patents, then any patent license granted to +you under this License for the Software shall terminate as of the date such +litigation or activity is filed or taken. + +3. No Trademark License + +No trademark license is granted to use the trade names, trademarks, service +marks, or product names of Contributor, except as required to fulfill notice +requirements in section 4. + +4. Distribution Restriction + +You may distribute the Software in any medium with or without modification, +whether in source or executable forms, provided that you provide recipients +with a copy of this License and retain copyright, patent, trademark and +disclaimer statements in the Software. + +5. Disclaimer of Warranty and Limitation of Liability + +THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY +KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR +COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT +LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING +FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO +MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES. + +6. Language + +THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION +AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF +DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION +SHALL PREVAIL. + +END OF THE TERMS AND CONDITIONS + +How to Apply the Mulan Permissive Software License,Version 2 +(Mulan PSL v2) to Your Software + +To apply the Mulan PSL v2 to your work, for easy identification by +recipients, you are suggested to complete following three steps: + +i. Fill in the blanks in following statement, including insert your software +name, the year of the first publication of your software, and your name +identified as the copyright owner; + +ii. Create a file named "LICENSE" which contains the whole context of this +License in the first directory of your software package; + +iii. Attach the statement to the appropriate annotated syntax at the +beginning of each source file. + +Copyright (c) [Year] [name of copyright holder] +[Software Name] is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan +PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. -- Gitee