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