diff --git a/backgroundtasks/transient/include/transient_task_api.h b/backgroundtasks/transient/include/transient_task_api.h index 874e6473412e80b3b68cfffa268e78dde2c27ecc..7fcc0c23a878b5b1ff249f68eb098c4981b386ed 100644 --- a/backgroundtasks/transient/include/transient_task_api.h +++ b/backgroundtasks/transient/include/transient_task_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -100,6 +100,21 @@ int32_t OH_BackgroundTaskManager_GetRemainingDelayTime(int32_t requestId, int32_ */ int32_t OH_BackgroundTaskManager_CancelSuspendDelay(int32_t requestId); +/** + * @brief Obtains all the transient task before an application enters the suspended state. + * + * @param transientTaskInfo Indicates the transient task info of an application. + * @return {@link ERR_TRANSIENT_TASK_OK} 0 - Success. + * {@link ERR_TRANSIENT_TASK_INVALID_PARAM} 401 - Invalid parameter. + * {@link ERR_TRANSIENT_TASK_PARCEL_FAILED} 9800001 - Memory operation failed. + * {@link ERR_TRANSIENT_TASK_PARCEL_FAILED} 9800002 - Parcelable failed. + * {@link ERR_TRANSIENT_TASK_SYS_NOT_READY} 9800004 - System service not ready. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @since 20 + * @version 1.0 + */ +int32_t OH_BackgroundTaskManager_GetAllTransientTasks(TransientTask_TransientTaskInfo *transientTaskInfo); + #ifdef __cplusplus } #endif diff --git a/backgroundtasks/transient/include/transient_task_type.h b/backgroundtasks/transient/include/transient_task_type.h index 7a19adf75c8050b3d4c23f5eec1dc1a8ab00b183..6cca71caff8a92d0d8972721019ff329fe7fa138 100644 --- a/backgroundtasks/transient/include/transient_task_type.h +++ b/backgroundtasks/transient/include/transient_task_type.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -37,6 +37,7 @@ #define OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_TYPE_H #include +#include #ifdef __cplusplus extern "C" { @@ -91,6 +92,19 @@ typedef struct TransientTask_DelaySuspendInfo { int32_t actualDelayTime; } TransientTask_DelaySuspendInfo; +/** + * @brief Define CallBack Info 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 */ + std::vector transientTasks; +} TransientTask_TransientTaskInfo; + /** * @brief Define a callback function when delay time expired. * @since 13 diff --git a/backgroundtasks/transient/libtransient_task.ndk.json b/backgroundtasks/transient/libtransient_task.ndk.json index df952bfe1d139048cdf28ba8f1a65bbfec7dbb7f..5d777b0199821083afb17eec109e90fe93bcb50e 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