161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit BackgroundTasksKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { AsyncCallback, Callback } from './@ohos.base';
2261847f8eSopenharmony_ciimport { WantAgent } from './@ohos.wantAgent';
2361847f8eSopenharmony_ciimport Context from './application/BaseContext';
2461847f8eSopenharmony_ciimport type notificationManager from './@ohos.notificationManager';
2561847f8eSopenharmony_ci
2661847f8eSopenharmony_ci/**
2761847f8eSopenharmony_ci * Manages background tasks.
2861847f8eSopenharmony_ci *
2961847f8eSopenharmony_ci * @namespace backgroundTaskManager
3061847f8eSopenharmony_ci * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.Core
3161847f8eSopenharmony_ci * @since 9
3261847f8eSopenharmony_ci */
3361847f8eSopenharmony_ci/**
3461847f8eSopenharmony_ci * Manages background tasks.
3561847f8eSopenharmony_ci *
3661847f8eSopenharmony_ci * @namespace backgroundTaskManager
3761847f8eSopenharmony_ci * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.Core
3861847f8eSopenharmony_ci * @atomicservice
3961847f8eSopenharmony_ci * @since 12
4061847f8eSopenharmony_ci */
4161847f8eSopenharmony_cideclare namespace backgroundTaskManager {
4261847f8eSopenharmony_ci  /**
4361847f8eSopenharmony_ci   * The info of delay suspend.
4461847f8eSopenharmony_ci   *
4561847f8eSopenharmony_ci   * @interface DelaySuspendInfo
4661847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
4761847f8eSopenharmony_ci   * @since 9
4861847f8eSopenharmony_ci   */
4961847f8eSopenharmony_ci  interface DelaySuspendInfo {
5061847f8eSopenharmony_ci    /**
5161847f8eSopenharmony_ci     * The unique identifier of the delay request.
5261847f8eSopenharmony_ci     *
5361847f8eSopenharmony_ci     * @type { number }
5461847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
5561847f8eSopenharmony_ci     * @since 9
5661847f8eSopenharmony_ci     */
5761847f8eSopenharmony_ci    requestId: number;
5861847f8eSopenharmony_ci    /**
5961847f8eSopenharmony_ci     * The actual delay duration (ms).
6061847f8eSopenharmony_ci     *
6161847f8eSopenharmony_ci     * @type { number }
6261847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
6361847f8eSopenharmony_ci     * @since 9
6461847f8eSopenharmony_ci     */
6561847f8eSopenharmony_ci    actualDelayTime: number;
6661847f8eSopenharmony_ci  }
6761847f8eSopenharmony_ci
6861847f8eSopenharmony_ci  /**
6961847f8eSopenharmony_ci   * The info of continuous task notification.
7061847f8eSopenharmony_ci   *
7161847f8eSopenharmony_ci   * @interface ContinuousTaskNotification
7261847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
7361847f8eSopenharmony_ci   * @atomicservice
7461847f8eSopenharmony_ci   * @since 12
7561847f8eSopenharmony_ci   */
7661847f8eSopenharmony_ci  interface ContinuousTaskNotification {
7761847f8eSopenharmony_ci    /**
7861847f8eSopenharmony_ci     * The notification slot type.
7961847f8eSopenharmony_ci     *
8061847f8eSopenharmony_ci     * @type { notificationManager.SlotType }
8161847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
8261847f8eSopenharmony_ci     * @atomicservice
8361847f8eSopenharmony_ci     * @since 12
8461847f8eSopenharmony_ci     */
8561847f8eSopenharmony_ci    slotType: notificationManager.SlotType;
8661847f8eSopenharmony_ci    /**
8761847f8eSopenharmony_ci     * The notification content type.
8861847f8eSopenharmony_ci     *
8961847f8eSopenharmony_ci     * @type { notificationManager.ContentType }
9061847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
9161847f8eSopenharmony_ci     * @atomicservice
9261847f8eSopenharmony_ci     * @since 12
9361847f8eSopenharmony_ci     */
9461847f8eSopenharmony_ci    contentType: notificationManager.ContentType;
9561847f8eSopenharmony_ci    /**
9661847f8eSopenharmony_ci     * The notification id.
9761847f8eSopenharmony_ci     *
9861847f8eSopenharmony_ci     * @type { number }
9961847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
10061847f8eSopenharmony_ci     * @atomicservice
10161847f8eSopenharmony_ci     * @since 12
10261847f8eSopenharmony_ci     */
10361847f8eSopenharmony_ci    notificationId: number;
10461847f8eSopenharmony_ci  }
10561847f8eSopenharmony_ci
10661847f8eSopenharmony_ci  /**
10761847f8eSopenharmony_ci   * Cancels delayed transition to the suspended state.
10861847f8eSopenharmony_ci   *
10961847f8eSopenharmony_ci   * @param { number } requestId - The identifier of the delay request.
11061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
11161847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
11261847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
11361847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
11461847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
11561847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
11661847f8eSopenharmony_ci   * @throws { BusinessError } 9900001 - Caller information verification failed for a transient task.
11761847f8eSopenharmony_ci   * @throws { BusinessError } 9900002 - Transient task verification failed.
11861847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
11961847f8eSopenharmony_ci   * @since 9
12061847f8eSopenharmony_ci   */
12161847f8eSopenharmony_ci  function cancelSuspendDelay(requestId: number): void;
12261847f8eSopenharmony_ci
12361847f8eSopenharmony_ci  /**
12461847f8eSopenharmony_ci   * Obtains the remaining time before an application enters the suspended state.
12561847f8eSopenharmony_ci   *
12661847f8eSopenharmony_ci   * @param { number } requestId - The identifier of the delay request.
12761847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - The callback of the remaining delay time.
12861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
12961847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
13061847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
13161847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
13261847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
13361847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
13461847f8eSopenharmony_ci   * @throws { BusinessError } 9900001 - Caller information verification failed for a transient task.
13561847f8eSopenharmony_ci   * @throws { BusinessError } 9900002 - Transient task verification failed.
13661847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
13761847f8eSopenharmony_ci   * @since 9
13861847f8eSopenharmony_ci   */
13961847f8eSopenharmony_ci  function getRemainingDelayTime(requestId: number, callback: AsyncCallback<number>): void;
14061847f8eSopenharmony_ci
14161847f8eSopenharmony_ci  /**
14261847f8eSopenharmony_ci   * Obtains the remaining time before an application enters the suspended state.
14361847f8eSopenharmony_ci   *
14461847f8eSopenharmony_ci   * @param { number } requestId - The identifier of the delay request.
14561847f8eSopenharmony_ci   * @returns { Promise<number> } The promise returns the remaining delay time.
14661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
14761847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
14861847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
14961847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
15061847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
15161847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
15261847f8eSopenharmony_ci   * @throws { BusinessError } 9900001 - Caller information verification failed for a transient task.
15361847f8eSopenharmony_ci   * @throws { BusinessError } 9900002 - Transient task verification failed.
15461847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
15561847f8eSopenharmony_ci   * @since 9
15661847f8eSopenharmony_ci   */
15761847f8eSopenharmony_ci  function getRemainingDelayTime(requestId: number): Promise<number>;
15861847f8eSopenharmony_ci
15961847f8eSopenharmony_ci  /**
16061847f8eSopenharmony_ci   * Requests delayed transition to the suspended state.
16161847f8eSopenharmony_ci   *
16261847f8eSopenharmony_ci   * @param { string } reason - Indicates the reason for delayed transition to the suspended state.
16361847f8eSopenharmony_ci   * @param { Callback<void> } callback - The callback delay time expired.
16461847f8eSopenharmony_ci   * @returns { DelaySuspendInfo } Info of delay request.
16561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
16661847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types.
16761847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
16861847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
16961847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
17061847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
17161847f8eSopenharmony_ci   * @throws { BusinessError } 9900001 - Caller information verification failed for a transient task.
17261847f8eSopenharmony_ci   * @throws { BusinessError } 9900002 - Transient task verification failed.
17361847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
17461847f8eSopenharmony_ci   * @since 9
17561847f8eSopenharmony_ci   */
17661847f8eSopenharmony_ci  function requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspendInfo;
17761847f8eSopenharmony_ci
17861847f8eSopenharmony_ci  /**
17961847f8eSopenharmony_ci   * Service ability uses this method to request start running in background.
18061847f8eSopenharmony_ci   * <p> System will publish a notification related to the this service. </p>
18161847f8eSopenharmony_ci   *
18261847f8eSopenharmony_ci   * @permission ohos.permission.KEEP_BACKGROUND_RUNNING
18361847f8eSopenharmony_ci   * @param { Context } context - App running context.
18461847f8eSopenharmony_ci   * @param { BackgroundMode } bgMode - Indicates which background mode to request.
18561847f8eSopenharmony_ci   * @param { WantAgent } wantAgent - Indicates which ability to start when user click the notification bar.
18661847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of the function.
18761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
18861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Not System App.
18961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
19061847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
19161847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
19261847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
19361847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
19461847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
19561847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
19661847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
19761847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
19861847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
19961847f8eSopenharmony_ci   * @since 9
20061847f8eSopenharmony_ci   */
20161847f8eSopenharmony_ci  /**
20261847f8eSopenharmony_ci   * Service ability uses this method to request start running in background.
20361847f8eSopenharmony_ci   * <p> System will publish a notification related to the this service. </p>
20461847f8eSopenharmony_ci   *
20561847f8eSopenharmony_ci   * @permission ohos.permission.KEEP_BACKGROUND_RUNNING
20661847f8eSopenharmony_ci   * @param { Context } context - App running context.
20761847f8eSopenharmony_ci   * @param { BackgroundMode } bgMode - Indicates which background mode to request.
20861847f8eSopenharmony_ci   * @param { WantAgent } wantAgent - Indicates which ability to start when user click the notification bar.
20961847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of the function.
21061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
21161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Not System App.
21261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
21361847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
21461847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
21561847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
21661847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
21761847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
21861847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
21961847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
22061847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
22161847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
22261847f8eSopenharmony_ci   * @atomicservice
22361847f8eSopenharmony_ci   * @since 12
22461847f8eSopenharmony_ci   */
22561847f8eSopenharmony_ci  function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback<void>): void;
22661847f8eSopenharmony_ci
22761847f8eSopenharmony_ci  /**
22861847f8eSopenharmony_ci   * Service ability uses this method to request start running in background.
22961847f8eSopenharmony_ci   * <p> System will publish a notification related to the this service. </p>
23061847f8eSopenharmony_ci   *
23161847f8eSopenharmony_ci   * @permission ohos.permission.KEEP_BACKGROUND_RUNNING
23261847f8eSopenharmony_ci   * @param { Context } context - App running context.
23361847f8eSopenharmony_ci   * @param { BackgroundMode } bgMode - Indicates which background mode to request.
23461847f8eSopenharmony_ci   * @param { WantAgent } wantAgent - Indicates which ability to start when user click the notification bar.
23561847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
23661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
23761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Not System App.
23861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
23961847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
24061847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
24161847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
24261847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
24361847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
24461847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
24561847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
24661847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
24761847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
24861847f8eSopenharmony_ci   * @since 9
24961847f8eSopenharmony_ci   */
25061847f8eSopenharmony_ci  /**
25161847f8eSopenharmony_ci   * Service ability uses this method to request start running in background.
25261847f8eSopenharmony_ci   * <p> System will publish a notification related to the this service. </p>
25361847f8eSopenharmony_ci   *
25461847f8eSopenharmony_ci   * @permission ohos.permission.KEEP_BACKGROUND_RUNNING
25561847f8eSopenharmony_ci   * @param { Context } context - App running context.
25661847f8eSopenharmony_ci   * @param { BackgroundMode } bgMode - Indicates which background mode to request.
25761847f8eSopenharmony_ci   * @param { WantAgent } wantAgent - Indicates which ability to start when user click the notification bar.
25861847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
25961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
26061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Not System App.
26161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
26261847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
26361847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
26461847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
26561847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
26661847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
26761847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
26861847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
26961847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
27061847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
27161847f8eSopenharmony_ci   * @atomicservice
27261847f8eSopenharmony_ci   * @since 12
27361847f8eSopenharmony_ci   */
27461847f8eSopenharmony_ci  function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise<void>;
27561847f8eSopenharmony_ci
27661847f8eSopenharmony_ci  /**
27761847f8eSopenharmony_ci   * UIAbility uses this method to request start running in background.
27861847f8eSopenharmony_ci   * <p> System will publish a notification related to the UIAbility. </p>
27961847f8eSopenharmony_ci   *
28061847f8eSopenharmony_ci   * @permission ohos.permission.KEEP_BACKGROUND_RUNNING
28161847f8eSopenharmony_ci   * @param { Context } context - App running context.
28261847f8eSopenharmony_ci   * @param { string[] } bgModes - Indicates which background mode to request.
28361847f8eSopenharmony_ci   * @param { WantAgent } wantAgent - Indicates which ability to start when user click the notification bar.
28461847f8eSopenharmony_ci   * @returns { Promise<ContinuousTaskNotification> } The The continuous task notification.
28561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
28661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
28761847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
28861847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
28961847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
29061847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
29161847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
29261847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
29361847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
29461847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
29561847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
29661847f8eSopenharmony_ci   * @atomicservice
29761847f8eSopenharmony_ci   * @since 12
29861847f8eSopenharmony_ci   */
29961847f8eSopenharmony_ci  function startBackgroundRunning(context: Context, bgModes: string[], wantAgent: WantAgent): Promise<ContinuousTaskNotification>;
30061847f8eSopenharmony_ci
30161847f8eSopenharmony_ci  /**
30261847f8eSopenharmony_ci   * UIAbility uses this method to update background mode.
30361847f8eSopenharmony_ci   *
30461847f8eSopenharmony_ci   * @permission ohos.permission.KEEP_BACKGROUND_RUNNING
30561847f8eSopenharmony_ci   * @param { Context } context - App running context.
30661847f8eSopenharmony_ci   * @param { string[] } bgModes - Indicates which background mode to request.
30761847f8eSopenharmony_ci   * @returns { Promise<ContinuousTaskNotification> } The continuous task notification.
30861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
30961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
31061847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
31161847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
31261847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
31361847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
31461847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
31561847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
31661847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
31761847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
31861847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
31961847f8eSopenharmony_ci   * @atomicservice
32061847f8eSopenharmony_ci   * @since 12
32161847f8eSopenharmony_ci   */
32261847f8eSopenharmony_ci  function updateBackgroundRunning(context: Context, bgModes: string[]): Promise<ContinuousTaskNotification>;
32361847f8eSopenharmony_ci
32461847f8eSopenharmony_ci  /**
32561847f8eSopenharmony_ci   * Service ability uses this method to request stop running in background.
32661847f8eSopenharmony_ci   *
32761847f8eSopenharmony_ci   * @param { Context } context - App running context.
32861847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of the function.
32961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
33061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
33161847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
33261847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
33361847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
33461847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
33561847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
33661847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
33761847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
33861847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
33961847f8eSopenharmony_ci   * @since 9
34061847f8eSopenharmony_ci   */
34161847f8eSopenharmony_ci  /**
34261847f8eSopenharmony_ci   * Service ability uses this method to request stop running in background.
34361847f8eSopenharmony_ci   *
34461847f8eSopenharmony_ci   * @param { Context } context - App running context.
34561847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of the function.
34661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
34761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
34861847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
34961847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
35061847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
35161847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
35261847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
35361847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
35461847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
35561847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
35661847f8eSopenharmony_ci   * @atomicservice
35761847f8eSopenharmony_ci   * @since 12
35861847f8eSopenharmony_ci   */
35961847f8eSopenharmony_ci  function stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): void;
36061847f8eSopenharmony_ci
36161847f8eSopenharmony_ci  /**
36261847f8eSopenharmony_ci   * Service ability uses this method to request stop running in background.
36361847f8eSopenharmony_ci   *
36461847f8eSopenharmony_ci   * @param { Context } context - App running context.
36561847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
36661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
36761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
36861847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
36961847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
37061847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
37161847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
37261847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
37361847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
37461847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
37561847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
37661847f8eSopenharmony_ci   * @since 9
37761847f8eSopenharmony_ci   */
37861847f8eSopenharmony_ci  /**
37961847f8eSopenharmony_ci   * Service ability uses this method to request stop running in background.
38061847f8eSopenharmony_ci   *
38161847f8eSopenharmony_ci   * @param { Context } context - App running context.
38261847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function.
38361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
38461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
38561847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
38661847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
38761847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
38861847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
38961847f8eSopenharmony_ci   * @throws { BusinessError } 9800005 - Continuous task verification failed.
39061847f8eSopenharmony_ci   * @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
39161847f8eSopenharmony_ci   * @throws { BusinessError } 9800007 - Continuous task storage failed.
39261847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
39361847f8eSopenharmony_ci   * @atomicservice
39461847f8eSopenharmony_ci   * @since 12
39561847f8eSopenharmony_ci   */
39661847f8eSopenharmony_ci  function stopBackgroundRunning(context: Context): Promise<void>;
39761847f8eSopenharmony_ci
39861847f8eSopenharmony_ci  /**
39961847f8eSopenharmony_ci   * Apply or unapply efficiency resources.
40061847f8eSopenharmony_ci   *
40161847f8eSopenharmony_ci   * @param { EfficiencyResourcesRequest } request - The request of apply or unapply efficiency resources.
40261847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
40361847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Not System App.
40461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
40561847f8eSopenharmony_ci   * <br> 2. Incorrect parameters types; 3. Parameter verification failed.
40661847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
40761847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
40861847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
40961847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
41061847f8eSopenharmony_ci   * @throws { BusinessError } 18700001 - Caller information verification failed for an energy resource request.
41161847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
41261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
41361847f8eSopenharmony_ci   * @since 9
41461847f8eSopenharmony_ci   */
41561847f8eSopenharmony_ci  function applyEfficiencyResources(request: EfficiencyResourcesRequest): void;
41661847f8eSopenharmony_ci
41761847f8eSopenharmony_ci  /**
41861847f8eSopenharmony_ci   * Reset all efficiency resources apply.
41961847f8eSopenharmony_ci   *
42061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
42161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Not System App.
42261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Parameter verification failed.
42361847f8eSopenharmony_ci   * @throws { BusinessError } 9800001 - Memory operation failed.
42461847f8eSopenharmony_ci   * @throws { BusinessError } 9800002 - Parcel operation failed.
42561847f8eSopenharmony_ci   * @throws { BusinessError } 9800003 - Internal transaction failed.
42661847f8eSopenharmony_ci   * @throws { BusinessError } 9800004 - System service operation failed.
42761847f8eSopenharmony_ci   * @throws { BusinessError } 18700001 - Caller information verification failed for an energy resource request.
42861847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
42961847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
43061847f8eSopenharmony_ci   * @since 9
43161847f8eSopenharmony_ci   */
43261847f8eSopenharmony_ci  function resetAllEfficiencyResources(): void;
43361847f8eSopenharmony_ci
43461847f8eSopenharmony_ci  /**
43561847f8eSopenharmony_ci   * Supported background mode.
43661847f8eSopenharmony_ci   *
43761847f8eSopenharmony_ci   * @enum { number }
43861847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
43961847f8eSopenharmony_ci   * @since 9
44061847f8eSopenharmony_ci   */
44161847f8eSopenharmony_ci  /**
44261847f8eSopenharmony_ci   * Supported background mode.
44361847f8eSopenharmony_ci   *
44461847f8eSopenharmony_ci   * @enum { number }
44561847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
44661847f8eSopenharmony_ci   * @atomicservice
44761847f8eSopenharmony_ci   * @since 12
44861847f8eSopenharmony_ci   */
44961847f8eSopenharmony_ci  export enum BackgroundMode {
45061847f8eSopenharmony_ci    /**
45161847f8eSopenharmony_ci     * data transfer mode
45261847f8eSopenharmony_ci     *
45361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
45461847f8eSopenharmony_ci     * @since 9
45561847f8eSopenharmony_ci     */
45661847f8eSopenharmony_ci    DATA_TRANSFER = 1,
45761847f8eSopenharmony_ci
45861847f8eSopenharmony_ci    /**
45961847f8eSopenharmony_ci     * audio playback mode
46061847f8eSopenharmony_ci     *
46161847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
46261847f8eSopenharmony_ci     * @since 9
46361847f8eSopenharmony_ci     */
46461847f8eSopenharmony_ci    /**
46561847f8eSopenharmony_ci     * audio playback mode
46661847f8eSopenharmony_ci     *
46761847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
46861847f8eSopenharmony_ci     * @atomicservice
46961847f8eSopenharmony_ci     * @since 12
47061847f8eSopenharmony_ci     */
47161847f8eSopenharmony_ci    AUDIO_PLAYBACK = 2,
47261847f8eSopenharmony_ci
47361847f8eSopenharmony_ci    /**
47461847f8eSopenharmony_ci     * audio recording mode
47561847f8eSopenharmony_ci     *
47661847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
47761847f8eSopenharmony_ci     * @since 9
47861847f8eSopenharmony_ci     */
47961847f8eSopenharmony_ci    AUDIO_RECORDING = 3,
48061847f8eSopenharmony_ci
48161847f8eSopenharmony_ci    /**
48261847f8eSopenharmony_ci     * location mode
48361847f8eSopenharmony_ci     *
48461847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
48561847f8eSopenharmony_ci     * @since 9
48661847f8eSopenharmony_ci     */
48761847f8eSopenharmony_ci    LOCATION = 4,
48861847f8eSopenharmony_ci
48961847f8eSopenharmony_ci    /**
49061847f8eSopenharmony_ci     * bluetooth interaction mode
49161847f8eSopenharmony_ci     *
49261847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
49361847f8eSopenharmony_ci     * @since 9
49461847f8eSopenharmony_ci     */
49561847f8eSopenharmony_ci    BLUETOOTH_INTERACTION = 5,
49661847f8eSopenharmony_ci
49761847f8eSopenharmony_ci    /**
49861847f8eSopenharmony_ci     * multi-device connection mode
49961847f8eSopenharmony_ci     *
50061847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
50161847f8eSopenharmony_ci     * @since 9
50261847f8eSopenharmony_ci     */
50361847f8eSopenharmony_ci    /**
50461847f8eSopenharmony_ci     * multi-device connection mode
50561847f8eSopenharmony_ci     *
50661847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
50761847f8eSopenharmony_ci     * @atomicservice
50861847f8eSopenharmony_ci     * @since 12
50961847f8eSopenharmony_ci     */
51061847f8eSopenharmony_ci    MULTI_DEVICE_CONNECTION = 6,
51161847f8eSopenharmony_ci
51261847f8eSopenharmony_ci    /**
51361847f8eSopenharmony_ci     * wifi interaction mode
51461847f8eSopenharmony_ci     *
51561847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
51661847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
51761847f8eSopenharmony_ci     * @since 9
51861847f8eSopenharmony_ci     */
51961847f8eSopenharmony_ci    WIFI_INTERACTION = 7,
52061847f8eSopenharmony_ci
52161847f8eSopenharmony_ci    /**
52261847f8eSopenharmony_ci     * Voice over Internet Phone mode
52361847f8eSopenharmony_ci     *
52461847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
52561847f8eSopenharmony_ci     * @since 13
52661847f8eSopenharmony_ci     */
52761847f8eSopenharmony_ci    VOIP = 8,
52861847f8eSopenharmony_ci
52961847f8eSopenharmony_ci    /**
53061847f8eSopenharmony_ci     * background continuous calculate mode, for example 3D render.
53161847f8eSopenharmony_ci     * only supported in particular device
53261847f8eSopenharmony_ci     *
53361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
53461847f8eSopenharmony_ci     * @since 9
53561847f8eSopenharmony_ci     */
53661847f8eSopenharmony_ci    TASK_KEEPING = 9,
53761847f8eSopenharmony_ci  }
53861847f8eSopenharmony_ci
53961847f8eSopenharmony_ci  /**
54061847f8eSopenharmony_ci   * The type of resource.
54161847f8eSopenharmony_ci   *
54261847f8eSopenharmony_ci   * @enum { number }
54361847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
54461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
54561847f8eSopenharmony_ci   * @since 9
54661847f8eSopenharmony_ci   */
54761847f8eSopenharmony_ci  export enum ResourceType {
54861847f8eSopenharmony_ci    /**
54961847f8eSopenharmony_ci     * The cpu resource for not being suspended.
55061847f8eSopenharmony_ci     *
55161847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
55261847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
55361847f8eSopenharmony_ci     * @since 9
55461847f8eSopenharmony_ci     */
55561847f8eSopenharmony_ci    CPU = 1,
55661847f8eSopenharmony_ci
55761847f8eSopenharmony_ci    /**
55861847f8eSopenharmony_ci     * The resource for not being proxyed common_event.
55961847f8eSopenharmony_ci     *
56061847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
56161847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
56261847f8eSopenharmony_ci     * @since 9
56361847f8eSopenharmony_ci     */
56461847f8eSopenharmony_ci    COMMON_EVENT = 1 << 1,
56561847f8eSopenharmony_ci
56661847f8eSopenharmony_ci    /**
56761847f8eSopenharmony_ci     * The resource for not being proxyed timer.
56861847f8eSopenharmony_ci     *
56961847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
57061847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
57161847f8eSopenharmony_ci     * @since 9
57261847f8eSopenharmony_ci     */
57361847f8eSopenharmony_ci    TIMER = 1 << 2,
57461847f8eSopenharmony_ci
57561847f8eSopenharmony_ci    /**
57661847f8eSopenharmony_ci     * The resource for not being proxyed workscheduler.
57761847f8eSopenharmony_ci     *
57861847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
57961847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
58061847f8eSopenharmony_ci     * @since 9
58161847f8eSopenharmony_ci     */
58261847f8eSopenharmony_ci    WORK_SCHEDULER = 1 << 3,
58361847f8eSopenharmony_ci
58461847f8eSopenharmony_ci    /**
58561847f8eSopenharmony_ci     * The resource for not being proxyed bluetooth.
58661847f8eSopenharmony_ci     *
58761847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
58861847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
58961847f8eSopenharmony_ci     * @since 9
59061847f8eSopenharmony_ci     */
59161847f8eSopenharmony_ci    BLUETOOTH = 1 << 4,
59261847f8eSopenharmony_ci
59361847f8eSopenharmony_ci    /**
59461847f8eSopenharmony_ci     * The resource for not being proxyed gps.
59561847f8eSopenharmony_ci     *
59661847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
59761847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
59861847f8eSopenharmony_ci     * @since 9
59961847f8eSopenharmony_ci     */
60061847f8eSopenharmony_ci    GPS = 1 << 5,
60161847f8eSopenharmony_ci
60261847f8eSopenharmony_ci    /**
60361847f8eSopenharmony_ci     * The resource for not being proxyed audio.
60461847f8eSopenharmony_ci     *
60561847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
60661847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
60761847f8eSopenharmony_ci     * @since 9
60861847f8eSopenharmony_ci     */
60961847f8eSopenharmony_ci    AUDIO = 1 << 6,
61061847f8eSopenharmony_ci
61161847f8eSopenharmony_ci    /**
61261847f8eSopenharmony_ci     * The resource for not being proxyed running lock.
61361847f8eSopenharmony_ci     *
61461847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
61561847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
61661847f8eSopenharmony_ci     * @since 10
61761847f8eSopenharmony_ci     */
61861847f8eSopenharmony_ci    RUNNING_LOCK = 1 << 7,
61961847f8eSopenharmony_ci
62061847f8eSopenharmony_ci    /**
62161847f8eSopenharmony_ci     * The resource for not being proxyed sensor.
62261847f8eSopenharmony_ci     *
62361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
62461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
62561847f8eSopenharmony_ci     * @since 10
62661847f8eSopenharmony_ci     */
62761847f8eSopenharmony_ci    SENSOR = 1 << 8
62861847f8eSopenharmony_ci  }
62961847f8eSopenharmony_ci
63061847f8eSopenharmony_ci  /**
63161847f8eSopenharmony_ci   * The request of efficiency resources.
63261847f8eSopenharmony_ci   *
63361847f8eSopenharmony_ci   * @interface EfficiencyResourcesRequest
63461847f8eSopenharmony_ci   * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
63561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
63661847f8eSopenharmony_ci   * @since 9
63761847f8eSopenharmony_ci   */
63861847f8eSopenharmony_ci  export interface EfficiencyResourcesRequest {
63961847f8eSopenharmony_ci    /**
64061847f8eSopenharmony_ci     * The set of resource types that app wants to apply.
64161847f8eSopenharmony_ci     *
64261847f8eSopenharmony_ci     * @type { number }
64361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
64461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
64561847f8eSopenharmony_ci     * @since 9
64661847f8eSopenharmony_ci     */
64761847f8eSopenharmony_ci    resourceTypes: number;
64861847f8eSopenharmony_ci
64961847f8eSopenharmony_ci    /**
65061847f8eSopenharmony_ci     * True if the app begin to use, else false.
65161847f8eSopenharmony_ci     *
65261847f8eSopenharmony_ci     * @type { boolean }
65361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
65461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
65561847f8eSopenharmony_ci     * @since 9
65661847f8eSopenharmony_ci     */
65761847f8eSopenharmony_ci    isApply: boolean;
65861847f8eSopenharmony_ci
65961847f8eSopenharmony_ci    /**
66061847f8eSopenharmony_ci     * The duration that the resource can be used most.
66161847f8eSopenharmony_ci     *
66261847f8eSopenharmony_ci     * @type { number }
66361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
66461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
66561847f8eSopenharmony_ci     * @since 9
66661847f8eSopenharmony_ci     */
66761847f8eSopenharmony_ci    timeOut: number;
66861847f8eSopenharmony_ci
66961847f8eSopenharmony_ci    /**
67061847f8eSopenharmony_ci     * True if the apply action is persist, else false. Default value is false.
67161847f8eSopenharmony_ci     *
67261847f8eSopenharmony_ci     * @type { ?boolean }
67361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
67461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
67561847f8eSopenharmony_ci     * @since 9
67661847f8eSopenharmony_ci     */
67761847f8eSopenharmony_ci    isPersist?: boolean;
67861847f8eSopenharmony_ci
67961847f8eSopenharmony_ci    /**
68061847f8eSopenharmony_ci     * True if apply action is for process, false is for package. Default value is false.
68161847f8eSopenharmony_ci     *
68261847f8eSopenharmony_ci     * @type { ?boolean }
68361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
68461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
68561847f8eSopenharmony_ci     * @since 9
68661847f8eSopenharmony_ci     */
68761847f8eSopenharmony_ci    isProcess?: boolean;
68861847f8eSopenharmony_ci
68961847f8eSopenharmony_ci    /**
69061847f8eSopenharmony_ci     * The apply reason.
69161847f8eSopenharmony_ci     *
69261847f8eSopenharmony_ci     * @type { string }
69361847f8eSopenharmony_ci     * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
69461847f8eSopenharmony_ci     * @systemapi Hide this for inner system use.
69561847f8eSopenharmony_ci     * @since 9
69661847f8eSopenharmony_ci     */
69761847f8eSopenharmony_ci    reason: string;
69861847f8eSopenharmony_ci  }
69961847f8eSopenharmony_ci}
70061847f8eSopenharmony_ci
70161847f8eSopenharmony_ciexport default backgroundTaskManager;
702