17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci#ifndef OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_API_H 177777dab0Sopenharmony_ci#define OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_API_H 187777dab0Sopenharmony_ci 197777dab0Sopenharmony_ci#include <stdint.h> 207777dab0Sopenharmony_ci 217777dab0Sopenharmony_ci#include "transient_task_type.h" 227777dab0Sopenharmony_ci 237777dab0Sopenharmony_ci/** 247777dab0Sopenharmony_ci * @addtogroup TransientTask 257777dab0Sopenharmony_ci * @{ 267777dab0Sopenharmony_ci * 277777dab0Sopenharmony_ci * @brief Provide C interface for the Transient task management. 287777dab0Sopenharmony_ci * 297777dab0Sopenharmony_ci * @since 13 307777dab0Sopenharmony_ci * @version 1.0 317777dab0Sopenharmony_ci */ 327777dab0Sopenharmony_ci 337777dab0Sopenharmony_ci/** 347777dab0Sopenharmony_ci * @file transient_task_api.h 357777dab0Sopenharmony_ci * 367777dab0Sopenharmony_ci * @brief Declares the APIs for Transient task management. 377777dab0Sopenharmony_ci * 387777dab0Sopenharmony_ci * @library libtransient_task.so 397777dab0Sopenharmony_ci * @kit BackgroundTasksKit 407777dab0Sopenharmony_ci * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask 417777dab0Sopenharmony_ci * @since 13 427777dab0Sopenharmony_ci */ 437777dab0Sopenharmony_ci 447777dab0Sopenharmony_ci#ifdef __cplusplus 457777dab0Sopenharmony_ciextern "C" { 467777dab0Sopenharmony_ci#endif 477777dab0Sopenharmony_ci 487777dab0Sopenharmony_ci/** 497777dab0Sopenharmony_ci * @brief Requests delayed transition to the suspended state. 507777dab0Sopenharmony_ci * 517777dab0Sopenharmony_ci * @param reason Indicates the reason for delayed transition to the suspended state. 527777dab0Sopenharmony_ci * @param callback Indicates the callback delay time expired. 537777dab0Sopenharmony_ci * @param delaySuspendInfo Indicates the info of delay request. 547777dab0Sopenharmony_ci * @return {@link ERR_TRANSIENT_TASK_OK} 0 - Success. 557777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_INVALID_PARAM} 401 - Invalid parameter. 567777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_PARCEL_FAILED} 9800002 - Parcelable failed. 577777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_TRANSACTION_FAILED} 9800003 - Transact failed. 587777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_SYS_NOT_READY} 9800004 - System service not ready. 597777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_CLIENT_INFO_VERIFICATION_FAILED} 9900001 - uid or pid info verify failed. 607777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_SERVICE_VERIFICATION_FAILED} 9900002 - Transient task verification failed. 617777dab0Sopenharmony_ci * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask 627777dab0Sopenharmony_ci * @since 13 637777dab0Sopenharmony_ci * @version 1.0 647777dab0Sopenharmony_ci */ 657777dab0Sopenharmony_ciint32_t OH_BackgroundTaskManager_RequestSuspendDelay(const char* reason, 667777dab0Sopenharmony_ci TransientTask_Callback callback, TransientTask_DelaySuspendInfo *info); 677777dab0Sopenharmony_ci 687777dab0Sopenharmony_ci/** 697777dab0Sopenharmony_ci * @brief Obtains the remaining time before an application enters the suspended state. 707777dab0Sopenharmony_ci * 717777dab0Sopenharmony_ci * @param requestId Indicates the identifier of the delay request. 727777dab0Sopenharmony_ci * @param time Indicates the remaining Time. 737777dab0Sopenharmony_ci * @return {@link ERR_TRANSIENT_TASK_OK} 0 - Success. 747777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_INVALID_PARAM} 401 - Invalid parameter. 757777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_PARCEL_FAILED} 9800002 - Parcelable failed. 767777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_TRANSACTION_FAILED} 9800003 - Transact failed. 777777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_SYS_NOT_READY} 9800004 - System service not ready. 787777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_CLIENT_INFO_VERIFICATION_FAILED} 9900001 - uid or pid info verify failed. 797777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_SERVICE_VERIFICATION_FAILED} 9900002 - Transient task verification failed. 807777dab0Sopenharmony_ci * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask 817777dab0Sopenharmony_ci * @since 13 827777dab0Sopenharmony_ci * @version 1.0 837777dab0Sopenharmony_ci */ 847777dab0Sopenharmony_ciint32_t OH_BackgroundTaskManager_GetRemainingDelayTime(int32_t requestId, int32_t *delayTime); 857777dab0Sopenharmony_ci 867777dab0Sopenharmony_ci/** 877777dab0Sopenharmony_ci * @brief Cancels delayed transition to the suspended state. 887777dab0Sopenharmony_ci * 897777dab0Sopenharmony_ci * @param requestId Indicates the identifier of the delay request. 907777dab0Sopenharmony_ci * @return {@link ERR_TRANSIENT_TASK_OK} 0 - Success. 917777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_INVALID_PARAM} 401 - Invalid parameter. 927777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_PARCEL_FAILED} 9800002 - Parcelable failed. 937777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_TRANSACTION_FAILED} 9800003 - Transact failed. 947777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_SYS_NOT_READY} 9800004 - System service not ready. 957777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_CLIENT_INFO_VERIFICATION_FAILED} 9900001 - uid or pid info verify failed. 967777dab0Sopenharmony_ci * {@link ERR_TRANSIENT_TASK_SERVICE_VERIFICATION_FAILED} 9900002 - Transient task verification failed. 977777dab0Sopenharmony_ci * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask 987777dab0Sopenharmony_ci * @since 13 997777dab0Sopenharmony_ci * @version 1.0 1007777dab0Sopenharmony_ci */ 1017777dab0Sopenharmony_ciint32_t OH_BackgroundTaskManager_CancelSuspendDelay(int32_t requestId); 1027777dab0Sopenharmony_ci 1037777dab0Sopenharmony_ci#ifdef __cplusplus 1047777dab0Sopenharmony_ci} 1057777dab0Sopenharmony_ci#endif 1067777dab0Sopenharmony_ci/** @} */ 1077777dab0Sopenharmony_ci#endif 108