mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2025-02-27 12:37:27 +00:00
commit
f3fc2d43f8
103
api/@ohos.backgroundTaskManager.d.ts
vendored
103
api/@ohos.backgroundTaskManager.d.ts
vendored
@ -97,6 +97,25 @@ declare namespace backgroundTaskManager {
|
||||
function stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): void;
|
||||
function stopBackgroundRunning(context: Context): Promise<void>;
|
||||
|
||||
/**
|
||||
* Apply or unapply efficiency resources.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
|
||||
* @return True if efficiency resources apply success, else false.
|
||||
* @systemapi Hide this for inner system use.
|
||||
*/
|
||||
function applyEfficiencyResources(request: EfficiencyResourcesRequest): boolean;
|
||||
|
||||
/**
|
||||
* Reset all efficiency resources apply.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply.
|
||||
* @systemapi Hide this for inner system use.
|
||||
*/
|
||||
function resetAllEfficiencyResources(): void;
|
||||
|
||||
/**
|
||||
* supported background mode.
|
||||
*
|
||||
@ -179,6 +198,90 @@ declare namespace backgroundTaskManager {
|
||||
*/
|
||||
TASK_KEEPING = 9,
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of resource.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply.
|
||||
* @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 efficiency resources.
|
||||
*
|
||||
* @name EfficiencyResourcesRequest
|
||||
* @since 9
|
||||
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply.
|
||||
* @systemapi Hide this for inner system use.
|
||||
*/
|
||||
export interface EfficiencyResourcesRequest {
|
||||
/**
|
||||
* The set of resource types that app wants to apply.
|
||||
*/
|
||||
resourceTypes: number;
|
||||
|
||||
/**
|
||||
* True if the app begin to use, else false.
|
||||
*/
|
||||
isApply: boolean;
|
||||
|
||||
/**
|
||||
* 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?: boolean;
|
||||
|
||||
/**
|
||||
* True if apply action is for process, false is for package. Default value is false.
|
||||
*/
|
||||
isProcess?: boolean;
|
||||
|
||||
/**
|
||||
* The apply reason.
|
||||
*/
|
||||
reason: string;
|
||||
}
|
||||
}
|
||||
|
||||
export default backgroundTaskManager;
|
||||
|
Loading…
x
Reference in New Issue
Block a user