From 4264e007dd4b4c9506bb5c7882b0d0aad321c87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E4=BC=9F?= Date: Fri, 23 May 2025 03:25:58 +0000 Subject: [PATCH 1/3] update backgroundtasks/transient/libtransient_task.ndk.json. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡伟 --- backgroundtasks/transient/libtransient_task.ndk.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backgroundtasks/transient/libtransient_task.ndk.json b/backgroundtasks/transient/libtransient_task.ndk.json index df952bfe1..5d777b019 100644 --- a/backgroundtasks/transient/libtransient_task.ndk.json +++ b/backgroundtasks/transient/libtransient_task.ndk.json @@ -10,5 +10,9 @@ { "first_introduced": "13", "name": "OH_BackgroundTaskManager_CancelSuspendDelay" + }, + { + "first_introduced": "20", + "name": "OH_BackgroundTaskManager_GetAllTransientTasks" } ] \ No newline at end of file -- Gitee From 7694d451af20687204e9c1485097a62208a190e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E4=BC=9F?= Date: Fri, 23 May 2025 03:26:34 +0000 Subject: [PATCH 2/3] update backgroundtasks/transient/include/transient_task_api.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡伟 --- .../transient/include/transient_task_api.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backgroundtasks/transient/include/transient_task_api.h b/backgroundtasks/transient/include/transient_task_api.h index 874e64734..f6ce7b659 100644 --- a/backgroundtasks/transient/include/transient_task_api.h +++ b/backgroundtasks/transient/include/transient_task_api.h @@ -100,6 +100,19 @@ int32_t OH_BackgroundTaskManager_GetRemainingDelayTime(int32_t requestId, int32_ */ int32_t OH_BackgroundTaskManager_CancelSuspendDelay(int32_t requestId); +/** + * @brief Obtains all the transient task. + * + * @param transientTaskInfo Indicates the transient task info of an application. + * @return {@link ERR_TRANSIENT_TASK_OK} 0 - Success. + * {@link ERR_TRANSIENT_TASK_CLIENT_INFO_VERIFICATION_FAILED} 9900001 - uid or pid info verify failed. + * {@link ERR_TRANSIENT_TASK_PARCELABLE_FAILED} 9900003 - Failed to write data into parcel. + * {@link ERR_TRANSIENT_TASK_SERVICE_NOT_READY} 9900004 - System service operation failed. + * @since 20 + * @version 1.0 + */ +int32_t OH_BackgroundTaskManager_GetAllTransientTasks(TransientTask_TransientTaskInfo *transientTaskInfo); + #ifdef __cplusplus } #endif -- Gitee From a8022573cc3d50d98c61d6be885bc74184586fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E4=BC=9F?= Date: Fri, 23 May 2025 03:27:34 +0000 Subject: [PATCH 3/3] update backgroundtasks/transient/include/transient_task_type.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡伟 --- .../transient/include/transient_task_type.h | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/backgroundtasks/transient/include/transient_task_type.h b/backgroundtasks/transient/include/transient_task_type.h index 7a19adf75..237da3a12 100644 --- a/backgroundtasks/transient/include/transient_task_type.h +++ b/backgroundtasks/transient/include/transient_task_type.h @@ -41,6 +41,14 @@ #ifdef __cplusplus extern "C" { #endif + +/** + * @brief max number for transient task. + * + * @since 20 + */ +#define TRANSIENT_TASK_MAX_NUM 3 + /** * @brief Enum for transient task error code. * @since 13 @@ -76,6 +84,16 @@ typedef enum TransientTask_ErrorCode { * Transient task verification failed. */ ERR_TRANSIENT_TASK_SERVICE_VERIFICATION_FAILED = 9900002, + /** + * @error Failed to write data into parcel. Possible reasons: + * 1. Invalid parameters; + * 2. Failed to apply for memory. + */ + ERR_TRANSIENT_TASK_PARCELABLE_FAILED = 9900003, + /** + * @error System service operation failed. + */ + ERR_TRANSIENT_TASK_SERVICE_NOT_READY = 9900004, } TransientTask_ErrorCode; /** @@ -91,6 +109,19 @@ typedef struct TransientTask_DelaySuspendInfo { int32_t actualDelayTime; } TransientTask_DelaySuspendInfo; +/** + * @brief Define TransientTaskInfo for an application. + * + * @since 20 + * @version 1.0 + */ +typedef struct TransientTask_TransientTaskInfo { + /** The remaining quota of the delay request */ + int32_t remainingQuota; + /** The info of delay suspend */ + TransientTask_DelaySuspendInfo transientTasks[TRANSIENT_TASK_MAX_NUM]; +} TransientTask_TransientTaskInfo; + /** * @brief Define a callback function when delay time expired. * @since 13 -- Gitee