!7739 普通实况窗api接口变更上库

Merge pull request !7739 from f00573101/master
This commit is contained in:
openharmony_ci 2023-11-21 06:40:10 +00:00 committed by Gitee
commit f82f398af5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 509 additions and 2 deletions

View File

@ -30,6 +30,8 @@ import { NotificationFlags as _NotificationFlags } from './notification/notifica
import { NotificationFlagStatus as _NotificationFlagStatus } from './notification/notificationFlags';
import { NotificationRequest as _NotificationRequest } from './notification/notificationRequest';
import { DistributedOptions as _DistributedOptions } from './notification/notificationRequest';
import type { NotificationFilter as _NotificationFilter } from './notification/notificationRequest';
import type { NotificationCheckRequest as _NotificationCheckRequest } from './notification/notificationRequest';
import { NotificationSlot as _NotificationSlot } from './notification/notificationSlot';
import { NotificationSorting as _NotificationSorting } from './notification/notificationSorting';
import { NotificationTemplate as _NotificationTemplate } from './notification/notificationTemplate';
@ -69,6 +71,29 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* Publishes a notification.
* <p>If a notification with the same ID has been published by the current application and has not been deleted,
* this method will update the notification.
*
* @param { NotificationRequest } request - notification request
* @param { AsyncCallback<void> } callback - The callback of publish.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600004 - Notification is not enabled.
* @throws { BusinessError } 1600005 - Notification slot is not enabled.
* @throws { BusinessError } 1600007 - The notification is not exist.
* @throws { BusinessError } 1600009 - Over max number notifications per second.
* @throws { BusinessError } 1600012 - No memory space.
* @throws { BusinessError } 1600014 - No relevant right.
* @throws { BusinessError } 1600015 - The current notification status does not support duplicate configurations.
* @throws { BusinessError } 1600016 - The notification version for this update is too low.
* @throws { BusinessError } 2300007 - Network is unreachable.
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
function publish(request: NotificationRequest, callback: AsyncCallback<void>): void;
/**
@ -89,6 +114,29 @@ declare namespace notificationManager {
* @syscap SystemCapability.Notification.Notification
* @since 9
*/
/**
* Publishes a notification.
* <p>If a notification with the same ID has been published by the current application and has not been deleted,
* this method will update the notification.
*
* @param { NotificationRequest } request - notification request
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600004 - Notification is not enabled.
* @throws { BusinessError } 1600005 - Notification slot is not enabled.
* @throws { BusinessError } 1600007 - The notification is not exist.
* @throws { BusinessError } 1600009 - Over max number notifications per second.
* @throws { BusinessError } 1600012 - No memory space.
* @throws { BusinessError } 1600014 - No relevant right.
* @throws { BusinessError } 1600015 - The current notification status does not support duplicate configurations.
* @throws { BusinessError } 1600016 - The notification version for this update is too low.
* @throws { BusinessError } 2300007 - Network is unreachable.
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
function publish(request: NotificationRequest): Promise<void>;
/**
@ -113,6 +161,33 @@ declare namespace notificationManager {
* @systemapi
* @since 9
*/
/**
* Publishes a notification to the specified user.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER
* @param { NotificationRequest } request - a notification.
* @param { number } userId - of subscriber receiving the notification.
* @param { AsyncCallback<void> } callback - The callback of publish.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application to call the interface.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600004 - Notification is not enabled.
* @throws { BusinessError } 1600005 - Notification slot is not enabled.
* @throws { BusinessError } 1600007 - The notification is not exist.
* @throws { BusinessError } 1600008 - The user is not exist.
* @throws { BusinessError } 1600009 - Over max number notifications per second.
* @throws { BusinessError } 1600012 - No memory space.
* @throws { BusinessError } 1600014 - No relevant right.
* @throws { BusinessError } 1600015 - The current notification status does not support duplicate configurations.
* @throws { BusinessError } 1600016 - The notification version for this update is too low.
* @throws { BusinessError } 2300007 - Network is unreachable.
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
function publish(request: NotificationRequest, userId: number, callback: AsyncCallback<void>): void;
/**
@ -137,6 +212,33 @@ declare namespace notificationManager {
* @systemapi
* @since 9
*/
/**
* Publishes a notification to the specified user.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER
* @param { NotificationRequest } request - a notification.
* @param { number } userId - of subscriber receiving the notification.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application to call the interface.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600004 - Notification is not enabled.
* @throws { BusinessError } 1600005 - Notification slot is not enabled.
* @throws { BusinessError } 1600007 - The notification is not exist.
* @throws { BusinessError } 1600008 - The user is not exist.
* @throws { BusinessError } 1600009 - Over max number notifications per second.
* @throws { BusinessError } 1600012 - No memory space.
* @throws { BusinessError } 1600014 - No relevant right.
* @throws { BusinessError } 1600015 - The current notification status does not support duplicate configurations.
* @throws { BusinessError } 1600016 - The notification version for this update is too low.
* @throws { BusinessError } 2300007 - Network is unreachable.
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
function publish(request: NotificationRequest, userId: number): Promise<void>;
/**
@ -624,6 +726,19 @@ declare namespace notificationManager {
* @systemapi
* @since 9
*/
/**
* Checks whether this application allows to publish notifications.
*
* @param { AsyncCallback<boolean> } callback - The callback of isNotificationEnabled.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600008 - The user is not exist.
* @throws { BusinessError } 17700001 - The specified bundle name was not found.
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
function isNotificationEnabled(callback: AsyncCallback<boolean>): void;
/**
@ -641,6 +756,19 @@ declare namespace notificationManager {
* @systemapi
* @since 9
*/
/**
* Checks whether this application allows to publish notifications.
*
* @returns { Promise<boolean> } The promise returned by the function.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600008 - The user is not exist.
* @throws { BusinessError } 17700001 - The specified bundle name was not found.
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
function isNotificationEnabled(): Promise<boolean>;
/**
@ -963,6 +1091,38 @@ declare namespace notificationManager {
*/
function getActiveNotifications(): Promise<Array<NotificationRequest>>;
/**
* Get the live view notification by bundle option and notification key. If the extraInfoKeys is provided,
* filter the additional information of the live view notification and return the filtered result.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER
* @param { NotificationFilter } filter - The bundle, notification key and additional information filter of the live view notification.
* @param { AsyncCallback<NotificationRequest> } callback - The callback of getActiveNotificationByFilter.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600007 - The notification is not exist.
* @throws { BusinessError } 17700001 - The specified bundle name was not found.
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
function getActiveNotificationByFilter(filter: NotificationFilter, callback: AsyncCallback<NotificationRequest>): void;
/**
* Get the live view notification by bundle option and notification key. If the extraInfoKeys is provided,
* filter the additional information of the live view notification and return the filtered result.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER
* @param { NotificationFilter } filter - The bundle, notification key and additional information filter of the live view notification.
* @returns { Promise<NotificationRequest> } The promise returned by the function.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600007 - The notification is not exist.
* @throws { BusinessError } 17700001 - The specified bundle name was not found.
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
function getActiveNotificationByFilter(filter: NotificationFilter): Promise<NotificationRequest>;
/**
* Cancel the notification of a specified group for this application.
*
@ -1565,6 +1725,26 @@ declare namespace notificationManager {
* @systemapi
* @since 9
*/
/**
* Set whether the application slot is enabled.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER
* @param { BundleOption } bundle - The bundle option.
* @param { SlotType } type - Type of the notification slot.
* @param { boolean } enable - Set enable or not.
* @param { AsyncCallback<void> } callback - The callback of setNotificationEnableSlot.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application to call the interface.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600012 - No memory space.
* @throws { BusinessError } 17700001 - The specified bundle name was not found.
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
function setNotificationEnableSlot(
bundle: BundleOption,
type: SlotType,
@ -1572,6 +1752,36 @@ declare namespace notificationManager {
callback: AsyncCallback<void>
): void;
/**
* Set whether the application slot is enabled.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER
* @param { BundleOption } bundle - The bundle option.
* @param { SlotType } type - Type of the notification slot.
* @param { boolean } enable - Set enable or not.
* @param { boolean } isForceControl - Is the notification slot enable affected by the application
* notification enable, false means affected.
* @param { AsyncCallback<void> } callback - The callback of setNotificationEnableSlot.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application to call the interface.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600012 - No memory space.
* @throws { BusinessError } 17700001 - The specified bundle name was not found.
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
function setNotificationEnableSlot(
bundle: BundleOption,
type: SlotType,
enable: boolean,
isForceControl: boolean,
callback: AsyncCallback<void>,
): void;
/**
* Set whether the application slot is enabled.
*
@ -1591,7 +1801,29 @@ declare namespace notificationManager {
* @systemapi
* @since 9
*/
function setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise<void>;
/**
* Set whether the application slot is enabled.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER
* @param { BundleOption } bundle - The bundle option.
* @param { SlotType } type - Type of the notification slot.
* @param { boolean } enable - Set enable or not.
* @param { boolean } isForceControl - Is the notification slot enable affected by the application
* notification enable, false means affected.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application to call the interface.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @throws { BusinessError } 1600012 - No memory space.
* @throws { BusinessError } 17700001 - The specified bundle name was not found.
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
function setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, isForceControl?: boolean): Promise<void>;
/**
* Obtains whether the application slot is enabled.
@ -1756,6 +1988,26 @@ declare namespace notificationManager {
*/
function on(type: 'checkNotification', callback: (checkInfo: NotificationCheckInfo) => NotificationCheckResult): void;
/**
* Subscribe the callback for check notifications.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER
* @param { 'checkNotification' } type - Type of the callback to listen for.
* @param { NotificationCheckRequest } checkRequest - Check Request for filter notification request.
* @param { function } callback - callback - The callback of check notifications.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 1600001 - Internal error.
* @throws { BusinessError } 1600002 - Marshalling or unmarshalling error.
* @throws { BusinessError } 1600003 - Failed to connect service.
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
function on(type: 'checkNotification', checkRequest: NotificationCheckRequest,
callback: (checkInfo: NotificationCheckInfo) => Promise<NotificationCheckResult>): void;
/**
* Unsubscribe the callback for check notifications.
*
@ -1887,6 +2139,17 @@ declare namespace notificationManager {
*/
notificationId: number;
/**
* Label of the notification.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER
* @type { ?string }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
label?: string;
/**
* The notification content type.
*
@ -1897,6 +2160,39 @@ declare namespace notificationManager {
* @since 10
*/
contentType: ContentType;
/**
* UserId of the notification creator.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER
* @type { number }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
creatorUserId: number;
/**
* Type of the notification slot.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER
* @type { SlotType }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
slotType: SlotType;
/**
* Additional information of the live view notification.
*
* @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER
* @type { ?object }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
extraInfos?: { [key: string]: object };
}
/**
@ -2052,6 +2348,14 @@ declare namespace notificationManager {
* @since 11
*/
NOTIFICATION_CONTENT_SYSTEM_LIVE_VIEW,
/**
* Common live view notification.
*
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
NOTIFICATION_CONTENT_LIVE_VIEW,
}
/**
@ -2366,6 +2670,22 @@ declare namespace notificationManager {
*/
export type NotificationRequest = _NotificationRequest;
/**
* Defines a NotificationFilter instance.
*
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
export type NotificationFilter = _NotificationFilter;
/**
* Defines a NotificationCheckRequest instance.
*
* @syscap SystemCapability.Notification.Notification
* @since 11
*/
export type NotificationCheckRequest = _NotificationCheckRequest;
/**
* Describes distributed options.
*

View File

@ -89,6 +89,101 @@ export interface NotificationLongTextContent extends NotificationBasicContent {
expandedTitle: string;
}
/**
* Enum for live view notification option type.
*
* @enum { number }
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 11
*/
export enum LiveViewStatus {
/**
* Create the live view notification.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 11
*/
LIVE_VIEW_CREATE = 0,
/**
* Batch update the live view notification.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 11
*/
LIVE_VIEW_INCREMENTAL_UPDATE = 1,
/**
* Complete the live view notification.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 11
*/
LIVE_VIEW_END = 2,
/**
* Full update the live view notification.
*
* @syscap SystemCapability.Security.AccessToken
* @systemapi
* @since 11
*/
LIVE_VIEW_FULL_UPDATE = 3
}
/**
* Describes a live view notification.
*
* @typedef NotificationLiveViewContent
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
export interface NotificationLiveViewContent extends NotificationBasicContent {
/**
* Status of the live view (0: create, 1: batch update, 2: end, 3: full update).
*
* @type { LiveViewStatus }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
status: LiveViewStatus;
/**
* Version of the live view with the same id. (If the version number stored in the database is less
* than 0, the version number is not verified at the current operation of update or end. Otherwise, the
* version number must be greater than the version number stored in the database.)
*
* @type { number }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
version: number;
/**
* Additional information of the live view notification.
*
* @type { ?object}
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
extraInfo?: { [key: string]: object };
/**
* The picture information list of the live view notification.
*
* @type { ?object }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
pictureInfo?: { [key: string]: Array<image.PixelMap> };
}
/**
* Describes a multi-line text notification.
*
@ -296,7 +391,7 @@ export interface NotificationTime {
initialTime?: number;
/**
*
*
* Count down the time.
*
* @type { ?boolean }

View File

@ -16,11 +16,13 @@
import notification from '../@ohos.notification';
import image from '../@ohos.multimedia.image';
import type notificationManager from '../@ohos.notificationManager';
import type notificationSubscribe from '../@ohos.notificationSubscribe';
import { WantAgent } from '../@ohos.wantAgent';
import { NotificationContent } from './notificationContent';
import { NotificationActionButton } from './notificationActionButton';
import { NotificationTemplate } from './notificationTemplate';
import { NotificationFlags } from './notificationFlags';
import { BundleOption as _BundleOption } from './NotificationCommonDef';
/**
* Defines a NotificationRequest instance.
@ -239,6 +241,16 @@ export interface NotificationRequest {
*/
largeIcon?: image.PixelMap;
/**
* Overlay notification icon.
*
* @type { ?image.PixelMap }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
overlayIcon?: image.PixelMap;
/**
* The group information for this notification.
*
@ -431,3 +443,83 @@ export interface DistributedOptions {
*/
readonly remindType?: number;
}
/**
* Describes notification filter.
*
* @typedef NotificationFilter
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
export interface NotificationFilter {
/**
* BundleOption of the notification.
*
* @type { BundleOption }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
bundle: BundleOption;
/**
* Indicates the label and id of the notification.
*
* @type { notificationSubscribe.NotificationKey }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
notificationKey: notificationSubscribe.NotificationKey;
/**
* Indicates the additional information filter keys list.
*
* @type { ?Array<string> }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
extraInfoKeys?: Array<string>;
}
/**
* Describes notification check information.
*
* @typedef NotificationCheckRequest
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
export interface NotificationCheckRequest {
/**
* The notification content type.
*
* @type { notificationManager.ContentType }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
contentType: notificationManager.ContentType;
/**
* Type of the notification slot..
*
* @type { notificationManager.SlotType }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
slotType: notificationManager.SlotType;
/**
* Additional information of the notification.
*
* @type { Array<string> }
* @syscap SystemCapability.Notification.Notification
* @systemapi
* @since 11
*/
extraKeys: Array<string>;
}