diff --git a/api/@ohos.resourceschedule.backgroundTaskManager.d.ts b/api/@ohos.resourceschedule.backgroundTaskManager.d.ts index fad30a7ad5bf95e590f509768625fcc5c11d1412..9b82d9d302d74fa5c4b218c0c80b8d46b83babd5 100644 --- a/api/@ohos.resourceschedule.backgroundTaskManager.d.ts +++ b/api/@ohos.resourceschedule.backgroundTaskManager.d.ts @@ -21,7 +21,7 @@ import Context from './application/BaseContext'; * Manages background tasks. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.TransientTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask */ declare namespace backgroundTaskManager { /** @@ -29,7 +29,7 @@ declare namespace backgroundTaskManager { * * @name DelaySuspendInfo * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.TransientTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask */ interface DelaySuspendInfo { /** @@ -46,7 +46,7 @@ declare namespace backgroundTaskManager { * Cancels delayed transition to the suspended state. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.TransientTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask * @param requestId Indicates the identifier of the delay request. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 9800001 - Memory operation failed. @@ -62,7 +62,7 @@ declare namespace backgroundTaskManager { * Obtains the remaining time before an application enters the suspended state. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.TransientTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask * @param requestId Indicates the identifier of the delay request. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 9800001 - Memory operation failed. @@ -80,7 +80,7 @@ declare namespace backgroundTaskManager { * Requests delayed transition to the suspended state. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.TransientTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask * @param reason Indicates the reason for delayed transition to the suspended state. * @param callback The callback delay time expired. * @throws { BusinessError } 401 - Parameter error. @@ -99,7 +99,7 @@ declare namespace backgroundTaskManager { * system will publish a notification related to the this service. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask * @permission ohos.permission.KEEP_BACKGROUND_RUNNING * @param context app running context. * @param bgMode Indicates which background mode to request. @@ -121,7 +121,7 @@ declare namespace backgroundTaskManager { * Service ability uses this method to request stop running in background. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask * @param context app running context. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Parameter error. @@ -140,7 +140,7 @@ declare namespace backgroundTaskManager { * Apply or unapply efficiency resources. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.EfficiencyResourcesApply + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 9800001 - Memory operation failed. @@ -156,7 +156,7 @@ declare namespace backgroundTaskManager { * Reset all efficiency resources apply. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.EfficiencyResourcesApply + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply * @systemapi Hide this for inner system use. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Parameter error. @@ -172,14 +172,14 @@ declare namespace backgroundTaskManager { * Supported background mode. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask */ export enum BackgroundMode { /** * data transfer mode * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask */ DATA_TRANSFER = 1, @@ -187,7 +187,7 @@ declare namespace backgroundTaskManager { * audio playback mode * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask */ AUDIO_PLAYBACK = 2, @@ -195,7 +195,7 @@ declare namespace backgroundTaskManager { * audio recording mode * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask */ AUDIO_RECORDING = 3, @@ -203,7 +203,7 @@ declare namespace backgroundTaskManager { * location mode * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask */ LOCATION = 4, @@ -211,7 +211,7 @@ declare namespace backgroundTaskManager { * bluetooth interaction mode * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask */ BLUETOOTH_INTERACTION = 5, @@ -219,7 +219,7 @@ declare namespace backgroundTaskManager { * multi-device connection mode * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask */ MULTI_DEVICE_CONNECTION = 6, @@ -227,7 +227,7 @@ declare namespace backgroundTaskManager { * wifi interaction mode * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask * @systemapi Hide this for inner system use. */ WIFI_INTERACTION = 7, @@ -236,7 +236,7 @@ declare namespace backgroundTaskManager { * Voice over Internet Phone mode * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask * @systemapi Hide this for inner system use. */ VOIP = 8, @@ -246,7 +246,7 @@ declare namespace backgroundTaskManager { * only supported in particular device * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.ContinuousTask + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask */ TASK_KEEPING = 9, } @@ -255,7 +255,7 @@ declare namespace backgroundTaskManager { * The type of resource. * * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.EfficiencyResourcesApply + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply * @systemapi Hide this for inner system use. */ export enum ResourceType { @@ -300,7 +300,7 @@ declare namespace backgroundTaskManager { * * @name EfficiencyResourcesRequest * @since 9 - * @syscap SystemCapability.ResourceSchedule.backgroundTaskManager.EfficiencyResourcesApply + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply * @systemapi Hide this for inner system use. */ export interface EfficiencyResourcesRequest { diff --git a/api/@ohos.workScheduler.d.ts b/api/@ohos.workScheduler.d.ts index 65a48799614c64959ba4ae5e1e818c8a93ea298f..27999fb23dd651dbe1e277af210a3a9a1da2fd7b 100644 --- a/api/@ohos.workScheduler.d.ts +++ b/api/@ohos.workScheduler.d.ts @@ -1,301 +1,301 @@ -/* - * 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} from './basic'; - -/** - * Work scheduler interface. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler - */ -declare namespace workScheduler { - /** - * The info of work. - * - * @name WorkInfo - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.WorkInfo - */ - export interface WorkInfo { - /** - * The id of the current work. - */ - workId: number; - /** - * The bundle name of the current work. - */ - bundleName: string; - /** - * The ability name of the current work. - */ - abilityName: string; - /** - * Whether the current work will be saved. - */ - isPersisted?: boolean; - /** - * The network type of the current work. - */ - networkType?: NetworkType; - /** - * Whether a charging state has been set for triggering the work. - */ - isCharging?: boolean; - /** - * The charger type based on which the work is triggered. - */ - chargerType?: ChargingType; - /** - * The battery level for triggering a work. - */ - batteryLevel?: number; - /** - * The battery status for triggering a work. - */ - batteryStatus?: BatteryStatus; - /** - * Whether a storage state has been set for triggering the work. - */ - storageRequest?: StorageRequest; - /** - * The interval at which the work is repeated. - */ - repeatCycleTime?: number; - /** - * Whether the work has been set to repeat at the specified interval. - */ - isRepeat?: boolean; - /** - * The repeat of the current work. - */ - repeatCount?: number; - /** - * Whether the device deep idle state has been set for triggering the work. - */ - isDeepIdle?: boolean; - /** - * The idle wait time based on which the work is triggered. - */ - idleWaitTime?: number; - /** - * The parameters of the work. The value is only supported basic type(Number, String, Boolean). - */ - parameters?: {[key: string]: any}; - } - - /** - * Add a work to the queue. A work can be executed only when it meets the preset triggering condition - * and complies with the rules of work scheduler manager. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @param work The info of work. - * @return true if success, otherwise false. - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.startWork - */ - function startWork(work: WorkInfo): boolean; - - /** - * Stop a work. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @param work The info of work. - * @param needCancel True if need to be canceled after being stopped, otherwise false. - * @return true if success, otherwise false. - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.stopWork - */ - function stopWork(work: WorkInfo, needCancel?: boolean): boolean; - - /** - * Obtains the work info of the wordId. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @param workId The id of work. - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.getWorkStatus - */ - function getWorkStatus(workId: number, callback: AsyncCallback): void; - function getWorkStatus(workId: number): Promise; - - /** - * Get all works of the calling application. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @return the work info list. - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.obtainAllWorks - */ - function obtainAllWorks(callback: AsyncCallback): Array; - function obtainAllWorks(): Promise>; - - /** - * Stop all and clear all works of the calling application. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @return true if success, otherwise false. - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.stopAndClearWorks - */ - function stopAndClearWorks(): boolean; - - /** - * Check whether last work running is timeout. The interface is for repeating work. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @param workId The id of work. - * @return true if last work running is timeout, otherwise false. - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.isLastWorkTimeOut - */ - function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean; - function isLastWorkTimeOut(workId: number): Promise; - - /** - * Describes network type. - * - * @name NetworkType - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.NetworkType - */ - export enum NetworkType { - /** - * Describes any network connection. - */ - NETWORK_TYPE_ANY = 0, - /** - * Describes a mobile network connection. - */ - NETWORK_TYPE_MOBILE, - /** - * Describes a wifi network connection. - */ - NETWORK_TYPE_WIFI, - /** - * Describes a bluetooth network connection. - */ - NETWORK_TYPE_BLUETOOTH, - /** - * Describes a wifi p2p network connection. - */ - NETWORK_TYPE_WIFI_P2P, - /** - * Describes a wifi wire network connection. - */ - NETWORK_TYPE_ETHERNET - } - - /** - * Describes charging type. - * - * @name ChargingType - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.ChargingType - */ - export enum ChargingType { - /** - * Describes any charger is connected. - */ - CHARGING_PLUGGED_ANY = 0, - /** - * Describes ac charger is connected. - */ - CHARGING_PLUGGED_AC, - /** - * Describes usb charger is connected. - */ - CHARGING_PLUGGED_USB, - /** - * Describes wireless charger is connected. - */ - CHARGING_PLUGGED_WIRELESS - } - - /** - * Describes the battery status. - * - * @name BatteryStatus - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.BatteryStatus - */ - export enum BatteryStatus { - /** - * Describes battery status is to low. - */ - BATTERY_STATUS_LOW = 0, - /** - * Describes battery status is to ok. - */ - BATTERY_STATUS_OKAY, - /** - * Describes battery status is to low or ok. - */ - BATTERY_STATUS_LOW_OR_OKAY - } - - /** - * Describes the storage request. - * - * @name StorageRequest - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @deprecated since 9 - * @useinstead ohos.resourceschedule.workScheduler.StorageRequest - */ - export enum StorageRequest { - /** - * Describes storage is to low. - */ - STORAGE_LEVEL_LOW = 0, - /** - * Describes storage is to ok. - */ - STORAGE_LEVEL_OKAY, - /** - * Describes storage is to low or ok. - */ - STORAGE_LEVEL_LOW_OR_OKAY - } -} +/* + * 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} from './basic'; + +/** + * Work scheduler interface. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler + */ +declare namespace workScheduler { + /** + * The info of work. + * + * @name WorkInfo + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.WorkInfo + */ + export interface WorkInfo { + /** + * The id of the current work. + */ + workId: number; + /** + * The bundle name of the current work. + */ + bundleName: string; + /** + * The ability name of the current work. + */ + abilityName: string; + /** + * Whether the current work will be saved. + */ + isPersisted?: boolean; + /** + * The network type of the current work. + */ + networkType?: NetworkType; + /** + * Whether a charging state has been set for triggering the work. + */ + isCharging?: boolean; + /** + * The charger type based on which the work is triggered. + */ + chargerType?: ChargingType; + /** + * The battery level for triggering a work. + */ + batteryLevel?: number; + /** + * The battery status for triggering a work. + */ + batteryStatus?: BatteryStatus; + /** + * Whether a storage state has been set for triggering the work. + */ + storageRequest?: StorageRequest; + /** + * The interval at which the work is repeated. + */ + repeatCycleTime?: number; + /** + * Whether the work has been set to repeat at the specified interval. + */ + isRepeat?: boolean; + /** + * The repeat of the current work. + */ + repeatCount?: number; + /** + * Whether the device deep idle state has been set for triggering the work. + */ + isDeepIdle?: boolean; + /** + * The idle wait time based on which the work is triggered. + */ + idleWaitTime?: number; + /** + * The parameters of the work. The value is only supported basic type(Number, String, Boolean). + */ + parameters?: {[key: string]: any}; + } + + /** + * Add a work to the queue. A work can be executed only when it meets the preset triggering condition + * and complies with the rules of work scheduler manager. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @param work The info of work. + * @return true if success, otherwise false. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.startWork + */ + function startWork(work: WorkInfo): boolean; + + /** + * Stop a work. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @param work The info of work. + * @param needCancel True if need to be canceled after being stopped, otherwise false. + * @return true if success, otherwise false. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.stopWork + */ + function stopWork(work: WorkInfo, needCancel?: boolean): boolean; + + /** + * Obtains the work info of the wordId. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @param workId The id of work. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.getWorkStatus + */ + function getWorkStatus(workId: number, callback: AsyncCallback): void; + function getWorkStatus(workId: number): Promise; + + /** + * Get all works of the calling application. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @return the work info list. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.obtainAllWorks + */ + function obtainAllWorks(callback: AsyncCallback): Array; + function obtainAllWorks(): Promise>; + + /** + * Stop all and clear all works of the calling application. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @return true if success, otherwise false. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.stopAndClearWorks + */ + function stopAndClearWorks(): boolean; + + /** + * Check whether last work running is timeout. The interface is for repeating work. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @param workId The id of work. + * @return true if last work running is timeout, otherwise false. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.isLastWorkTimeOut + */ + function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean; + function isLastWorkTimeOut(workId: number): Promise; + + /** + * Describes network type. + * + * @name NetworkType + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.NetworkType + */ + export enum NetworkType { + /** + * Describes any network connection. + */ + NETWORK_TYPE_ANY = 0, + /** + * Describes a mobile network connection. + */ + NETWORK_TYPE_MOBILE, + /** + * Describes a wifi network connection. + */ + NETWORK_TYPE_WIFI, + /** + * Describes a bluetooth network connection. + */ + NETWORK_TYPE_BLUETOOTH, + /** + * Describes a wifi p2p network connection. + */ + NETWORK_TYPE_WIFI_P2P, + /** + * Describes a wifi wire network connection. + */ + NETWORK_TYPE_ETHERNET + } + + /** + * Describes charging type. + * + * @name ChargingType + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.ChargingType + */ + export enum ChargingType { + /** + * Describes any charger is connected. + */ + CHARGING_PLUGGED_ANY = 0, + /** + * Describes ac charger is connected. + */ + CHARGING_PLUGGED_AC, + /** + * Describes usb charger is connected. + */ + CHARGING_PLUGGED_USB, + /** + * Describes wireless charger is connected. + */ + CHARGING_PLUGGED_WIRELESS + } + + /** + * Describes the battery status. + * + * @name BatteryStatus + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.BatteryStatus + */ + export enum BatteryStatus { + /** + * Describes battery status is to low. + */ + BATTERY_STATUS_LOW = 0, + /** + * Describes battery status is to ok. + */ + BATTERY_STATUS_OKAY, + /** + * Describes battery status is to low or ok. + */ + BATTERY_STATUS_LOW_OR_OKAY + } + + /** + * Describes the storage request. + * + * @name StorageRequest + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.resourceschedule.workScheduler.StorageRequest + */ + export enum StorageRequest { + /** + * Describes storage is to low. + */ + STORAGE_LEVEL_LOW = 0, + /** + * Describes storage is to ok. + */ + STORAGE_LEVEL_OKAY, + /** + * Describes storage is to low or ok. + */ + STORAGE_LEVEL_LOW_OR_OKAY + } +} export default workScheduler; \ No newline at end of file