• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_MANAGER_INTERFACE_H
17 #define BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_MANAGER_INTERFACE_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "ans_subscriber_interface.h"
23 #include "iremote_broker.h"
24 #include "notification_bundle_option.h"
25 #include "notification_constant.h"
26 #include "notification_do_not_disturb_date.h"
27 #include "notification_request.h"
28 #include "notification_slot.h"
29 #include "notification_subscribe_info.h"
30 #include "reminder_request.h"
31 
32 namespace OHOS {
33 namespace Notification {
34 class AnsManagerInterface : public IRemoteBroker {
35 public:
36     AnsManagerInterface() = default;
37     virtual ~AnsManagerInterface() = default;
38     DISALLOW_COPY_AND_MOVE(AnsManagerInterface);
39 
40     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Notification.AnsManagerInterface");
41 
42     /**
43      * @brief Publishes a notification with a specified label.
44      * @note If a notification with the same ID has been published by the current application and has not been deleted,
45      *       this method will update the notification.
46      *
47      * @param label Indicates the label of the notification to publish.
48      * @param notification Indicates the NotificationRequest object for setting the notification content.
49      *                This parameter must be specified.
50      * @return Returns ERR_OK on success, others on failure.
51      */
52     virtual ErrCode Publish(const std::string &label, const sptr<NotificationRequest> &notification) = 0;
53 
54     /**
55      * @brief Publishes a notification on a specified remote device.
56      * @note If a notification with the same ID has been published by the current application and has not been deleted,
57      *       this method will update the notification.
58      *
59      * @param notification Indicates the NotificationRequest object for setting the notification content.
60      *                This parameter must be specified.
61      * @param deviceId Indicates the ID of the remote device. If this parameter is null or an empty string,
62      *                 the notification will be published on the local device.
63      * @return Returns ERR_OK on success, others on failure.
64      */
65     virtual ErrCode PublishToDevice(const sptr<NotificationRequest> &notification, const std::string &deviceId) = 0;
66 
67     /**
68      * @brief Cancels a published notification matching the specified label and notificationId.
69      *
70      * @param notificationId Indicates the ID of the notification to cancel.
71      * @param label Indicates the label of the notification to cancel.
72      * @return Returns cancel notification result.
73      */
74     virtual ErrCode Cancel(int notificationId, const std::string &label) = 0;
75 
76     /**
77      * @brief Cancels all the published notifications.
78      *
79      * @return Returns ERR_OK on success, others on failure.
80      */
81     virtual ErrCode CancelAll() = 0;
82 
83     /**
84      * @brief Cancels a published agent notification.
85      *
86      * @param notificationId Indicates the unique notification ID in the application.
87      *                       The value must be the ID of a published notification.
88      *                       Otherwise, this method does not take effect.
89      * @param representativeBundle Indicates the name of application bundle your application is representing.
90      * @param userId Indicates the specific user.
91      * @return Returns cancel notification result.
92      */
93     virtual ErrCode CancelAsBundle(
94         int32_t notificationId, const std::string &representativeBundle, int32_t userId) = 0;
95 
96     /**
97      * @brief Adds a notification slot by type.
98      *
99      * @param slotType Indicates the notification slot type to be added.
100      * @return Returns ERR_OK on success, others on failure.
101      */
102     virtual ErrCode AddSlotByType(NotificationConstant::SlotType slotType) = 0;
103 
104     /**
105      * @brief Creates multiple notification slots.
106      *
107      * @param slots Indicates the notification slots to create.
108      * @return Returns ERR_OK on success, others on failure.
109      */
110     virtual ErrCode AddSlots(const std::vector<sptr<NotificationSlot>> &slots) = 0;
111 
112     /**
113      * @brief Deletes a created notification slot based on the slot ID.
114      *
115      * @param slotType Indicates the type of the slot, which is created by AddNotificationSlot
116      *                 This parameter must be specified.
117      * @return Returns ERR_OK on success, others on failure.
118      */
119     virtual ErrCode RemoveSlotByType(const NotificationConstant::SlotType &slotType) = 0;
120 
121     /**
122      * @brief Deletes all notification slots.
123      *
124      * @return Returns ERR_OK on success, others on failure.
125      */
126     virtual ErrCode RemoveAllSlots() = 0;
127 
128     /**
129      * @brief Queries a created notification slot.
130      *
131      * @param slotType Indicates the ID of the slot, which is created by AddNotificationSlot(NotificationSlot). This
132      *        parameter must be specified.
133      * @param slot Indicates the created NotificationSlot.
134      * @return Returns ERR_OK on success, others on failure.
135      */
136     virtual ErrCode GetSlotByType(const NotificationConstant::SlotType &slotType, sptr<NotificationSlot> &slot) = 0;
137 
138     /**
139      * @brief Obtains all notification slots of this application.
140      *
141      * @param slots Indicates the created NotificationSlot.
142      * @return Returns ERR_OK on success, others on failure.
143      */
144     virtual ErrCode GetSlots(std::vector<sptr<NotificationSlot>> &slots) = 0;
145 
146     /**
147      * @brief Obtains the number of slot.
148      *
149      * @param bundleOption Indicates the bundle name and uid of the application.
150      * @param num Indicates the number of slot.
151      * @return Returns ERR_OK on success, others on failure.
152      */
153     virtual ErrCode GetSlotNumAsBundle(const sptr<NotificationBundleOption> &bundleOption, uint64_t &num) = 0;
154 
155     /**
156      * @brief Obtains active notifications of the current application in the system.
157      *
158      * @param notifications Indicates active NotificationRequest objects of the current application.
159      * @return Returns ERR_OK on success, others on failure.
160      */
161     virtual ErrCode GetActiveNotifications(std::vector<sptr<NotificationRequest>> &notifications) = 0;
162 
163     /**
164      * @brief Obtains the number of active notifications of the current application in the system.
165      *
166      * @param num Indicates the number of active notifications of the current application.
167      * @return Returns ERR_OK on success, others on failure.
168      */
169     virtual ErrCode GetActiveNotificationNums(uint64_t &num) = 0;
170 
171     /**
172      * @brief Obtains all active notifications in the current system. The caller must have system permissions to
173      * call this method.
174      *
175      * @param notifications Indicates all active notifications of this application.
176      * @return Returns ERR_OK on success, others on failure.
177      */
178     virtual ErrCode GetAllActiveNotifications(std::vector<sptr<Notification>> &notifications) = 0;
179 
180     /**
181      * @brief Obtains the active notifications corresponding to the specified key in the system. To call this method
182      * to obtain particular active notifications, you must have received the notifications and obtained the key
183      * via {Notification::GetKey()}.
184      *
185      * @param key Indicates the key array for querying corresponding active notifications.
186      *            If this parameter is null, this method returns all active notifications in the system.
187      * @param notification Indicates the set of active notifications corresponding to the specified key.
188      * @return Returns ERR_OK on success, others on failure.
189      */
190     virtual ErrCode GetSpecialActiveNotifications(
191         const std::vector<std::string> &key, std::vector<sptr<Notification>> &notifications) = 0;
192 
193     /**
194      * @brief Allows another application to act as an agent to publish notifications in the name of your application
195      * bundle.
196      *
197      * @param agent Indicates the name of the application bundle that can publish notifications for your application.
198      * @return Returns ERR_OK on success, others on failure.
199      */
200     virtual ErrCode SetNotificationAgent(const std::string &agent) = 0;
201 
202     /**
203      * @brief Obtains the name of the application bundle that can publish notifications in the name of your application.
204      *
205      * @param agent Indicates the name of the application bundle that can publish notifications for your application if
206      * any; returns null otherwise.
207      * @return Returns ERR_OK on success, others on failure.
208      */
209     virtual ErrCode GetNotificationAgent(std::string &agent) = 0;
210 
211     /**
212      * @brief Checks whether your application has permission to publish notifications by calling
213      * PublishNotificationAsBundle(string, NotificationRequest) in the name of another application indicated by the
214      * given representativeBundle.
215      *
216      * @param representativeBundle Indicates the name of application bundle your application is representing.
217      * @param canPublish Indicates whether your application has permission to publish notifications.
218      * @return Returns ERR_OK on success, others on failure.
219      */
220     virtual ErrCode CanPublishAsBundle(const std::string &representativeBundle, bool &canPublish) = 0;
221 
222     /**
223      * @brief Publishes a notification in the name of a specified application bundle.
224      * @note If the notification to be published has the same ID as a published notification that has not been canceled,
225      * the existing notification will be replaced by the new one.
226      *
227      * @param notification Indicates the NotificationRequest object for setting the notification content.
228      *                This parameter must be specified.
229      * @param representativeBundle Indicates the name of the application bundle that allows your application to publish
230      *                             notifications for it by calling setNotificationAgent.
231      * @return Returns ERR_OK on success, others on failure.
232      */
233     virtual ErrCode PublishAsBundle(
234         const sptr<NotificationRequest> notification, const std::string &representativeBundle) = 0;
235 
236     /**
237      * @brief Sets the number of active notifications of the current application as the number to be displayed on the
238      * notification badge.
239      *
240      * @param num Indicates the badge number.
241      * @return Returns ERR_OK on success, others on failure.
242      */
243     virtual ErrCode SetNotificationBadgeNum(int num) = 0;
244 
245     /**
246      * @brief Obtains the importance level of this application.
247      *
248      * @param importance Indicates the importance level of this application, which can be LEVEL_NONE,
249                LEVEL_MIN, LEVEL_LOW, LEVEL_DEFAULT, LEVEL_HIGH, or LEVEL_UNDEFINED.
250      * @return Returns ERR_OK on success, others on failure.
251      */
252     virtual ErrCode GetBundleImportance(int &importance) = 0;
253 
254     /**
255      * @brief Checks whether this application has permission to modify the Do Not Disturb (DND) notification policy.
256      *
257      * @param granted True if the application has permission; false for otherwise.
258      * @return Returns ERR_OK on success, others on failure.
259      */
260     virtual ErrCode HasNotificationPolicyAccessPermission(bool &granted) = 0;
261 
262     /**
263      * @brief Set whether to allow private notifications.
264      *
265      * @param allow Indicates the flag that allows private notification.
266      * @return Returns ERR_OK on success, others on failure.
267      */
268     virtual ErrCode SetPrivateNotificationsAllowed(bool allow) = 0;
269 
270     /**
271      * @brief Get whether to allow private notifications.
272      *
273      * @param allow Indicates the flag that allows private notification.
274      * @return Returns ERR_OK on success, others on failure.
275      */
276     virtual ErrCode GetPrivateNotificationsAllowed(bool &allow) = 0;
277 
278     /**
279      * @brief Delete notification based on key.
280      *
281      * @param key Indicates the key to delete notification.
282      * @param removeReason Indicates the reason of remove notification.
283      * @return Returns ERR_OK on success, others on failure.
284      */
285     virtual ErrCode Delete(const std::string &key, int32_t removeReason) = 0;
286 
287     /**
288      * @brief Delete notification.
289      *
290      * @param bundleOption Indicates the NotificationBundleOption of the notification.
291      * @param notificationId Indicates the id of the notification.
292      * @param label Indicates the label of the notification.
293      * @param removeReason Indicates the reason of remove notification.
294      * @return Returns ERR_OK on success, others on failure.
295      */
296     virtual ErrCode RemoveNotification(const sptr<NotificationBundleOption> &bundleOption, int notificationId,
297         const std::string &label, int32_t removeReason) = 0;
298 
299     /**
300      * @brief Delete all notifications.
301      *
302      * @param bundleOption Indicates the NotificationBundleOption of notifications.
303      * @return Returns ERR_OK on success, others on failure.
304      */
305     virtual ErrCode RemoveAllNotifications(const sptr<NotificationBundleOption> &bundleOption) = 0;
306 
307     /**
308      * @brief Remove notifications based on bundle.
309      *
310      * @param bundleOption Indicates the NotificationBundleOption of notifications.
311      * @return Returns ERR_OK on success, others on failure.
312      */
313     virtual ErrCode DeleteByBundle(const sptr<NotificationBundleOption> &bundleOption) = 0;
314 
315     /**
316      * @brief Remove all notifications.
317      *
318      * @return Returns ERR_OK on success, others on failure.
319      */
320     virtual ErrCode DeleteAll() = 0;
321 
322     /**
323      * @brief Get all the slots corresponding to the bundle.
324      *
325      * @param bundleOption Indicates the NotificationBundleOption object.
326      * @param slots Indicates the notification slots.
327      * @return Returns ERR_OK on success, others on failure.
328      */
329     virtual ErrCode GetSlotsByBundle(
330         const sptr<NotificationBundleOption> &bundleOption, std::vector<sptr<NotificationSlot>> &slots) = 0;
331 
332     /**
333      * @brief Update slots according to bundle.
334      *
335      * @param bundleOption Indicates the NotificationBundleOption object.
336      * @param slots Indicates the notification slots to be updated.
337      * @return Returns ERR_OK on success, others on failure.
338      */
339     virtual ErrCode UpdateSlots(
340         const sptr<NotificationBundleOption> &bundleOption, const std::vector<sptr<NotificationSlot>> &slots) = 0;
341 
342     /**
343      * @brief Allow notifications to be sent based on the deviceId.
344      *
345      * @param deviceId Indicates the device Id.
346      * @return Returns ERR_OK on success, others on failure.
347      */
348     virtual ErrCode RequestEnableNotification(const std::string &deviceId) = 0;
349 
350     /**
351      * @brief Set whether to allow the specified deviceId to send notifications for current bundle.
352      *
353      * @param deviceId Indicates the device Id.
354      * @param enabled Indicates the flag that allows notification to be pulished.
355      * @return Returns ERR_OK on success, others on failure.
356      */
357     virtual ErrCode SetNotificationsEnabledForBundle(const std::string &deviceId, bool enabled) = 0;
358 
359     /**
360      * @brief Set whether to allow the specified deviceId to send notifications for all bundles.
361      *
362      * @param deviceId Indicates the device Id.
363      * @param enabled Indicates the flag that allows notification to be pulished.
364      * @return Returns ERR_OK on success, others on failure.
365      */
366     virtual ErrCode SetNotificationsEnabledForAllBundles(const std::string &deviceId, bool enabled) = 0;
367 
368     /**
369      * @brief Set whether to allow the specified bundle to send notifications.
370      *
371      * @param bundleOption Indicates the NotificationBundleOption object.
372      * @param enabled Indicates the flag that allows notification to be pulished.
373      * @return Returns ERR_OK on success, others on failure.
374      */
375     virtual ErrCode SetNotificationsEnabledForSpecialBundle(
376         const std::string &deviceId, const sptr<NotificationBundleOption> &bundleOption, bool enabled) = 0;
377 
378     /**
379      * @brief Sets whether the bundle allows the banner to display notification.
380      *
381      * @param bundleOption Indicates the NotificationBundleOption object.
382      * @param enabled Indicates the flag that allows badge to be shown.
383      * @return Returns ERR_OK on success, others on failure.
384      */
385     virtual ErrCode SetShowBadgeEnabledForBundle(const sptr<NotificationBundleOption> &bundleOption, bool enabled) = 0;
386 
387     /**
388      * @brief Gets whether the bundle allows the badge to display the status of notifications.
389      *
390      * @param bundleOption Indicates the NotificationBundleOption object.
391      * @param enabled Indicates the flag that allows badge to be shown.
392      * @return Returns ERR_OK on success, others on failure.
393      */
394     virtual ErrCode GetShowBadgeEnabledForBundle(const sptr<NotificationBundleOption> &bundleOption, bool &enabled) = 0;
395 
396     /**
397      * @brief Gets whether allows the badge to display the status of notifications.
398      *
399      * @param enabled Indicates the flag that allows badge to be shown.
400      * @return Returns ERR_OK on success, others on failure.
401      */
402     virtual ErrCode GetShowBadgeEnabled(bool &enabled) = 0;
403 
404     /**
405      * @brief Subscribes notifications.
406      *
407      * @param subscriber Indicates the subscriber.
408      * @param info Indicates the NotificationSubscribeInfo object.
409      * @return Returns ERR_OK on success, others on failure.
410      */
411     virtual ErrCode Subscribe(const sptr<AnsSubscriberInterface> &subscriber,
412         const sptr<NotificationSubscribeInfo> &info) = 0;
413 
414     /**
415      * @brief Unsubscribes notifications.
416      *
417      * @param subscriber Indicates the subscriber.
418      * @param info Indicates the NotificationSubscribeInfo object.
419      * @return Returns ERR_OK on success, others on failure.
420      */
421     virtual ErrCode Unsubscribe(
422         const sptr<AnsSubscriberInterface> &subscriber, const sptr<NotificationSubscribeInfo> &info) = 0;
423 
424     /**
425      * @brief Obtains whether notifications are suspended.
426      *
427      * @param suspended Indicates the suspended status.
428      * @return Returns ERR_OK on success, others on failure.
429      */
430     virtual ErrCode AreNotificationsSuspended(bool &suspended) = 0;
431 
432     /**
433      * @brief Get the notification sorting status of the current app.
434      *
435      * @param sortingMap Indicates the NotificationSortingMap object.
436      * @return Returns ERR_OK on success, others on failure.
437      */
438     virtual ErrCode GetCurrentAppSorting(sptr<NotificationSortingMap> &sortingMap) = 0;
439 
440     /**
441      * @brief Checks whether this device is allowed to publish notifications.
442      *
443      * @param allowed Indicates the flag that allows notification.
444      * @return Returns ERR_OK on success, others on failure.
445      */
446     virtual ErrCode IsAllowedNotify(bool &allowed) = 0;
447 
448     /**
449      * @brief Checks whether this application is allowed to publish notifications.
450      *
451      * @param allowed Indicates the flag that allows notification.
452      * @return Returns ERR_OK on success, others on failure.
453      */
454     virtual ErrCode IsAllowedNotifySelf(bool &allowed) = 0;
455 
456     /**
457      * @brief Checks whether notifications are allowed for a specific bundle.
458      *
459      * @param bundleOption Indicates the NotificationBundleOption object.
460      * @param allowed Indicates the flag that allows notification.
461      * @return Returns ERR_OK on success, others on failure.
462      */
463     virtual ErrCode IsSpecialBundleAllowedNotify(const sptr<NotificationBundleOption> &bundleOption, bool &allowed) = 0;
464 
465     /**
466      * @brief Set do not disturb date.
467      *
468      * @param date Indicates the NotificationDoNotDisturbDate object.
469      * @return Returns ERR_OK on success, others on failure.
470      */
471     virtual ErrCode SetDoNotDisturbDate(const sptr<NotificationDoNotDisturbDate> &date) = 0;
472 
473     /**
474      * @brief Get do not disturb date.
475      *
476      * @param date Indicates the NotificationDoNotDisturbDate object.
477      * @return Returns ERR_OK on success, others on failure.
478      */
479     virtual ErrCode GetDoNotDisturbDate(sptr<NotificationDoNotDisturbDate> &date) = 0;
480 
481     /**
482      * @brief Get whether Do Not Disturb mode is supported.
483      *
484      * @param doesSupport Indicates the flag that supports DND mode.
485      * @return Returns ERR_OK on success, others on failure.
486      */
487     virtual ErrCode DoesSupportDoNotDisturbMode(bool &doesSupport) = 0;
488 
489     /**
490      * @brief Cancel notifications according to group.
491      *
492      * @param groupName Indicates the group name.
493      * @return Returns ERR_OK on success, others on failure.
494      */
495     virtual ErrCode CancelGroup(const std::string &groupName) = 0;
496 
497     /**
498      * @brief Delete notifications according to bundle and group.
499      *
500      * @param bundleOption Indicates the NotificationBundleOption object.
501      * @param groupName Indicates the group name.
502      * @return Returns ERR_OK on success, others on failure.
503      */
504     virtual ErrCode RemoveGroupByBundle(
505         const sptr<NotificationBundleOption> &bundleOption, const std::string &groupName) = 0;
506 
507     /**
508      * @brief Gets whether distributed notification is enabled.
509      *
510      * @param enabled Indicates the enabled flag.
511      * @return Returns ERR_OK on success, others on failure.
512      */
513     virtual ErrCode IsDistributedEnabled(bool &enabled) = 0;
514 
515     /**
516      * @brief Sets distributed notification enabled or disabled.
517      *
518      * @param enabled Indicates the enabled flag.
519      * @return Returns ERR_OK on success, others on failure.
520      */
521     virtual ErrCode EnableDistributed(bool enabled) = 0;
522 
523     /**
524      * @brief Sets distributed notification enabled or disabled for specific bundle.
525      *
526      * @param bundleOption Indicates the NotificationBundleOption object.
527      * @param enabled Indicates the enabled flag.
528      * @return Returns ERR_OK on success, others on failure.
529      */
530     virtual ErrCode EnableDistributedByBundle(const sptr<NotificationBundleOption> &bundleOption, bool enabled) = 0;
531 
532     /**
533      * @brief Sets distributed notification enabled or disabled for current bundle.
534      *
535      * @param enabled Indicates the enabled flag.
536      * @return Returns ERR_OK on success, others on failure.
537      */
538     virtual ErrCode EnableDistributedSelf(bool enabled) = 0;
539 
540     /**
541      * @brief Gets whether distributed notification is enabled for specific bundle.
542      *
543      * @param bundleOption Indicates the NotificationBundleOption object.
544      * @param enabled Indicates the enabled flag.
545      * @return Returns ERR_OK on success, others on failure.
546      */
547     virtual ErrCode IsDistributedEnableByBundle(const sptr<NotificationBundleOption> &bundleOption, bool &enabled) = 0;
548 
549     /**
550      * @brief Get the reminder type of the current device.
551      *
552      * @param remindType Reminder type for the device.
553      * @return Returns ERR_OK on success, others on failure.
554      */
555     virtual ErrCode GetDeviceRemindType(NotificationConstant::RemindType &remindType) = 0;
556 
557     /**
558      * @brief Publishes a continuous notification.
559      *
560      * @param request Notification requests that need to be posted.
561      * @return Returns ERR_OK on success, others on failure.
562      */
563     virtual ErrCode PublishContinuousTaskNotification(const sptr<NotificationRequest> &request) = 0;
564 
565     /**
566      * @brief Cancels a continuous notification.
567      *
568      * @param label Identifies the label of the specified notification.
569      * @param notificationId Identifies the id of the specified notification.
570      * @return Returns ERR_OK on success, others on failure.
571      */
572     virtual ErrCode CancelContinuousTaskNotification(const std::string &label, int32_t notificationId) = 0;
573 
574     /**
575      * @brief Publishes a reminder notification.
576      *
577      * @param reminder Identifies the reminder notification request that needs to be published.
578      * @return Returns ERR_OK on success, others on failure.
579      */
580     virtual ErrCode PublishReminder(sptr<ReminderRequest> &reminder) = 0;
581 
582     /**
583      * @brief Cancel a reminder notifications.
584      *
585      * @param reminderId Identifies the reminders id that needs to be canceled.
586      * @return Returns ERR_OK on success, others on failure.
587      */
588     virtual ErrCode CancelReminder(const int32_t reminderId) = 0;
589 
590     /**
591      * @brief Get all valid reminder notifications.
592      *
593      * @param reminders Identifies the list of all valid notifications.
594      * @return Returns ERR_OK on success, others on failure.
595      */
596     virtual ErrCode GetValidReminders(std::vector<sptr<ReminderRequest>> &reminders) = 0;
597 
598     /**
599      * @brief Cancel all reminder notifications.
600      *
601      * @return Returns ERR_OK on success, others on failure.
602      */
603     virtual ErrCode CancelAllReminders() = 0;
604 
605     /**
606      * @brief Checks whether this device is support template.
607      *
608      * @param templateName Identifies the template name for searching as a condition.
609      * @param support Identifies the support flag.
610      * @return Returns ERR_OK on success, others on failure.
611      */
612     virtual ErrCode IsSupportTemplate(const std::string &templateName, bool &support) = 0;
613 
614     /**
615      * @brief Checks Whether the specified users is allowed to publish notifications.
616      *
617      * @param userId Identifies the user's id.
618      * @param allowed Identifies the allowed flag.
619      * @return Returns ERR_OK on success, others on failure.
620      */
621     virtual ErrCode IsSpecialUserAllowedNotify(const int32_t &userId, bool &allowed) = 0;
622 
623     /**
624      * @brief Sets whether to allow all applications to publish notifications on a specified device. The caller must
625      * have system permissions to call this method.
626      *
627      * @param deviceId Indicates the ID of the device running the application. At present, this parameter can only
628      *                 be null or an empty string, indicating the current device.
629      * @param enabled Specifies whether to allow all applications to publish notifications. The value true
630      *                indicates that notifications are allowed, and the value false indicates that notifications
631      *                are not allowed.
632      * @return Returns ERR_OK on success, others on failure.
633      */
634     virtual ErrCode SetNotificationsEnabledByUser(const int32_t &deviceId, bool enabled) = 0;
635 
636     /**
637      * @brief Delete all notifications by user.
638      *
639      * @param userId Indicates the user id.
640      * @return Returns ERR_OK on success, others on failure.
641      */
642     virtual ErrCode DeleteAllByUser(const int32_t &userId) = 0;
643 
644     /**
645      * @brief Set do not disturb date by user.
646      *
647      * @param userId Indicates the user id.
648      * @param date Indicates NotificationDoNotDisturbDate object.
649      * @return Returns ERR_OK on success, others on failure.
650      */
651     virtual ErrCode SetDoNotDisturbDate(const int32_t &userId, const sptr<NotificationDoNotDisturbDate> &date) = 0;
652 
653     /**
654      * @brief Get the do not disturb date by user.
655      *
656      * @param userId Indicates the user id.
657      * @param date Indicates the NotificationDoNotDisturbDate object.
658      * @return Returns ERR_OK on success, others on failure.
659      */
660     virtual ErrCode GetDoNotDisturbDate(const int32_t &userId, sptr<NotificationDoNotDisturbDate> &date) = 0;
661     virtual ErrCode SetEnabledForBundleSlot(const sptr<NotificationBundleOption> &bundleOption,
662         const NotificationConstant::SlotType &slotType, bool enabled) = 0;
663     virtual ErrCode GetEnabledForBundleSlot(const sptr<NotificationBundleOption> &bundleOption,
664         const NotificationConstant::SlotType &slotType, bool &enabled) = 0;
665 
666     /**
667      * @brief Obtains specific datas via specified dump option.
668      *
669      * @param cmd Indicates the specified dump command.
670      * @param bundle Indicates the specified bundle name.
671      * @param userId Indicates the specified userId.
672      * @param dumpInfo Indicates the container containing datas.
673      * @return Returns check result.
674      */
675     virtual ErrCode ShellDump(const std::string &cmd, const std::string &bundle, int32_t userId,
676         std::vector<std::string> &dumpInfo) = 0;
677 
678     /**
679      * @brief Set whether to sync notifications to devices that do not have the app installed.
680      *
681      * @param userId Indicates the specific user.
682      * @param enabled Allow or disallow sync notifications.
683      * @return Returns set enabled result.
684      */
685     virtual ErrCode SetSyncNotificationEnabledWithoutApp(const int32_t userId, const bool enabled) = 0;
686 
687     /**
688      * @brief Obtains whether to sync notifications to devices that do not have the app installed.
689      *
690      * @param userId Indicates the specific user.
691      * @param enabled Allow or disallow sync notifications.
692      * @return Returns get enabled result.
693      */
694     virtual ErrCode GetSyncNotificationEnabledWithoutApp(const int32_t userId, bool &enabled) = 0;
695 
696 protected:
697     enum TransactId : uint32_t {
698         PUBLISH_NOTIFICATION = FIRST_CALL_TRANSACTION,
699         PUBLISH_NOTIFICATION_TO_DEVICE,
700         CANCEL_NOTIFICATION,
701         CANCEL_ALL_NOTIFICATIONS,
702         CANCEL_AS_BUNDLE,
703         ADD_SLOT_BY_TYPE,
704         ADD_SLOTS,
705         REMOVE_SLOT_BY_TYPE,
706         REMOVE_ALL_SLOTS,
707         ADD_SLOT_GROUPS,
708         GET_SLOT_BY_TYPE,
709         GET_SLOTS,
710         GET_SLOT_GROUP,
711         GET_SLOT_GROUPS,
712         GET_SLOT_NUM_AS_BUNDLE,
713         REMOVE_SLOT_GROUPS,
714         GET_ACTIVE_NOTIFICATIONS,
715         GET_ACTIVE_NOTIFICATION_NUMS,
716         GET_ALL_ACTIVE_NOTIFICATIONS,
717         GET_SPECIAL_ACTIVE_NOTIFICATIONS,
718         SET_NOTIFICATION_AGENT,
719         GET_NOTIFICATION_AGENT,
720         CAN_PUBLISH_AS_BUNDLE,
721         PUBLISH_AS_BUNDLE,
722         SET_NOTIFICATION_BADGE_NUM,
723         GET_BUNDLE_IMPORTANCE,
724         IS_NOTIFICATION_POLICY_ACCESS_GRANTED,
725         SET_PRIVATIVE_NOTIFICATIONS_ALLOWED,
726         GET_PRIVATIVE_NOTIFICATIONS_ALLOWED,
727         REMOVE_NOTIFICATION,
728         REMOVE_ALL_NOTIFICATIONS,
729         DELETE_NOTIFICATION,
730         DELETE_NOTIFICATION_BY_BUNDLE,
731         DELETE_ALL_NOTIFICATIONS,
732         GET_SLOTS_BY_BUNDLE,
733         UPDATE_SLOTS,
734         UPDATE_SLOT_GROUPS,
735         REQUEST_ENABLE_NOTIFICATION,
736         SET_NOTIFICATION_ENABLED_FOR_BUNDLE,
737         SET_NOTIFICATION_ENABLED_FOR_ALL_BUNDLE,
738         SET_NOTIFICATION_ENABLED_FOR_SPECIAL_BUNDLE,
739         SET_SHOW_BADGE_ENABLED_FOR_BUNDLE,
740         GET_SHOW_BADGE_ENABLED_FOR_BUNDLE,
741         GET_SHOW_BADGE_ENABLED,
742         SUBSCRIBE_NOTIFICATION,
743         UNSUBSCRIBE_NOTIFICATION,
744         ARE_NOTIFICATION_SUSPENDED,
745         GET_CURRENT_APP_SORTING,
746         IS_ALLOWED_NOTIFY,
747         IS_ALLOWED_NOTIFY_SELF,
748         IS_SPECIAL_BUNDLE_ALLOWED_NOTIFY,
749         SET_DO_NOT_DISTURB_DATE,
750         GET_DO_NOT_DISTURB_DATE,
751         DOES_SUPPORT_DO_NOT_DISTURB_MODE,
752         CANCEL_GROUP,
753         REMOVE_GROUP_BY_BUNDLE,
754         IS_DISTRIBUTED_ENABLED,
755         ENABLE_DISTRIBUTED,
756         ENABLE_DISTRIBUTED_BY_BUNDLE,
757         ENABLE_DISTRIBUTED_SELF,
758         IS_DISTRIBUTED_ENABLED_BY_BUNDLE,
759         GET_DEVICE_REMIND_TYPE,
760         SHELL_DUMP,
761         PUBLISH_CONTINUOUS_TASK_NOTIFICATION,
762         CANCEL_CONTINUOUS_TASK_NOTIFICATION,
763         PUBLISH_REMINDER,
764         CANCEL_REMINDER,
765         CANCEL_ALL_REMINDERS,
766         GET_ALL_VALID_REMINDERS,
767         IS_SUPPORT_TEMPLATE,
768         IS_SPECIAL_USER_ALLOWED_NOTIFY,
769         SET_NOTIFICATION_ENABLED_BY_USER,
770         DELETE_ALL_NOTIFICATIONS_BY_USER,
771         SET_DO_NOT_DISTURB_DATE_BY_USER,
772         GET_DO_NOT_DISTURB_DATE_BY_USER,
773         SET_ENABLED_FOR_BUNDLE_SLOT,
774         GET_ENABLED_FOR_BUNDLE_SLOT,
775         SET_SYNC_NOTIFICATION_ENABLED_WITHOUT_APP,
776         GET_SYNC_NOTIFICATION_ENABLED_WITHOUT_APP
777     };
778 };
779 }  // namespace Notification
780 }  // namespace OHOS
781 
782 #endif  // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_MANAGER_INTERFACE_H
783