!1802 【挑单】供获取应用级沙箱路径的ndk接口

Merge pull request !1802 from sunjiakun/cherry_pick_ndk_getDir_1121
This commit is contained in:
openharmony_ci 2024-11-22 02:43:32 +00:00 committed by Gitee
commit 7ac4f1f511
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 168 additions and 0 deletions

View File

@ -92,6 +92,142 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetAreaMode(Ability
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName(
char* buffer, int32_t bufferSize, int32_t* writeLength);
/**
* @brief Obtain the temp directory of the application.
*
* @param buffer A pointer to a buffer that receives the temp directory of the application.
* @param bufferSize The length of the buffer.
* @param writeLength The string length actually written to the buffer,
* when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
* @return The error code.
* {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
* {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
* or the buffer size is less than the minimum buffer size.
* {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
* @since 16
*/
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetTempDir(
char* buffer, const int32_t bufferSize, int32_t* writeLength);
/**
* @brief Obtain the resource directory of the application.
*
* @param buffer A pointer to a buffer that receives the resource directory of the application.
* @param bufferSize The length of the buffer.
* @param writeLength The string length actually written to the buffer,
* when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
* @return The error code.
* {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
* {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
* or the buffer size is less than the minimum buffer size.
* {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
* @since 16
*/
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetResourceDir(
char* buffer, const int32_t bufferSize, int32_t* writeLength);
/**
* @brief Obtain the files directory of the application.
*
* @param buffer A pointer to a buffer that receives the files directory of the application.
* @param bufferSize The length of the buffer.
* @param writeLength The string length actually written to the buffer,
* when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
* @return The error code.
* {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
* {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
* or the buffer size is less than the minimum buffer size.
* {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
* @since 16
*/
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetFilesDir(
char* buffer, const int32_t bufferSize, int32_t* writeLength);
/**
* @brief Obtain the database directory of the application.
*
* @param buffer A pointer to a buffer that receives the database directory of the application.
* @param bufferSize The length of the buffer.
* @param writeLength The string length actually written to the buffer,
* when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
* @return The error code.
* {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
* {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
* or the buffer size is less than the minimum buffer size.
* {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
* @since 16
*/
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDatabaseDir(
char* buffer, const int32_t bufferSize, int32_t* writeLength);
/**
* @brief Obtain the preferences directory of the application.
*
* @param buffer A pointer to a buffer that receives the preferences directory of the application.
* @param bufferSize The length of the buffer.
* @param writeLength The string length actually written to the buffer,
* when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
* @return The error code.
* {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
* {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
* or the buffer size is less than the minimum buffer size.
* {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
* @since 16
*/
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetPreferencesDir(
char* buffer, const int32_t bufferSize, int32_t* writeLength);
/**
* @brief Obtain the bundle code directory of the application.
*
* @param buffer A pointer to a buffer that receives the bundle code directory of the application.
* @param bufferSize The length of the buffer.
* @param writeLength The string length actually written to the buffer,
* when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
* @return The error code.
* {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
* {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
* or the buffer size is less than the minimum buffer size.
* {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
* @since 16
*/
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleCodeDir(
char* buffer, const int32_t bufferSize, int32_t* writeLength);
/**
* @brief Obtain the distributed files directory of the application.
*
* @param buffer A pointer to a buffer that receives the distributed files directory of the application.
* @param bufferSize The length of the buffer.
* @param writeLength The string length actually written to the buffer,
* when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
* @return The error code.
* {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
* {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
* or the buffer size is less than the minimum buffer size.
* {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
* @since 16
*/
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir(
char* buffer, const int32_t bufferSize, int32_t* writeLength);
/**
* @brief Obtain the cloud file directory of the application.
*
* @param buffer A pointer to a buffer that receives the cloud file directory of the application.
* @param bufferSize The length of the buffer.
* @param writeLength The string length actually written to the buffer,
* when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}.
* @return The error code.
* {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful.
* {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null,
* or the buffer size is less than the minimum buffer size.
* {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist.
* @since 16
*/
AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCloudFileDir(
char* buffer, const int32_t bufferSize, int32_t* writeLength);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -10,5 +10,37 @@
{
"first_introduced": "13",
"name": "OH_AbilityRuntime_ApplicationContextGetBundleName"
},
{
"first_introduced": "16",
"name": "OH_AbilityRuntime_ApplicationContextGetTempDir"
},
{
"first_introduced": "16",
"name": "OH_AbilityRuntime_ApplicationContextGetResourceDir"
},
{
"first_introduced": "16",
"name": "OH_AbilityRuntime_ApplicationContextGetFilesDir"
},
{
"first_introduced": "16",
"name": "OH_AbilityRuntime_ApplicationContextGetDatabaseDir"
},
{
"first_introduced": "16",
"name": "OH_AbilityRuntime_ApplicationContextGetPreferencesDir"
},
{
"first_introduced": "16",
"name": "OH_AbilityRuntime_ApplicationContextGetBundleCodeDir"
},
{
"first_introduced": "16",
"name": "OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir"
},
{
"first_introduced": "16",
"name": "OH_AbilityRuntime_ApplicationContextGetCloudFileDir"
}
]