• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_NOTIFICATION_H
17 #define BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_NOTIFICATION_H
18 
19 #include <list>
20 #include <memory>
21 
22 #include "ans_dialog_host_client.h"
23 #include "ans_subscriber_listener.h"
24 #include "ians_manager.h"
25 #include "notification_local_live_view_subscriber.h"
26 #include "notification_subscriber.h"
27 #include "want_params.h"
28 #include "distributed_bundle_option.h"
29 #ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED
30 #include "swing_callback_service.h"
31 #endif
32 
33 namespace OHOS {
34 namespace Notification {
35 class AnsNotification {
36 public:
37     /**
38      * @brief Creates a notification slot.
39      * @note You can call the NotificationRequest::SetSlotType(NotificationConstant::SlotType) method to bind the slot
40      * for publishing. A NotificationSlot instance cannot be used directly after being initialized. Instead, you have to
41      * call this method to create a notification slot and bind the slot ID to a NotificationRequest object so that the
42      * notification published can have all the characteristics set in the NotificationSlot. After a notification slot is
43      * created by using this method, only the name and description of the notification slot can be changed. Changes to
44      * the other attributes, such as the vibration status and notification tone, will no longer take effect.
45      *
46      * @param slot Indicates the notification slot to be created, which is set by NotificationSlot.
47      *             This parameter must be specified.
48      * @return Returns add notification slot result.
49      */
50     ErrCode AddNotificationSlot(const NotificationSlot &slot);
51 
52     /**
53      * @brief Adds a notification slot by type.
54      *
55      * @param slotType Indicates the notification slot type to be added.
56      * @return Returns add notification slot result.
57      */
58     ErrCode AddSlotByType(const NotificationConstant::SlotType &slotType);
59 
60     /**
61      * @brief Creates multiple notification slots.
62      *
63      * @param slots Indicates the notification slots to create.
64      * @return Returns add notification slots result.
65      */
66     ErrCode AddNotificationSlots(const std::vector<NotificationSlot> &slots);
67 
68     /**
69      * @brief Deletes a created notification slot based on the slot ID.
70      *
71      * @param slotType Indicates the ID of the slot, which is created by AddNotificationSlot
72      *                This parameter must be specified.
73      * @return Returns remove notification slot result.
74      */
75     ErrCode RemoveNotificationSlot(const NotificationConstant::SlotType &slotType);
76 
77     /**
78      * @brief Deletes all notification slots.
79      *
80      * @return Returns remove all slots result.
81      */
82     ErrCode RemoveAllSlots();
83 
84     /**
85      * @brief Queries a created notification slot.
86      *
87      * @param slotType Indicates the ID of the slot, which is created by AddNotificationSlot(NotificationSlot). This
88      *        parameter must be specified.
89      * @param slot Indicates the created NotificationSlot.
90      * @return Returns the get notification slot result.
91      */
92     ErrCode GetNotificationSlot(const NotificationConstant::SlotType &slotType, sptr<NotificationSlot> &slot);
93 
94     /**
95      * @brief Obtains all notification slots of this application.
96      *
97      * @param slots Indicates the created NotificationSlot.
98      * @return Returns all notification slots of this application.
99      */
100     ErrCode GetNotificationSlots(std::vector<sptr<NotificationSlot>> &slots);
101 
102     /**
103      * @brief Obtains number of slot.
104      *
105      * @param bundleOption Indicates the bundle name and uid of the application.
106      * @param num Indicates number of slot.
107      * @return Returns get slot number by bundle result.
108      */
109     ErrCode GetNotificationSlotNumAsBundle(const NotificationBundleOption &bundleOption, uint64_t &num);
110 
111     /**
112      * @brief Obtains slotFlags of bundle.
113      *
114      * @param bundleOption Indicates the bundle name and uid of the application.
115      * @param slotFlags Indicates slotFlags of bundle.
116      * @return Returns get slotflags by bundle result.
117      */
118     ErrCode GetNotificationSlotFlagsAsBundle(const NotificationBundleOption &bundleOption, uint32_t &slotFlags);
119 
120     /**
121      * @brief Obtains slotFlags of bundle.
122      *
123      * @param slotFlags Indicates slotFlags of bundle.
124      * @return Returns get slotflags by bundle result.
125      */
126     ErrCode GetNotificationSettings(uint32_t &slotFlags);
127     /**
128      * @brief Set slotFlags of bundle.
129      *
130      * @param bundleOption Indicates the bundle name and uid of the application.
131      * @param slotFlags Indicates slotFlags of bundle.
132      * @return Returns set slotflags by bundle result.
133      */
134     ErrCode SetNotificationSlotFlagsAsBundle(const NotificationBundleOption &bundleOption, uint32_t slotFlags);
135 
136     /**
137      * @brief Publishes a notification.
138      * @note If a notification with the same ID has been published by the current application and has not been deleted,
139      * this method will update the notification.
140      *
141      * @param request Indicates the NotificationRequest object for setting the notification content.
142      *                This parameter must be specified.
143      * @return Returns publish notification result.
144      */
145     ErrCode PublishNotification(const NotificationRequest &request, const std::string &instanceKey = "");
146 
147     /**
148      * @brief Publishes a notification with a specified label.
149      * @note If a notification with the same ID has been published by the current application and has not been deleted,
150      *       this method will update the notification.
151      *
152      * @param label Indicates the label of the notification to publish.
153      * @param request Indicates the NotificationRequest object for setting the notification content.
154      *                This parameter must be specified.
155      * @return Returns publish notification result.
156      */
157     ErrCode PublishNotification(const std::string &label, const NotificationRequest &request,
158         const std::string &instanceKey = "");
159 
160     /**
161      * @brief Publishes a notification.
162      * @note If a notification with the same ID has been published by the current application and has not been deleted,
163      * this method will update the notification.
164      *
165      * @param request Indicates the NotificationRequest object for setting the notification content.
166      *                This parameter must be specified.
167      * @return Returns publish notification result.
168      */
169     ErrCode PublishNotificationForIndirectProxy(const NotificationRequest &request);
170 
171     /**
172      * @brief Cancels a published notification.
173      *
174      * @param notificationId Indicates the unique notification ID in the application.
175      *                       The value must be the ID of a published notification.
176      *                       Otherwise, this method does not take effect.
177      * @return Returns cancel notification result.
178      */
179     ErrCode CancelNotification(int32_t notificationId, const std::string &instanceKey = "");
180 
181     /**
182      * @brief Cancels a published notification matching the specified label and notificationId.
183      *
184      * @param label Indicates the label of the notification to cancel.
185      * @param notificationId Indicates the ID of the notification to cancel.
186      * @return Returns cancel notification result.
187      */
188     ErrCode CancelNotification(const std::string &label, int32_t notificationId,
189         const std::string &instanceKey = "");
190 
191     /**
192      * @brief Cancels all the published notifications.
193      * @note To cancel a specified notification, see CancelNotification(int32_t).
194      *
195      * @return Returns cancel all notifications result.
196      */
197     ErrCode CancelAllNotifications(const std::string &instanceKey = "");
198 
199     /**
200      * @brief Cancels a published agent notification.
201      *
202      * @param notificationId Indicates the unique notification ID in the application.
203      *                       The value must be the ID of a published notification.
204      *                       Otherwise, this method does not take effect.
205      * @param representativeBundle Indicates the name of application bundle your application is representing.
206      * @param userId Indicates the specific user.
207      * @return Returns cancel notification result.
208      */
209     ErrCode CancelAsBundle(int32_t notificationId, const std::string &representativeBundle, int32_t userId);
210 
211     /**
212      * @brief Cancels a published agent notification.
213      *
214      * @param bundleOption Indicates the bundle of application your application is representing.
215      * @param notificationId Indicates the unique notification ID in the application.
216      *                       The value must be the ID of a published notification.
217      *                       Otherwise, this method does not take effect.
218      * @return Returns cancel notification result.
219      */
220     ErrCode CancelAsBundle(const NotificationBundleOption &bundleOption, int32_t notificationId);
221 
222     /**
223      * @brief Obtains the number of active notifications of the current application in the system.
224      *
225      * @param num Indicates the number of active notifications of the current application.
226      * @return Returns get active notification nums result.
227      */
228     ErrCode GetActiveNotificationNums(uint64_t &num);
229 
230     /**
231      * @brief Obtains active notifications of the current application in the system.
232      *
233      * @param  request Indicates active NotificationRequest objects of the current application.
234      * @return Returns get active notifications result.
235      */
236     ErrCode GetActiveNotifications(std::vector<sptr<NotificationRequest>> &request,
237         const std::string &instanceKey = "");
238 
239     /**
240      * @brief Checks whether your application has permission to publish notifications by calling
241      * PublishNotificationAsBundle(string, NotificationRequest) in the name of another application indicated by the
242      * given representativeBundle.
243      *
244      * @param representativeBundle Indicates the name of application bundle your application is representing.
245      * @param canPublish Indicates whether your application has permission to publish notifications.
246      * @return Returns can publish notification as bundle result.
247      */
248     ErrCode CanPublishNotificationAsBundle(const std::string &representativeBundle, bool &canPublish);
249 
250     /**
251      * @brief Publishes a notification in the name of a specified application bundle.
252      * @note If the notification to be published has the same ID as a published notification that has not been canceled,
253      * the existing notification will be replaced by the new one.
254      *
255      * @param request Indicates the NotificationRequest object for setting the notification content.
256      *                This parameter must be specified.
257      * @param representativeBundle Indicates the name of the application bundle that allows your application to publish
258      *                             notifications for it by calling setNotificationAgent.
259      * @return Returns publish notification as bundle result.
260      */
261     ErrCode PublishNotificationAsBundle(const std::string &representativeBundle, const NotificationRequest &request);
262 
263     /**
264      * @brief Sets the number of active notifications of the current application as the number to be displayed on the
265      * notification badge.
266      *
267      * @return Returns set notification badge num result.
268      */
269     ErrCode SetNotificationBadgeNum();
270 
271     /**
272      * @brief Sets the number to be displayed on the notification badge of the application.
273      *
274      * @param num Indicates the number to display. A negative number indicates that the badge setting remains unchanged.
275      *            The value 0 indicates that no badge is displayed on the application icon.
276      *            If the value is greater than 99, 99+ will be displayed.
277      * @return Returns set notification badge num result.
278      */
279     ErrCode SetNotificationBadgeNum(int32_t num);
280 
281     /**
282      * @brief Checks whether this application has permission to publish notifications. The caller must have
283      * system permissions to call this method.
284      *
285      * @param  allowed True if this application has the permission; returns false otherwise
286      * @return Returns is allowed notify result.
287      */
288     ErrCode IsAllowedNotify(bool &allowed);
289 
290     /**
291      * @brief Checks whether this application has permission to publish notifications.
292      *
293      * @param  allowed True if this application has the permission; returns false otherwise
294      * @return Returns is allowed notify result.
295      */
296     ErrCode IsAllowedNotifySelf(bool &allowed);
297 
298     /**
299      * @brief Checks whether this application can pop enable notification dialog.
300      *
301      * @param  canPop True if can pop enable notification dialog
302      * @return Returns is canPop result.
303      */
304     ErrCode CanPopEnableNotificationDialog(sptr<AnsDialogHostClient> &hostClient,
305         bool &canPop, std::string &bundleName);
306 
307     /**
308      * @brief remove enable notification dialog.
309      *
310      * @return Returns remove dialog result.
311      */
312     ErrCode RemoveEnableNotificationDialog();
313 
314     /**
315      * @brief Allows the current application to publish notifications on a specified device.
316      *
317      * @param deviceId Indicates the ID of the device running the application. At present, this parameter can
318      *                 only be null or an empty string, indicating the current device.
319      * @return Returns set notifications enabled for default bundle result.
320      */
321     ErrCode RequestEnableNotification(std::string &deviceId,
322         sptr<AnsDialogHostClient> &hostClient,
323         sptr<IRemoteObject> &callerToken);
324 
325     /**
326      * @brief Allow application to publish notifications.
327      *
328      * @param bundleName bundle name.
329      * @param uid uid.
330      * @return Returns set notifications enabled for the bundle result.
331      */
332     ErrCode RequestEnableNotification(const std::string bundleName, const int32_t uid);
333 
334     /**
335      * @brief Checks whether this application has permission to modify the Do Not Disturb (DND) notification policy.
336      *
337      * @param hasPermission True if this application is suspended; returns false otherwise.
338      * @return Returns has notification policy access permission.
339      */
340     ErrCode HasNotificationPolicyAccessPermission(bool &hasPermission);
341 
342     /**
343      * @brief Obtains the importance level of this application.
344      *
345      * @param  importance the importance level of this application, which can be LEVEL_NONE,
346                LEVEL_MIN, LEVEL_LOW, LEVEL_DEFAULT, LEVEL_HIGH, or LEVEL_UNDEFINED.
347      * @return Returns get bundle importance result
348      */
349     ErrCode GetBundleImportance(NotificationSlot::NotificationLevel &importance);
350 
351     /**
352      * @brief Subscribes to notifications from all applications. This method can be called only by applications
353      * with required system permissions.
354      * @note  To subscribe to a notification, inherit the {NotificationSubscriber} class, override its
355      *        callback methods and create a subscriber. The subscriber will be used as a parameter of this method.
356      *        After the notification is published, subscribers that meet the filter criteria can receive the
357      * notification. To subscribe to notifications published only by specified sources, for example, notifications from
358      *        certain applications, call the {SubscribeNotification(NotificationSubscriber, NotificationSubscribeInfo)}
359      * method.
360      * @deprecated This function is deprecated,
361      *             use 'SubscribeNotification(const std::shared_ptr<NotificationSubscriber> &subscriber)'.
362      * @param subscriber Indicates the {NotificationSubscriber} to receive notifications.
363      *                   This parameter must be specified.
364      * @return Returns subscribe notification result.
365      */
366     ErrCode SubscribeNotification(const NotificationSubscriber &subscriber);
367 
368     /**
369      * @brief Subscribes to notifications from all applications. This method can be called only by applications
370      * with required system permissions.
371      * @note  To subscribe to a notification, inherit the {NotificationSubscriber} class, override its
372      *        callback methods and create a subscriber. The subscriber will be used as a parameter of this method.
373      *        After the notification is published, subscribers that meet the filter criteria can receive the
374      * notification. To subscribe to notifications published only by specified sources, for example, notifications from
375      *        certain applications, call the {SubscribeNotification(NotificationSubscriber, NotificationSubscribeInfo)}
376      * method.
377      *
378      * @param subscriber Indicates the {NotificationSubscriber} to receive notifications.
379      *                   This parameter must be specified.
380      * @return Returns subscribe notification result.
381      */
382     ErrCode SubscribeNotification(const std::shared_ptr<NotificationSubscriber> &subscriber);
383 
384     /**
385      * @brief Subscribes to notifications from the appliaction self.
386      * @note  To subscribe to a notification, inherit the {NotificationSubscriber} class, override its
387      *        callback methods and create a subscriber. The subscriber will be used as a parameter of this method.
388      *        After the notification is published, subscribers that meet the filter criteria can receive the
389      * notification.
390      * @deprecated This function is deprecated,
391      *             use 'SubscribeNotificationSelf(const std::shared_ptr<NotificationSubscriber> &subscriber)'.
392      * @param subscriber Indicates the {NotificationSubscriber} to receive notifications.
393      *                   This parameter must be specified.
394      * @return Returns subscribe notification result.
395      */
396     ErrCode SubscribeNotificationSelf(const NotificationSubscriber &subscriber);
397 
398     /**
399      * @brief Subscribes to notifications from the appliaction self.
400      * @note  To subscribe to a notification, inherit the {NotificationSubscriber} class, override its
401      *        callback methods and create a subscriber. The subscriber will be used as a parameter of this method.
402      *        After the notification is published, subscribers that meet the filter criteria can receive the
403      * notification.
404      *
405      * @param subscriber Indicates the {NotificationSubscriber} to receive notifications.
406      *                   This parameter must be specified.
407      * @return Returns subscribe notification result.
408      */
409     ErrCode SubscribeNotificationSelf(const std::shared_ptr<NotificationSubscriber> &subscriber);
410 
411     /**
412      * @brief Subscribes liveView notification. This method can be called only by applications
413      * with required system permissions.
414      * @note  To subscribe to a notification, inherit the {NotificationLocalLiveViewSubscriber} class, override its
415      *        callback methods and create a subscriber. The subscriber will be used as a parameter of this method.
416      *
417      * @param subscriber Indicates the {NotificationLocalLiveViewSubscriber} to receive notifications.
418      *                   This parameter must be specified.
419      * @return Returns subscribe notification result.
420      */
421     ErrCode SubscribeLocalLiveViewNotification(const NotificationLocalLiveViewSubscriber &subscriber,
422         const bool isNative = true);
423 
424     /**
425      * @brief Subscribes to all notifications based on the filtering criteria. This method can be called only
426      * by applications with required system permissions.
427      * @note  After {subscribeInfo} is specified, a subscriber receives only the notifications that
428      *        meet the filter criteria specified by {subscribeInfo}.
429      *        To subscribe to a notification, inherit the {NotificationSubscriber} class, override its
430      *        callback methods and create a subscriber. The subscriber will be used as a parameter of this method.
431      *        After the notification is published, subscribers that meet the filter criteria can receive the
432      * notification. To subscribe to and receive all notifications, call the
433      * {SubscribeNotification(NotificationSubscriber)} method.
434      * @deprecated This function is deprecated,
435      *             use 'SubscribeNotification(const std::shared_ptr<NotificationSubscriber> &subscriber,
436      *             const std::shared_ptr<NotificationSubscribeInfo> &subscribeInfo)'.
437      * @param subscriber Indicates the subscribers to receive notifications. This parameter must be specified.
438      *                   For details, see {NotificationSubscriber}.
439      * @param subscribeInfo Indicates the filters for specified notification sources, including application name,
440      *                      user ID, or device name. This parameter is optional.
441      * @return Returns subscribe notification result.
442      */
443     ErrCode SubscribeNotification(
444         const NotificationSubscriber &subscriber, const NotificationSubscribeInfo &subscribeInfo);
445 
446     /**
447      * @brief Subscribes to all notifications based on the filtering criteria. This method can be called only
448      * by applications with required system permissions.
449      * @note  After {subscribeInfo} is specified, a subscriber receives only the notifications that
450      *        meet the filter criteria specified by {subscribeInfo}.
451      *        To subscribe to a notification, inherit the {NotificationSubscriber} class, override its
452      *        callback methods and create a subscriber. The subscriber will be used as a parameter of this method.
453      *        After the notification is published, subscribers that meet the filter criteria can receive the
454      * notification. To subscribe to and receive all notifications, call the
455      * {SubscribeNotification(NotificationSubscriber)} method.
456      *
457      * @param subscriber Indicates the subscribers to receive notifications. This parameter must be specified.
458      *                   For details, see {NotificationSubscriber}.
459      * @param subscribeInfo Indicates the filters for specified notification sources, including application name,
460      *                      user ID, or device name. This parameter is optional.
461      * @return Returns subscribe notification result.
462      */
463     ErrCode SubscribeNotification(const std::shared_ptr<NotificationSubscriber> &subscriber,
464         const sptr<NotificationSubscribeInfo> &subscribeInfo);
465 
466     /**
467      * @brief Unsubscribes from all notifications. This method can be called only by applications with required
468      * system permissions.
469      * @note Generally, you subscribe to a notification by calling the
470      *       {SubscribeNotification(NotificationSubscriber)} method. If you do not want your application
471      *       to receive a notification any longer, unsubscribe from that notification using this method.
472      *       You can unsubscribe from only those notifications that your application has subscribed to.
473      *        To unsubscribe from notifications published only by specified sources, for example,
474      *       notifications from certain applications, call the
475      *       {UnSubscribeNotification(NotificationSubscriber, NotificationSubscribeInfo)} method.
476      * @deprecated This function is deprecated,
477      *             use 'UnSubscribeNotification(const std::shared_ptr<NotificationSubscriber> &subscriber)'.
478      * @param subscriber Indicates the {NotificationSubscriber} to receive notifications.
479      *                   This parameter must be specified.
480      * @return Returns unsubscribe notification result.
481      */
482     ErrCode UnSubscribeNotification(NotificationSubscriber &subscriber);
483 
484     /**
485      * @brief Unsubscribes from all notifications. This method can be called only by applications with required
486      * system permissions.
487      * @note Generally, you subscribe to a notification by calling the
488      *       {SubscribeNotification(NotificationSubscriber)} method. If you do not want your application
489      *       to receive a notification any longer, unsubscribe from that notification using this method.
490      *       You can unsubscribe from only those notifications that your application has subscribed to.
491      *        To unsubscribe from notifications published only by specified sources, for example,
492      *       notifications from certain applications, call the
493      *       {UnSubscribeNotification(NotificationSubscriber, NotificationSubscribeInfo)} method.
494      *
495      * @param subscriber Indicates the {NotificationSubscriber} to receive notifications.
496      *                   This parameter must be specified.
497      * @return Returns unsubscribe notification result.
498      */
499     ErrCode UnSubscribeNotification(const std::shared_ptr<NotificationSubscriber> &subscriber);
500 
501     /**
502      * @brief Unsubscribes from all notifications based on the filtering criteria. This method can be called
503      * only by applications with required system permissions.
504      * @note A subscriber will no longer receive the notifications from specified notification sources.
505      *
506      * @deprecated This function is deprecated,
507      *             use 'UnSubscribeNotification(const std::shared_ptr<NotificationSubscriber> &subscriber,
508      *             const std::shared_ptr<NotificationSubscribeInfo> &subscribeInfo)'.
509      * @param subscriber Indicates the {NotificationSubscriber} to receive notifications.
510      *                   This parameter must be specified.
511      * @param subscribeInfo Indicates the filters for , including application name,
512      *                      user ID, or device name. This parameter is optional.
513      * @return Returns unsubscribe notification result.
514      */
515     ErrCode UnSubscribeNotification(NotificationSubscriber &subscriber, NotificationSubscribeInfo subscribeInfo);
516 
517     /**
518      * @brief Unsubscribes from all notifications based on the filtering criteria. This method can be called
519      * only by applications with required system permissions.
520      * @note A subscriber will no longer receive the notifications from specified notification sources.
521      *
522      * @param subscriber Indicates the {NotificationSubscriber} to receive notifications.
523      *                   This parameter must be specified.
524      * @param subscribeInfo Indicates the filters for , including application name,
525      *                      user ID, or device name. This parameter is optional.
526      * @return Returns unsubscribe notification result.
527      */
528     ErrCode UnSubscribeNotification(const std::shared_ptr<NotificationSubscriber> &subscriber,
529         const sptr<NotificationSubscribeInfo> &subscribeInfo);
530 
531     /**
532      * @brief Trigger the local live view after the button has been clicked.
533      * @note Your application must have platform signature to use this method.
534      *
535      * @param bundleOption Indicates the bundle name and uid of the application whose notifications has been clicked.
536      * @param notificationId Indicates the id of the notification.
537      * @param buttonOption Indicates which button has been clicked.
538      * @return Returns trigger localLiveView result.
539      */
540     ErrCode TriggerLocalLiveView(const NotificationBundleOption &bundleOption,
541         const int32_t notificationId, const NotificationButtonOption &buttonOption);
542 
543     /**
544      * @brief Removes a specified removable notification of other applications.
545      * @note Your application must have platform signature to use this method.
546      *
547      * @param key Indicates the key of the notification to remove.
548      * @param removeReason Indicates the reason of remove notification.
549      * @return Returns remove notification result.
550      */
551     ErrCode RemoveNotification(const std::string &key, int32_t removeReason);
552 
553     /**
554      * @brief Removes a specified removable notification of other applications.
555      * @note Your application must have platform signature to use this method.
556      *
557      * @param bundleOption Indicates the bundle name and uid of the application whose notifications are to be removed.
558      * @param notificationId Indicates the id of the notification to remove.
559      * @param label Indicates the label of the notification to remove.
560      * @param removeReason Indicates the reason of remove notification.
561      * @return Returns remove notification result.
562      */
563     ErrCode RemoveNotification(const NotificationBundleOption &bundleOption, const int32_t notificationId,
564         const std::string &label, int32_t removeReason);
565 
566     /**
567      * @brief Removes a specified removable notification of other applications.
568      * @note Your application must have platform signature to use this method.
569      *
570      * @param bundleOption Indicates the bundle name and uid of the application whose notifications are to be removed.
571      * @return Returns remove notification result.
572      */
573     ErrCode RemoveAllNotifications(const NotificationBundleOption &bundleOption);
574 
575     ErrCode RemoveNotifications(const std::vector<std::string> hashcodes, int32_t removeReason);
576 
577     /**
578      * @brief Removes all removable notifications of a specified bundle.
579      * @note Your application must have platform signature to use this method.
580      *
581      * @param bundleOption Indicates the bundle name and uid of the application whose notifications are to be removed.
582      * @return Returns remove notifications result.
583      */
584     ErrCode RemoveNotificationsByBundle(const NotificationBundleOption &bundleOption);
585 
586     /**
587      * @brief Removes all removable notifications in the system.
588      * @note Your application must have platform signature to use this method.
589      *
590      * @return Returns remove notifications result.
591      */
592     ErrCode RemoveNotifications();
593 
594     /**
595      * @brief Removes Distributed notifications in the system.
596      * @note Your application must have platform signature to use this method.
597      * @return Returns remove notifications result.
598      */
599     ErrCode RemoveDistributedNotifications(const std::vector<std::string>& hashcodes,
600         const NotificationConstant::SlotType& slotType,
601         const NotificationConstant::DistributedDeleteType& deleteType,
602         const int32_t removeReason, const std::string& deviceId = "");
603 
604     /**
605      * @brief Obtains all notification slots belonging to the specified bundle.
606      *
607      * @param bundleOption Indicates the bundle name and uid of the application.
608      * @param slots Indicates a list of notification slots.
609      * @return Returns get notification slots for bundle result.
610      */
611     ErrCode GetNotificationSlotsForBundle(
612         const NotificationBundleOption &bundleOption, std::vector<sptr<NotificationSlot>> &slots);
613 
614     /**
615      * @brief Obtains notification slot belonging to the specified bundle.
616      *
617      * @param bundleOption Indicates the bundle name and uid of the application.
618      * @param slotType Indicates the type of the slot, which is created by AddNotificationSlot.
619      * @param slot Indicates a notification slot.
620      * @return Returns get notification slots for bundle result.
621      */
622     ErrCode GetNotificationSlotForBundle(
623         const NotificationBundleOption &bundleOption, const NotificationConstant::SlotType &slotType,
624         sptr<NotificationSlot> &slot);
625 
626     /**
627      * @brief Updates all notification slots for the specified bundle.
628      *
629      * @param bundleOption Indicates the bundle name and uid of the application.
630      * @param slots Indicates a list of new notification slots.
631      * @return Returns update notification slots for bundle result.
632      */
633     ErrCode UpdateNotificationSlots(
634         const NotificationBundleOption &bundleOption, const std::vector<sptr<NotificationSlot>> &slots);
635 
636     /**
637      * @brief Obtains all active notifications in the current system. The caller must have system permissions to
638      * call this method.
639      *
640      * @param notification Indicates all active notifications of this application.
641      * @return Returns get all active notifications
642      */
643     ErrCode GetAllActiveNotifications(std::vector<sptr<Notification>> &notification);
644 
645     ErrCode GetAllNotificationsBySlotType(std::vector<sptr<Notification>> &notifications,
646         const NotificationConstant::SlotType slotType);
647 
648     /**
649      * @brief Obtains the active notifications corresponding to the specified key in the system. To call this method
650      * to obtain particular active notifications, you must have received the notifications and obtained the key
651      * via {Notification::GetKey()}.
652      *
653      * @param key Indicates the key array for querying corresponding active notifications.
654      *            If this parameter is null, this method returns all active notifications in the system.
655      * @param notification Indicates the set of active notifications corresponding to the specified key.
656      * @return Returns get all active notifications result.
657      */
658     ErrCode GetAllActiveNotifications(
659         const std::vector<std::string> key, std::vector<sptr<Notification>> &notification);
660 
661     /**
662      * @brief Obtains the live view notification extra info by the extraInfoKeys. To call this method
663      * to obtain particular live view notification extra info, you must have received the
664      * @param filter
665      * @param extraInfo
666      * @return
667      */
668     ErrCode GetActiveNotificationByFilter(
669         const LiveViewFilter &filter, sptr<NotificationRequest> &request);
670 
671     /**
672      * @brief Checks whether a specified application has the permission to publish notifications. If bundle specifies
673      * the current application, no permission is required for calling this method. If bundle specifies another
674      * application, the caller must have system permissions.
675      *
676      * @param bundleOption Indicates the bundle name and uid of the application.
677      * @param allowed True if the application has permissions; returns false otherwise.
678      * @return Returns is allowed notify result.
679      */
680     ErrCode IsAllowedNotify(const NotificationBundleOption &bundleOption, bool &allowed);
681 
682     /**
683      * @brief Sets whether to allow all applications to publish notifications on a specified device. The caller must
684      * have system permissions to call this method.
685      *
686      * @param deviceId Indicates the ID of the device running the application. At present, this parameter can only
687      *                 be null or an empty string, indicating the current device.
688      * @param enabled Specifies whether to allow all applications to publish notifications. The value true
689      *                indicates that notifications are allowed, and the value false indicates that notifications are not
690      *                allowed.
691      * @return Returns set notifications enabled for all bundles result.
692      */
693     ErrCode SetNotificationsEnabledForAllBundles(const std::string &deviceId, bool enabled);
694 
695     /**
696      * @brief Sets whether to allow the current application to publish notifications on a specified device. The caller
697      * must have system permissions to call this method.
698      *
699      * @param deviceId Indicates the ID of the device running the application. At present, this parameter can
700      *                 only be null or an empty string, indicating the current device.
701      * @param enabled Specifies whether to allow the current application to publish notifications. The value
702      *                true indicates that notifications are allowed, and the value false indicates that
703      *                notifications are not allowed.
704      * @return Returns set notifications enabled for default bundle result.
705      */
706     ErrCode SetNotificationsEnabledForDefaultBundle(const std::string &deviceId, bool enabled);
707 
708     /**
709      * @brief Sets whether to allow a specified application to publish notifications on a specified device. The caller
710      * must have system permissions to call this method.
711      *
712      * @param bundleOption Indicates the bundle name and uid of the application.
713      * @param deviceId Indicates the ID of the device running the application. At present, this parameter can only
714      *                 be null or an empty string, indicating the current device.
715      * @param enabled Specifies whether to allow the given application to publish notifications. The value
716      *                true indicates that notifications are allowed, and the value false indicates that notifications
717      *                are not allowed.
718      * @return Returns set notifications enabled for specified bundle result.
719      */
720     ErrCode SetNotificationsEnabledForSpecifiedBundle(
721         const NotificationBundleOption &bundleOption, const std::string &deviceId, bool enabled);
722 
723     /**
724      * @brief Sets whether to allow a specified application to to show badge.
725      *
726      * @param bundleOption Indicates the bundle name and uid of the application.
727      * @param enabled Specifies whether to allow the given application to show badge.
728      * @return Returns set result.
729      */
730     ErrCode SetShowBadgeEnabledForBundle(const NotificationBundleOption &bundleOption, bool enabled);
731 
732     /**
733      * @brief Obtains the flag that whether to allow a specified application to to show badge.
734      *
735      * @param bundleOption Indicates the bundle name and uid of the application.
736      * @param enabled Specifies whether to allow the given application to show badge.
737      * @return Returns get result.
738      */
739     ErrCode GetShowBadgeEnabledForBundle(const NotificationBundleOption &bundleOption, bool &enabled);
740 
741     /**
742      * @brief Obtains the flag that whether to allow the current application to to show badge.
743      *
744      * @param enabled Specifies whether to allow the given application to show badge.
745      * @return Returns get result.
746      */
747     ErrCode GetShowBadgeEnabled(bool &enabled);
748 
749     /**
750      * @brief Cancels the notification of the specified group of this application.
751      *
752      * @param groupName the specified group name.
753      * @return Returns cancel group result.
754      */
755     ErrCode CancelGroup(const std::string &groupName, const std::string &instanceKey = "");
756 
757     /**
758      * @brief Removes the notification of the specified group of the specified application.
759      *
760      * @param bundleOption Indicates the bundle name and uid of the specified application.
761      * @param groupName Indicates the specified group name.
762      * @return Returns remove group by bundle result.
763      */
764     ErrCode RemoveGroupByBundle(const NotificationBundleOption &bundleOption, const std::string &groupName);
765 
766     /**
767      * @brief Sets the do not disturb time.
768      * @note Your application must have system signature to call this method.
769      *
770      * @param doNotDisturbDate Indicates the do not disturb time to set.
771      * @return Returns set do not disturb time result.
772      */
773     ErrCode SetDoNotDisturbDate(const NotificationDoNotDisturbDate &doNotDisturbDate);
774 
775     /**
776      * @brief Obtains the do not disturb time.
777      * @note Your application must have system signature to call this method.
778      *
779      * @param doNotDisturbDate Indicates the do not disturb time to get.
780      * @return Returns set do not disturb time result.
781      */
782     ErrCode GetDoNotDisturbDate(NotificationDoNotDisturbDate &doNotDisturbDate);
783 
784     /**
785      * @brief Add the do not disturb profiles.
786      * @note Your application must have system signature to call this method.
787      *
788      * @param doNotDisturbProfiles Indicates the do not disturb profiles to add.
789      * @return Returns add do not disturb profiles result.
790      */
791     ErrCode AddDoNotDisturbProfiles(const std::vector<sptr<NotificationDoNotDisturbProfile>> &profiles);
792 
793     /**
794      * @brief Remove the do not disturb profiles.
795      * @note Your application must have system signature to call this method.
796      *
797      * @param doNotDisturbProfiles Indicates the do not disturb profiles to remove.
798      * @return Returns remove do not disturb profiles result.
799      */
800     ErrCode RemoveDoNotDisturbProfiles(const std::vector<sptr<NotificationDoNotDisturbProfile>> &profiles);
801 
802     /**
803      * @brief Obtains the flag that whether to support do not disturb mode.
804      *
805      * @param doesSupport Specifies whether to support do not disturb mode.
806      * @return Returns check result.
807      */
808     ErrCode DoesSupportDoNotDisturbMode(bool &doesSupport);
809 
810     /**
811      * @brief Is coming call need silent in do not disturb mode.
812      *
813      * @param phoneNumber the calling format number.
814      * @return Returns silent in do not disturb mode.
815      */
816     ErrCode IsNeedSilentInDoNotDisturbMode(const std::string &phoneNumber, int32_t callerType);
817 
818     /**
819      * @brief Checks if the device supports distributed notification.
820      *
821      * @param enabled True if the device supports distributed notification; false otherwise.
822      * @return Returns is distributed enabled result.
823      */
824     ErrCode IsDistributedEnabled(bool &enabled);
825 
826     /**
827      * @brief Sets whether the device supports distributed notifications.
828      *
829      * @param enable Specifies whether to enable the device to support distributed notification.
830      *               The value true indicates that the device is enabled to support distributed notifications, and
831      *               the value false indicates that the device is forbidden to support distributed notifications.
832      * @return Returns enable distributed result.
833      */
834     ErrCode EnableDistributed(const bool enabled);
835 
836     /**
837      * @brief Sets whether an application supports distributed notifications.
838      *
839      * @param bundleOption Indicates the bundle name and uid of an application.
840      * @param enabled Specifies whether to enable an application to support distributed notification.
841      *                The value true indicates that the application is enabled to support distributed notifications,
842      *                and the value false indicates that the application is forbidden to support distributed
843      *                notifications.
844      * @return Returns enable distributed by bundle result.
845      */
846     ErrCode EnableDistributedByBundle(const NotificationBundleOption &bundleOption, const bool enabled);
847 
848     /**
849      * @brief Sets whether this application supports distributed notifications.
850      *
851      * @param enabled Specifies whether to enable this application to support distributed notification.
852      *                The value true indicates that this application is enabled to support distributed notifications,
853      *                and the value false indicates that this application is forbidden to support distributed
854      *                notifications.
855      * @return Returns enable distributed self result.
856      */
857     ErrCode EnableDistributedSelf(const bool enabled);
858 
859     /**
860      * @brief Checks whether an application supports distributed notifications.
861      *
862      * @param bundleOption Indicates the bundle name and uid of an application.
863      * @param enabled True if the application supports distributed notification; false otherwise.
864      * @return Returns is distributed enabled by bundle result.
865      */
866     ErrCode IsDistributedEnableByBundle(const NotificationBundleOption &bundleOption, bool &enabled);
867 
868     /**
869      * @brief Obtains the device remind type.
870      * @note Your application must have system signature to call this method.
871      *
872      * @param remindType Indicates the device remind type to get.
873      * @return Returns get device reminder type result.
874      */
875     ErrCode GetDeviceRemindType(NotificationConstant::RemindType &remindType);
876 
877     /**
878      * @brief Publishes a continuous task notification.
879      *
880      * @param request Indicates the NotificationRequest object for setting the notification content.
881      *                This parameter must be specified.
882      * @return Returns publish continuous task notification result.
883      */
884     ErrCode PublishContinuousTaskNotification(const NotificationRequest &request);
885 
886     /**
887      * @brief Cancels a published continuous task notification matching the specified label and notificationId.
888      *
889      * @param label Indicates the label of the continuous task notification to cancel.
890      * @param notificationId Indicates the ID of the continuous task notification to cancel.
891      * @return Returns cancel continuous task notification result.
892      */
893     ErrCode CancelContinuousTaskNotification(const std::string &label, int32_t notificationId);
894 
895     /**
896      * @brief Obtains whether the template is supported by the system.
897      *
898      * @param support whether is it a system supported template.
899      * @return Returns check result.
900      */
901     ErrCode IsSupportTemplate(const std::string &templateName, bool &support);
902 
903     /**
904      * @brief Resets ans manager proxy when OnRemoteDied called.
905      */
906     void ResetAnsManagerProxy();
907 
908     /**
909      * @brief try to reconnect ans SA when SA manager OnAddSystemAbility called.
910      */
911     void Reconnect();
912     /**
913      * @brief Checks whether this application has permission to publish notifications under the user.
914      *
915      * @param userId Indicates the userId of the application.
916      * @param allowed True if the application has permissions; returns false otherwise.
917      * @return Returns get allowed result.
918      */
919     ErrCode IsAllowedNotify(const int32_t &userId, bool &allowed);
920 
921     /**
922      * @brief Sets whether to allow all applications to publish notifications on a specified user.
923      * The caller must have system permissions to call this method.
924      *
925      * @param userId Indicates the ID of the user running the application.
926      * @param enabled Specifies whether to allow all applications to publish notifications. The value true
927      *                indicates that notifications are allowed, and the value false indicates that notifications
928      *                are not allowed.
929      * @return Returns set notifications enabled for all bundles result.
930      */
931     ErrCode SetNotificationsEnabledForAllBundles(const int32_t &userId, bool enabled);
932 
933     /**
934      * @brief Removes notifications under specified user.
935      * @note Your application must have platform signature to use this method.
936      *
937      * @param userId Indicates the ID of user whose notifications are to be removed.
938      * @return Returns remove notification result.
939      */
940     ErrCode RemoveNotifications(const int32_t &userId);
941 
942     /**
943      * @brief Sets the do not disturb time on a specified user.
944      * @note Your application must have system signature to call this method.
945      *
946      * @param userId Indicates the specific user.
947      * @param doNotDisturbDate Indicates the do not disturb time to set.
948      * @return Returns set do not disturb time result.
949      */
950     ErrCode SetDoNotDisturbDate(const int32_t &userId, const NotificationDoNotDisturbDate &doNotDisturbDate);
951 
952     /**
953      * @brief Obtains the do not disturb time on a specified user.
954      * @note Your application must have system signature to call this method.
955      *
956      * @param userId Indicates the specific user.
957      * @param doNotDisturbDate Indicates the do not disturb time to get.
958      * @return Returns set do not disturb time result.
959      */
960     ErrCode GetDoNotDisturbDate(const int32_t &userId, NotificationDoNotDisturbDate &doNotDisturbDate);
961 
962     /**
963      * Set whether the application slot is enabled.
964      *
965      * @param bundleOption Indicates the bundle name and uid of the application.
966      * @param slotType Indicates type of slot.
967      * @param enable the type of slot enabled.
968      * @param isForceControl Indicates whether the slot is affected by the notification switch.
969      * @return Returns get slot number by bundle result.
970      */
971     ErrCode SetEnabledForBundleSlot(const NotificationBundleOption &bundleOption,
972         const NotificationConstant::SlotType &slotType, bool enabled, bool isForceControl);
973 
974     /**
975      * Obtains whether the application slot is enabled.
976      *
977      * @param bundleOption Indicates the bundle name and uid of the application.
978      * @param slotType Indicates type of slot.
979      * @param enable the type of slot enabled to get.
980      * @return Returns get slot number by bundle result.
981      */
982     ErrCode GetEnabledForBundleSlot(
983         const NotificationBundleOption &bundleOption, const NotificationConstant::SlotType &slotType, bool &enabled);
984 
985     /**
986      * Obtains whether the current application slot is enabled.
987      *
988      * @param slotType Indicates type of slot.
989      * @param enable the type of slot enabled to get.
990      * @return Returns get enabled result.
991      */
992     ErrCode GetEnabledForBundleSlotSelf(const NotificationConstant::SlotType &slotType, bool &enabled);
993 
994     /**
995      * @brief Obtains specific datas via specified dump option.
996      *
997      * @param cmd Indicates the specified dump command.
998      * @param bundle Indicates the specified bundle name.
999      * @param userId Indicates the specified userId.
1000      * @param recvUserId Indicates the specified receiver userId.
1001      * @param dumpInfo Indicates the container containing datas.
1002      * @return Returns check result.
1003      */
1004     ErrCode ShellDump(const std::string &cmd, const std::string &bundle, int32_t userId, int32_t recvUserId,
1005         std::vector<std::string> &dumpInfo);
1006 
1007     /**
1008      * @brief Set whether to sync notifications to devices that do not have the app installed.
1009      *
1010      * @param userId Indicates the specific user.
1011      * @param enabled Allow or disallow sync notifications.
1012      * @return Returns set enabled result.
1013      */
1014     ErrCode SetSyncNotificationEnabledWithoutApp(const int32_t userId, const bool enabled);
1015 
1016     /**
1017      * @brief Obtains whether to sync notifications to devices that do not have the app installed.
1018      *
1019      * @param userId Indicates the specific user.
1020      * @param enabled Allow or disallow sync notifications.
1021      * @return Returns get enabled result.
1022      */
1023     ErrCode GetSyncNotificationEnabledWithoutApp(const int32_t userId, bool &enabled);
1024 
1025     /**
1026      * @brief Set badge number.
1027      *
1028      * @param badgeNumber The badge number.
1029      * @return Returns set badge number result.
1030      */
1031     ErrCode SetBadgeNumber(int32_t badgeNumber, const std::string &instanceKey = "");
1032 
1033     /**
1034      * @brief Set badge number by bundle.
1035      *
1036      * @param bundleOption Indicates the bundle name and uid of the application.
1037      * @param badgeNumber The badge number.
1038      * @return Returns set badge number by bundle result.
1039      */
1040     ErrCode SetBadgeNumberByBundle(const NotificationBundleOption &bundleOption, int32_t badgeNumber);
1041 
1042     /**
1043      * @brief Set badge number for dh by bundle.
1044      *
1045      * @param bundleOption Indicates the bundle name and uid of the application.
1046      * @param badgeNumber The badge number.
1047      * @return Returns set badge number by bundle result.
1048      */
1049     ErrCode SetBadgeNumberForDhByBundle(const NotificationBundleOption &bundleOption, int32_t badgeNumber);
1050 
1051     /**
1052      * @brief Obtains allow notification application list.
1053      *
1054      * @param bundleOption Indicates the bundle bundleOption.
1055      * @return Returns ERR_OK on success, others on failure.
1056      */
1057     ErrCode GetAllNotificationEnabledBundles(std::vector<NotificationBundleOption> &bundleOption);
1058 
1059     /**
1060      * @brief Obtains allow liveview application list.
1061      *
1062      * @param bundleOption Indicates the bundle bundleOption.
1063      * @return Returns ERR_OK on success, others on failure.
1064      */
1065     ErrCode GetAllLiveViewEnabledBundles(std::vector<NotificationBundleOption> &bundleOption);
1066 
1067     /**
1068      * @brief Obtains allow distributed application list.
1069      *
1070      * @param deviceType Indicates device type.
1071      * @param bundleOption Indicates the bundle bundleOption.
1072      * @return Returns ERR_OK on success, others on failure.
1073      */
1074     ErrCode GetAllDistribuedEnabledBundles(const std::string& deviceType,
1075         std::vector<NotificationBundleOption> &bundleOption);
1076 
1077     /**
1078      * @brief Register Push Callback.
1079      *
1080      * @param pushCallback PushCallBack.
1081      * @param notificationCheckRequest Filter conditions for push check
1082      * @return Returns register PushCallback result.
1083      */
1084     ErrCode RegisterPushCallback(
1085         const sptr<IRemoteObject> &pushCallback, const sptr<NotificationCheckRequest> &notificationCheckRequest);
1086 
1087     /**
1088      * @brief Unregister Push Callback.
1089      *
1090      * @return Returns unregister push Callback result.
1091      */
1092     ErrCode UnregisterPushCallback();
1093 
1094     /**
1095      * @brief Set agent relationship.
1096      *
1097      * @param key Indicates storing agent relationship if the value is "PROXY_PKG".
1098      * @param value Indicates key-value pair of agent relationship.
1099      * @return Returns set result.
1100      */
1101     ErrCode SetAdditionConfig(const std::string &key, const std::string &value);
1102 
1103     /**
1104      * @brief Sets whether to allow a specified application to publish notifications cross
1105      * device collaboration. The caller must have system permissions to call this method.
1106      *
1107      * @param bundleOption Indicates the bundle name and uid of the application.
1108      * @param deviceType Indicates the type of the device running the application.
1109      * @param enabled Specifies whether to allow the given application to publish notifications. The value
1110      *                true indicates that notifications are allowed, and the value false indicates that notifications
1111      *                are not allowed.
1112      * @return Returns set notifications enabled for specified bundle result.
1113      */
1114     ErrCode SetDistributedEnabledByBundle(
1115         const NotificationBundleOption &bundleOption, const std::string &deviceType, const bool enabled);
1116 
1117     /**
1118      * @brief Sets whether to allow a specified application to publish notifications cross
1119      * device collaboration. The caller must have system permissions to call this method.
1120      *
1121      * @param bundles Indicates the bundles.
1122      * @param deviceType Indicates the type of the device running the application.
1123      * @return Returns set distributed enabled for specified bundle result.
1124      */
1125     ErrCode SetDistributedBundleOption(
1126         const std::vector<DistributedBundleOption> &bundles, const std::string &deviceType);
1127 
1128     /**
1129      * @brief get whether to allow a specified application to publish notifications cross
1130      * device collaboration. The caller must have system permissions to call this method.
1131      *
1132      * @param bundleOption Indicates the bundle name and uid of the application.
1133      * @param deviceType Indicates the type of the device running the application.
1134      * @param enabled Specifies whether to allow the given application to publish notifications. The value
1135      *                true indicates that notifications are allowed, and the value false indicates that notifications
1136      *                are not allowed.
1137      * @return Returns set notifications enabled for specified bundle result.
1138      */
1139     ErrCode IsDistributedEnabledByBundle(
1140         const NotificationBundleOption &bundleOption, const std::string &deviceType, bool &enabled);
1141 
1142     /**
1143      * @brief Sets whether to allow a specified application to publish notifications cross
1144      * device collaboration. The caller must have system permissions to call this method.
1145      *
1146      * @param bundleOption Indicates the bundle name and uid of the application.
1147      * @param enabled Specifies whether to allow the given application to publish notifications. The value
1148      *                true indicates that notifications are allowed, and the value false indicates that notifications
1149      *                are not allowed.
1150      * @return Returns set notifications enabled for specified bundle result.
1151      */
1152     ErrCode SetSilentReminderEnabled(const NotificationBundleOption &bundleOption, const bool enabled);
1153 
1154     /**
1155      * @brief get whether to allow a specified application to publish notifications cross
1156      * device collaboration. The caller must have system permissions to call this method.
1157      *
1158      * @param bundleOption Indicates the bundle name and uid of the application.
1159      * @param enabled Specifies whether to allow the given application to publish notifications. The value
1160      *                true indicates that notifications are allowed, and the value false indicates that notifications
1161      *                are not allowed.
1162      * @return Returns set notifications enabled for specified bundle result.
1163      */
1164     ErrCode IsSilentReminderEnabled(const NotificationBundleOption &bundleOption, int32_t &enableStatus);
1165 
1166     /**
1167      * @brief Configuring Whether to Synchronize Common Notifications to Target Devices.
1168      *
1169      * @param deviceType Target device type.
1170      * @param enabled Whether to Synchronize Common Notifications to Target Devices.
1171      * @return Returns configuring Whether to Synchronize Common Notifications to Target Devices result.
1172      */
1173     ErrCode SetDistributedEnabled(const std::string &deviceType, const bool &enabled);
1174 
1175     /**
1176      * @brief Querying Whether to Synchronize Common Devices to Target Devices.
1177      *
1178      * @param deviceType Target device type.
1179      * @param enabled Whether to Synchronize Common Notifications to Target Devices.
1180      * @return Returns Whether to Synchronize Common Notifications to Target Devices result.
1181      */
1182     ErrCode IsDistributedEnabled(const std::string &deviceType, bool &enabled);
1183 
1184     /**
1185      * @brief Obtains the set of supported distributed abilities.
1186      *
1187      * @param abilityId The set of supported distributed abilities.
1188      * @return Returns result in Obtains the set of supported distributed abilities.
1189      */
1190     ErrCode GetDistributedAbility(int32_t &abilityId);
1191 
1192     /**
1193      * @brief Get the target device's authorization status.
1194      *
1195      * @param deviceType Type of the target device whose status you want to set.
1196      * @param deviceId The id of the target device.
1197      * @param userId The userid of the target device.
1198      * @param isAuth Return The authorization status.
1199      * @return Returns get result.
1200      */
1201     ErrCode GetDistributedAuthStatus(
1202         const std::string &deviceType, const std::string &deviceId, int32_t userId, bool &isAuth);
1203 
1204     /**
1205      * @brief Set the target device's authorization status.
1206      *
1207      * @param deviceType Type of the target device whose status you want to set.
1208      * @param deviceId The id of the target device.
1209      * @param userId The userid of the target device.
1210      * @param isAuth The authorization status.
1211      * @return Returns set result.
1212      */
1213     ErrCode SetDistributedAuthStatus(
1214         const std::string &deviceType, const std::string &deviceId, int32_t userId, bool isAuth);
1215 
1216     /**
1217      * @brief Get Enable smartphone to collaborate with other devices for intelligent reminders
1218      *
1219      * @param deviceType Indicates the type of the device running the application.
1220      * @param enabled Specifies whether to allow the given application to publish notifications.
1221      *                The value true indicates that notifications are allowed, and the value
1222      *                false indicates that notifications are not allowed.
1223      * @return Returns set notifications enabled for specified bundle result.
1224      */
1225     ErrCode IsSmartReminderEnabled(const std::string &deviceType, bool &enabled);
1226 
1227     /**
1228      * @brief Set Enable smartphone to collaborate with other devices for intelligent reminders
1229      *
1230      * @param deviceType Indicates the type of the device running the application.
1231      * @param enabled Specifies whether to allow the given application to publish notifications.
1232      *                The value true indicates that notifications are allowed, and the value
1233      *                false indicates that notifications are not allowed.
1234      * @return Returns set notifications enabled for specified bundle result.
1235      */
1236     ErrCode SetSmartReminderEnabled(const std::string &deviceType, const bool enabled);
1237 
1238     /**
1239      * @brief Set the channel switch for collaborative reminders.
1240        The caller must have system permissions to call this method.
1241      *
1242      * @param slotType Indicates the slot type of the application.
1243      * @param deviceType Indicates the type of the device running the application.
1244      * @param enabled Indicates slot switch status.
1245      * @return Returns set channel switch result.
1246      */
1247     ErrCode SetDistributedEnabledBySlot(
1248         const NotificationConstant::SlotType &slotType, const std::string &deviceType, const bool enabled);
1249 
1250     /**
1251      * @brief Query the channel switch for collaborative reminders.
1252        The caller must have system permissions to call this method.
1253      *
1254      * @param slotType Indicates the slot type of the application.
1255      * @param deviceType Indicates the type of the device running the application.
1256      * @param enabled Indicates slot switch status.
1257      * @return Returns channel switch result.
1258      */
1259     ErrCode IsDistributedEnabledBySlot(
1260         const NotificationConstant::SlotType &slotType, const std::string &deviceType, bool &enabled);
1261 
1262     /**
1263      * @brief Cancels a published agent notification.
1264      *
1265      * @param bundleOption Indicates the bundle name and uid of the application.
1266      * @param id Indicates the unique notification ID in the application.
1267      * @return Returns cancel result.
1268      */
1269     ErrCode CancelAsBundleWithAgent(const NotificationBundleOption &bundleOption, const int32_t id);
1270 
1271     /**
1272      * @brief Set the status of the target device.
1273      *
1274      * @param deviceType Type of the device whose status you want to set.
1275      * @param status The status.
1276      * @return Returns set result.
1277      */
1278     ErrCode SetTargetDeviceStatus(const std::string &deviceType, const uint32_t status,
1279         const std::string deviceId = std::string());
1280 
1281     /**
1282      * @brief Set the status of the target device.
1283      *
1284      * @param deviceType Type of the device whose status you want to set.
1285      * @param status The status.
1286      * @param controlFlag The control flag.
1287      * @return Returns set result.
1288      */
1289     ErrCode SetTargetDeviceStatus(const std::string &deviceType, const uint32_t status, const uint32_t controlFlag,
1290         const std::string deviceId = std::string(), int32_t userId = 0);
1291 
1292     ErrCode SetTargetDeviceBundleList(const std::string& deviceType, const std::string& deviceId,
1293             int operatorType, const std::vector<std::string>& bundleList, const std::vector<std::string>& labelList);
1294 
1295     ErrCode SetTargetDeviceSwitch(const std::string& deviceType, const std::string& deviceId,
1296             bool notificaitonEnable, bool liveViewEnable);
1297 
1298     ErrCode GetTargetDeviceBundleList(const std::string& deviceType, const std::string& deviceId,
1299             std::vector<std::string>& bundleList, std::vector<std::string>& labelList);
1300 
1301     ErrCode GetMutilDeviceStatus(const std::string &deviceType, const uint32_t status,
1302         std::string& deviceId, int32_t& userId);
1303 
1304 #ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED
1305     /**
1306      * @brief Register Swing swingCbFunc.
1307      *
1308      * @param swingCallback swingCbFunc.
1309      * @return Returns register swingCbFunc result.
1310      */
1311     ErrCode RegisterSwingCallback(const std::function<void(bool, int)> swingCbFunc);
1312 #endif
1313 
1314     /**
1315      * @brief Get do not disturb profile by id.
1316      *
1317      * @param id Profile id.
1318      * @param status Indicates the NotificationDoNotDisturbProfile objects.
1319      * @return Returns ERR_OK on success, others on failure.
1320      */
1321     ErrCode GetDoNotDisturbProfile(int64_t id, sptr<NotificationDoNotDisturbProfile> &profile);
1322 
1323     /**
1324      * @brief Get the status of the target device.
1325      *
1326      * @param deviceType Type of the device whose status you want to set.
1327      * @param status The status.
1328      * @return Returns set result.
1329      */
1330     ErrCode GetTargetDeviceStatus(const std::string &deviceType, int32_t& status);
1331 
1332     /**
1333      * @brief Whether reminders are allowed.
1334      *
1335      * @param bundleName app bundleName
1336      * @param isAllowUseReminder is allow use reminder
1337      * @return Returns ERR_OK on success, others on failure.
1338      */
1339     ErrCode AllowUseReminder(const std::string& bundleName, bool& isAllowUseReminder);
1340 
1341     /**
1342      * @brief Ans service died, OnRemoteDied called.
1343      */
1344     void OnServiceDied();
1345 
1346     /**
1347      * @brief Update Notification Timer by uid.
1348      *
1349      * @param uid uid.
1350      * @return Returns Update result.
1351      */
1352     ErrCode UpdateNotificationTimerByUid(const int32_t uid, const bool isPaused);
1353 
1354     /**
1355      * @brief Set switch and bundle list of disable notification feature.
1356      *
1357      * @param notificationDisable Switch and bundle list of disable notification feature.
1358      * @return Returns set result.
1359      */
1360     ErrCode DisableNotificationFeature(const NotificationDisable &notificationDisable);
1361 
1362     /**
1363      * @brief Distribution operation based on hashCode.
1364      *
1365      * @param hashCode Unique ID of the notification.
1366      * @return Returns ERR_OK on success, others on failure.
1367      */
1368     ErrCode DistributeOperation(sptr<NotificationOperationInfo>& operationInfo,
1369         const sptr<IAnsOperationCallback> &callback);
1370 
1371     /**
1372      * @brief Reply distribute operation.
1373      *
1374      * @param hashCode Unique ID of the notification.
1375      * @param result The result of the distribute operation.
1376      * @return Returns ERR_OK on success, others on failure.
1377      */
1378     ErrCode ReplyDistributeOperation(const std::string& hashCode, const int32_t result);
1379 
1380     /**
1381      * @brief Get notificationRequest by hashCode.
1382      *
1383      * @param hashCode Unique ID of the notification.
1384      * @param notificationRequest The request of of the notification.
1385      * @return Returns ERR_OK on success, others on failure.
1386      */
1387     ErrCode GetNotificationRequestByHashCode(
1388         const std::string& hashCode, sptr<NotificationRequest>& notificationRequest);
1389 
1390     /**
1391      * @brief set rule of generate hashCode.
1392      *
1393      * @param type generate hashCode.
1394      * @return Returns ERR_OK on success, others on failure.
1395      */
1396     ErrCode SetHashCodeRule(const uint32_t type);
1397 
1398     /**
1399      * @brief get distributed device list.
1400      *
1401      * @param deviceTypes Indicates device types.
1402      * @return Returns ERR_OK on success, others on failure.
1403      */
1404     ErrCode GetDistributedDevicelist(std::vector<std::string> &deviceTypes);
1405 
1406 private:
1407     /**
1408      * @brief Gets Ans Manager proxy.
1409      *
1410      * @return Returns true if succeed; returns false otherwise.
1411      */
1412     sptr<IAnsManager> GetAnsManagerProxy();
1413 
1414     /**
1415      * @brief Checks if the MediaContent can be published.
1416      *
1417      * @param request Indicates the specified request.
1418      * @return Returns true if the MediaContent can be published; returns false otherwise.
1419      */
1420     bool CanPublishMediaContent(const NotificationRequest &request) const;
1421 
1422     /**
1423      * @brief Checks whether the picture size exceeds the limit.
1424      *
1425      * @param request Indicates the specified request.
1426      * @return Returns the ErrCode.
1427      */
1428     ErrCode CheckImageSize(const NotificationRequest &request);
1429 
1430     /**
1431      * @brief Checks whether the notification doesn't support distribution.
1432      *
1433      * @param type Indicates the specified NotificationContent::Type.
1434      * @return Returns true if the notification doesn't support distribution; returns false otherwise.
1435      */
1436     bool IsNonDistributedNotificationType(const NotificationContent::Type &type);
1437 
1438     /**
1439      * @brief Checks if the LiveViewContent can be published.
1440      *
1441      * @param request Indicates the specified request.
1442      * @return Returns true if the MediaContent can be published; returns false otherwise.
1443      */
1444     bool CanPublishLiveViewContent(const NotificationRequest &request) const;
1445 
1446     bool IsValidTemplate(const NotificationRequest &request) const;
1447     bool IsValidDelayTime(const NotificationRequest &request) const;
1448     void CreateSubscribeListener(const std::shared_ptr<NotificationSubscriber> &subscriber,
1449         sptr<SubscriberListener> &listener);
1450 
1451 private:
1452     std::mutex subscriberMutex_;
1453     std::map<std::shared_ptr<NotificationSubscriber>, sptr<SubscriberListener>> subscribers_;
1454 #ifdef NOTIFICATION_SMART_REMINDER_SUPPORTED
1455     sptr<SwingCallBackService> swingCallBackService_;
1456 #endif
1457 };
1458 }  // namespace Notification
1459 }  // namespace OHOS
1460 
1461 #endif  // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_NOTIFICATION_H
1462