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