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