diff --git a/api/@ohos.backgroundTaskManager.d.ts b/api/@ohos.backgroundTaskManager.d.ts index 4d02b29d421478b760b1b8f2df760ae525b7115b..be2f05e440656999fca9798db04fca173d6ca7fa 100644 --- a/api/@ohos.backgroundTaskManager.d.ts +++ b/api/@ohos.backgroundTaskManager.d.ts @@ -97,6 +97,25 @@ declare namespace backgroundTaskManager { function stopBackgroundRunning(context: Context, callback: AsyncCallback): void; function stopBackgroundRunning(context: Context): Promise; + /** + * Apply or unapply efficency resources. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficencyResourcesApply + * @return True if efficency resources apply success, else false. + * @systemapi Hide this for inner system use. + */ + function applyEfficencyResources(request: EfficencyResourcesRequest): bool; + + /** + * Reset all efficency resources apply. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficencyResourcesApply. + * @systemapi Hide this for inner system use. + */ + function resetAllEfficencyResources(): void; + /** * supported background mode. * @@ -179,6 +198,89 @@ declare namespace backgroundTaskManager { */ TASK_KEEPING = 9, } + + /** + * The type of resource. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficencyResourcesApply. + * @systemapi Hide this for inner system use. + */ + export enum ResourceType { + /** + * The cpu resource for not being suspended. + */ + CPU = 1, + + /** + * The resource for not being proxyed common_event. + */ + COMMON_EVENT = 1 << 1, + + /** + * The resource for not being proxyed timer. + */ + TIMER = 1 << 2, + + /** + * The resource for not being proxyed workscheduler. + */ + WORK_SCHEDULER = 1 << 3, + + /** + * The resource for not being proxyed bluetooth. + */ + BLUETOOTH = 1 << 4, + + /** + * The resource for not being proxyed gps. + */ + GPS = 1 << 5, + + /** + * The resource for not being proxyed audio. + */ + AUDIO = 1 << 6 + } + + /** + * The request of efficency resources. + * + * @name EfficencyResourcesRequest + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficencyResourcesApply. + * @systemapi Hide this for inner system use. + */ + export interface EfficencyResourcesRequest { + /** + * The set of resource types that app wants to apply. + */ + resourceTypes: number; + + /** + * True if the app begin to use, else false. + */ + isApply: bool; + + /** + * The duration that the resource can be used most. + */ + timeOut: number; + + /** + * True if the apply action is persist, else false. Default value is false. + */ + isPersist?: bool; + + /** + * True if apply action is for process, false is for package. Default value is false. + */ + isProcess?: false; + /** + * The apply reason. + */ + reason: string; + } } export default backgroundTaskManager; diff --git a/api/@ohos.workScheduler.d.ts b/api/@ohos.workScheduler.d.ts index 74ea4e974073d5021ecfedb3bfafbac044e7b12b..67606bcf855368da4f795d6e192a9c62e91396a7 100644 --- a/api/@ohos.workScheduler.d.ts +++ b/api/@ohos.workScheduler.d.ts @@ -92,6 +92,10 @@ declare namespace workScheduler { * 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}; } /**