BackgroundTaskKit打元服务标签

Signed-off-by: tangjie <1402602435@qq.com>
This commit is contained in:
tangjie 2024-07-23 11:10:42 +08:00
parent e9c4e95ba0
commit dbe4d51e82
3 changed files with 218 additions and 0 deletions

View File

@ -73,6 +73,7 @@ import type UIAbilityContext from './application/UIAbilityContext';
* @namespace notificationManager
* @syscap SystemCapability.Notification.Notification
* @crossplatform
* @atomicservice
* @since 12
*/
declare namespace notificationManager {
@ -2886,6 +2887,14 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* Describes NotificationSlot types.
*
* @enum { number }
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
export enum SlotType {
/**
* NotificationSlot of an unknown type.
@ -2893,6 +2902,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* NotificationSlot of an unknown type.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
UNKNOWN_TYPE = 0,
/**
@ -2901,6 +2917,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* NotificationSlot for social communication.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
SOCIAL_COMMUNICATION = 1,
/**
@ -2909,6 +2932,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* NotificationSlot for service information.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
SERVICE_INFORMATION = 2,
/**
@ -2917,6 +2947,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* NotificationSlot for content information.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
CONTENT_INFORMATION = 3,
/**
@ -2925,6 +2962,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
/**
* NotificationSlot for live view.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
LIVE_VIEW = 4,
/**
@ -2933,6 +2977,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
/**
* NotificationSlot for customer service.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
CUSTOMER_SERVICE = 5,
/**
@ -2950,6 +3001,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* NotificationSlot for other purposes.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
OTHER_TYPES = 0xFFFF
}
@ -2966,6 +3024,7 @@ declare namespace notificationManager {
* @enum { number }
* @syscap SystemCapability.Notification.Notification
* @crossplatform
* @atomicservice
* @since 12
*/
export enum ContentType {
@ -2980,6 +3039,7 @@ declare namespace notificationManager {
*
* @syscap SystemCapability.Notification.Notification
* @crossplatform
* @atomicservice
* @since 12
*/
NOTIFICATION_CONTENT_BASIC_TEXT,
@ -2995,6 +3055,7 @@ declare namespace notificationManager {
*
* @syscap SystemCapability.Notification.Notification
* @crossplatform
* @atomicservice
* @since 12
*/
NOTIFICATION_CONTENT_LONG_TEXT,
@ -3005,6 +3066,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* Picture-attached notification.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
NOTIFICATION_CONTENT_PICTURE,
/**
@ -3013,6 +3081,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* Conversation notification.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
NOTIFICATION_CONTENT_CONVERSATION,
/**
@ -3026,6 +3101,7 @@ declare namespace notificationManager {
*
* @syscap SystemCapability.Notification.Notification
* @crossplatform
* @atomicservice
* @since 12
*/
NOTIFICATION_CONTENT_MULTILINE,
@ -3036,6 +3112,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
/**
* System local live view notification.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
NOTIFICATION_CONTENT_SYSTEM_LIVE_VIEW,
/**
@ -3044,6 +3127,13 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
/**
* Common live view notification.
*
* @syscap SystemCapability.Notification.Notification
* @atomicservice
* @since 12
*/
NOTIFICATION_CONTENT_LIVE_VIEW,
}

View File

@ -30,6 +30,14 @@ import type notificationManager from './@ohos.notificationManager';
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.Core
* @since 9
*/
/**
* Manages background tasks.
*
* @namespace backgroundTaskManager
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.Core
* @atomicservice
* @since 12
*/
declare namespace backgroundTaskManager {
/**
* The info of delay suspend.
@ -62,6 +70,7 @@ declare namespace backgroundTaskManager {
*
* @interface ContinuousTaskNotification
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
interface ContinuousTaskNotification {
@ -70,6 +79,7 @@ declare namespace backgroundTaskManager {
*
* @type { notificationManager.SlotType }
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
slotType: notificationManager.SlotType;
@ -78,6 +88,7 @@ declare namespace backgroundTaskManager {
*
* @type { notificationManager.ContentType }
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
contentType: notificationManager.ContentType;
@ -86,6 +97,7 @@ declare namespace backgroundTaskManager {
*
* @type { number }
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
notificationId: number;
@ -186,6 +198,30 @@ declare namespace backgroundTaskManager {
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @since 9
*/
/**
* Service ability uses this method to request start running in background.
* <p> System will publish a notification related to the this service. </p>
*
* @permission ohos.permission.KEEP_BACKGROUND_RUNNING
* @param { Context } context - App running context.
* @param { BackgroundMode } bgMode - Indicates which background mode to request.
* @param { WantAgent } wantAgent - Indicates which ability to start when user click the notification bar.
* @param { AsyncCallback<void> } callback - The callback of the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameters types; 3. Parameter verification failed.
* @throws { BusinessError } 9800001 - Memory operation failed.
* @throws { BusinessError } 9800002 - Parcel operation failed.
* @throws { BusinessError } 9800003 - Internal transaction failed.
* @throws { BusinessError } 9800004 - System service operation failed.
* @throws { BusinessError } 9800005 - Continuous task verification failed.
* @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
* @throws { BusinessError } 9800007 - Continuous task storage failed.
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback<void>): void;
/**
@ -211,6 +247,30 @@ declare namespace backgroundTaskManager {
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @since 9
*/
/**
* Service ability uses this method to request start running in background.
* <p> System will publish a notification related to the this service. </p>
*
* @permission ohos.permission.KEEP_BACKGROUND_RUNNING
* @param { Context } context - App running context.
* @param { BackgroundMode } bgMode - Indicates which background mode to request.
* @param { WantAgent } wantAgent - Indicates which ability to start when user click the notification bar.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not System App.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameters types; 3. Parameter verification failed.
* @throws { BusinessError } 9800001 - Memory operation failed.
* @throws { BusinessError } 9800002 - Parcel operation failed.
* @throws { BusinessError } 9800003 - Internal transaction failed.
* @throws { BusinessError } 9800004 - System service operation failed.
* @throws { BusinessError } 9800005 - Continuous task verification failed.
* @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
* @throws { BusinessError } 9800007 - Continuous task storage failed.
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise<void>;
/**
@ -233,6 +293,7 @@ declare namespace backgroundTaskManager {
* @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
* @throws { BusinessError } 9800007 - Continuous task storage failed.
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
function startBackgroundRunning(context: Context, bgModes: string[], wantAgent: WantAgent): Promise<ContinuousTaskNotification>;
@ -255,6 +316,7 @@ declare namespace backgroundTaskManager {
* @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
* @throws { BusinessError } 9800007 - Continuous task storage failed.
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
function updateBackgroundRunning(context: Context, bgModes: string[]): Promise<ContinuousTaskNotification>;
@ -276,6 +338,24 @@ declare namespace backgroundTaskManager {
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @since 9
*/
/**
* Service ability uses this method to request stop running in background.
*
* @param { Context } context - App running context.
* @param { AsyncCallback<void> } callback - The callback of the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* @throws { BusinessError } 9800001 - Memory operation failed.
* @throws { BusinessError } 9800002 - Parcel operation failed.
* @throws { BusinessError } 9800003 - Internal transaction failed.
* @throws { BusinessError } 9800004 - System service operation failed.
* @throws { BusinessError } 9800005 - Continuous task verification failed.
* @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
* @throws { BusinessError } 9800007 - Continuous task storage failed.
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
function stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): void;
/**
@ -295,6 +375,24 @@ declare namespace backgroundTaskManager {
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @since 9
*/
/**
* Service ability uses this method to request stop running in background.
*
* @param { Context } context - App running context.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* @throws { BusinessError } 9800001 - Memory operation failed.
* @throws { BusinessError } 9800002 - Parcel operation failed.
* @throws { BusinessError } 9800003 - Internal transaction failed.
* @throws { BusinessError } 9800004 - System service operation failed.
* @throws { BusinessError } 9800005 - Continuous task verification failed.
* @throws { BusinessError } 9800006 - Notification verification failed for a continuous task.
* @throws { BusinessError } 9800007 - Continuous task storage failed.
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
function stopBackgroundRunning(context: Context): Promise<void>;
/**
@ -340,6 +438,14 @@ declare namespace backgroundTaskManager {
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @since 9
*/
/**
* Supported background mode.
*
* @enum { number }
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
export enum BackgroundMode {
/**
* data transfer mode
@ -355,6 +461,13 @@ declare namespace backgroundTaskManager {
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @since 9
*/
/**
* audio playback mode
*
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
AUDIO_PLAYBACK = 2,
/**
@ -387,6 +500,13 @@ declare namespace backgroundTaskManager {
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @since 9
*/
/**
* multi-device connection mode
*
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
* @atomicservice
* @since 12
*/
MULTI_DEVICE_CONNECTION = 6,
/**

View File

@ -446,6 +446,14 @@ declare namespace wantAgent {
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
*/
/**
* WantAgent object.
*
* @typedef { object }
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @atomicservice
* @since 12
*/
export type WantAgent = object;
export default wantAgent;