From 20f9d4c84d1dd3b3244eb0d309b502b3c513b032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E5=BA=B7=E5=BA=B7?= Date: Fri, 14 Jan 2022 10:32:27 +0800 Subject: [PATCH 1/4] add backgroundTaskManager api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 廖康康 --- api/@ohos.backgroundTaskManager.d.ts | 79 ++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 api/@ohos.backgroundTaskManager.d.ts diff --git a/api/@ohos.backgroundTaskManager.d.ts b/api/@ohos.backgroundTaskManager.d.ts new file mode 100644 index 0000000000..1bff4cc414 --- /dev/null +++ b/api/@ohos.backgroundTaskManager.d.ts @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2022 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback , Callback} from './basic'; + +/** + * Manages background tasks. + * + * @since 7 + * @sysCap SystemCapability.Ressched.BackgroundTaskMgr + * @devices phone, tv, wearable, tablet, car + */ +declare namespace backgroundTaskManager { + /** + * The info of delay suspend. + * + * @name DelaySuspendInfo + * @since 7 + * @sysCap SystemCapability.Ressched.BackgroundTaskMgr + * @devices phone, tv, wearable, tablet, car + */ + interface DelaySuspendInfo { + /** + * The unique identifier of the delay request. + */ + requestId: number; + /** + * The actual delay duration (ms). + */ + actualDelayTime: number; + } + + /** + * Cancels delayed transition to the suspended state. + * + * @since 7 + * @sysCap SystemCapability.Ressched.BackgroundTaskMgr + * @devices phone, tv, wearable, tablet, car + * @param requestId Indicates the identifier of the delay request. + */ + function cancelSuspendDelay(requestId: number): void; + + /** + * Obtains the remaining time before an application enters the suspended state. + * + * @since 7 + * @sysCap SystemCapability.Ressched.BackgroundTaskMgr + * @devices phone, tv, wearable, tablet, car + * @param requestId Indicates the identifier of the delay request. + * @param callback Indicates the callback for reporting the result. + * @return The remaining delay time + */ + function getRemainingDelayTime(requestId: number, callback: AsyncCallback): void; + function getRemainingDelayTime(requestId: number): Promise; + + /** + * Requests delayed transition to the suspended state. + * + * @since 7 + * @sysCap SystemCapability.Ressched.BackgroundTaskMgr + * @devices phone, tv, wearable, tablet, car + * @param reason Indicates the reason for delayed transition to the suspended state. + * @param callback The callback delay time expired. + * @return Info of delay request + */ + function requestSuspendDelay(reason: string, callback: Callback): DelaySuspendInfo; +} \ No newline at end of file -- Gitee From 0e0959fdb393f1588ac8d901485e5165375b1894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E5=BA=B7=E5=BA=B7?= Date: Fri, 14 Jan 2022 10:58:15 +0800 Subject: [PATCH 2/4] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 廖康康 --- api/@ohos.backgroundTaskManager.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/@ohos.backgroundTaskManager.d.ts b/api/@ohos.backgroundTaskManager.d.ts index 1bff4cc414..7a75100e51 100644 --- a/api/@ohos.backgroundTaskManager.d.ts +++ b/api/@ohos.backgroundTaskManager.d.ts @@ -17,7 +17,7 @@ import { AsyncCallback , Callback} from './basic'; /** * Manages background tasks. - * + * * @since 7 * @sysCap SystemCapability.Ressched.BackgroundTaskMgr * @devices phone, tv, wearable, tablet, car @@ -25,7 +25,7 @@ import { AsyncCallback , Callback} from './basic'; declare namespace backgroundTaskManager { /** * The info of delay suspend. - * + * * @name DelaySuspendInfo * @since 7 * @sysCap SystemCapability.Ressched.BackgroundTaskMgr @@ -44,8 +44,8 @@ declare namespace backgroundTaskManager { /** * Cancels delayed transition to the suspended state. - * - * @since 7 + * + * @since 7 * @sysCap SystemCapability.Ressched.BackgroundTaskMgr * @devices phone, tv, wearable, tablet, car * @param requestId Indicates the identifier of the delay request. @@ -54,7 +54,7 @@ declare namespace backgroundTaskManager { /** * Obtains the remaining time before an application enters the suspended state. - * + * * @since 7 * @sysCap SystemCapability.Ressched.BackgroundTaskMgr * @devices phone, tv, wearable, tablet, car @@ -67,7 +67,7 @@ declare namespace backgroundTaskManager { /** * Requests delayed transition to the suspended state. - * + * * @since 7 * @sysCap SystemCapability.Ressched.BackgroundTaskMgr * @devices phone, tv, wearable, tablet, car -- Gitee From 1cc38baa533b8dfc4cd3f4f206a9b4d61b9358e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E5=BA=B7=E5=BA=B7?= Date: Fri, 14 Jan 2022 11:51:37 +0800 Subject: [PATCH 3/4] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 廖康康 --- api/@ohos.backgroundTaskManager.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/api/@ohos.backgroundTaskManager.d.ts b/api/@ohos.backgroundTaskManager.d.ts index 7a75100e51..c979e5be5d 100644 --- a/api/@ohos.backgroundTaskManager.d.ts +++ b/api/@ohos.backgroundTaskManager.d.ts @@ -59,7 +59,6 @@ declare namespace backgroundTaskManager { * @sysCap SystemCapability.Ressched.BackgroundTaskMgr * @devices phone, tv, wearable, tablet, car * @param requestId Indicates the identifier of the delay request. - * @param callback Indicates the callback for reporting the result. * @return The remaining delay time */ function getRemainingDelayTime(requestId: number, callback: AsyncCallback): void; -- Gitee From 381892f4c95d3c0f67066e0734209b046a326f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E5=BA=B7=E5=BA=B7?= Date: Fri, 14 Jan 2022 15:26:51 +0800 Subject: [PATCH 4/4] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 廖康康 --- api/@ohos.backgroundTaskManager.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/@ohos.backgroundTaskManager.d.ts b/api/@ohos.backgroundTaskManager.d.ts index c979e5be5d..85bd32ad33 100644 --- a/api/@ohos.backgroundTaskManager.d.ts +++ b/api/@ohos.backgroundTaskManager.d.ts @@ -75,4 +75,6 @@ declare namespace backgroundTaskManager { * @return Info of delay request */ function requestSuspendDelay(reason: string, callback: Callback): DelaySuspendInfo; -} \ No newline at end of file +} + +export default backgroundTaskManager; \ No newline at end of file -- Gitee