• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 Cancels a published notification matching the specified label and notificationId.
56      *
57      * @param notificationId Indicates the ID of the notification to cancel.
58      * @param label Indicates the label of the notification to cancel.
59      * @return Returns cancel notification result.
60      */
61     virtual ErrCode Cancel(int notificationId, const std::string &label) = 0;
62 
63     /**
64      * @brief Cancels all the published notifications.
65      *
66      * @return Returns ERR_OK on success, others on failure.
67      */
68     virtual ErrCode CancelAll() = 0;
69 
70     /**
71      * @brief Cancels a published agent notification.
72      *
73      * @param notificationId Indicates the unique notification ID in the application.
74      *                       The value must be the ID of a published notification.
75      *                       Otherwise, this method does not take effect.
76      * @param representativeBundle Indicates the name of application bundle your application is representing.
77      * @param userId Indicates the specific user.
78      * @return Returns cancel notification result.
79      */
80     virtual ErrCode CancelAsBundle(
81         int32_t notificationId, const std::string &representativeBundle, int32_t userId) = 0;
82 
83     /**
84      * @brief Adds a notification slot by type.
85      *
86      * @param slotType Indicates the notification slot type to be added.
87      * @return Returns ERR_OK on success, others on failure.
88      */
89     virtual ErrCode AddSlotByType(NotificationConstant::SlotType slotType) = 0;
90 
91     /**
92      * @brief Creates multiple notification slots.
93      *
94      * @param slots Indicates the notification slots to create.
95      * @return Returns ERR_OK on success, others on failure.
96      */
97     virtual ErrCode AddSlots(const std::vector<sptr<NotificationSlot>> &slots) = 0;
98 
99     /**
100      * @brief Deletes a created notification slot based on the slot ID.
101      *
102      * @param slotType Indicates the type of the slot, which is created by AddNotificationSlot
103      *                 This parameter must be specified.
104      * @return Returns ERR_OK on success, others on failure.
105      */
106     virtual ErrCode RemoveSlotByType(const NotificationConstant::SlotType &slotType) = 0;
107 
108     /**
109      * @brief Deletes all notification slots.
110      *
111      * @return Returns ERR_OK on success, others on failure.
112      */
113     virtual ErrCode RemoveAllSlots() = 0;
114 
115     /**
116      * @brief Queries a created notification slot.
117      *
118      * @param slotType Indicates the ID of the slot, which is created by AddNotificationSlot(NotificationSlot). This
119      *        parameter must be specified.
120      * @param slot Indicates the created NotificationSlot.
121      * @return Returns ERR_OK on success, others on failure.
122      */
123     virtual ErrCode GetSlotByType(const NotificationConstant::SlotType &slotType, sptr<NotificationSlot> &slot) = 0;
124 
125     /**
126      * @brief Obtains all notification slots of this application.
127      *
128      * @param slots Indicates the created NotificationSlot.
129      * @return Returns ERR_OK on success, others on failure.
130      */
131     virtual ErrCode GetSlots(std::vector<sptr<NotificationSlot>> &slots) = 0;
132 
133     /**
134      * @brief Obtains the number of slot.
135      *
136      * @param bundleOption Indicates the bundle name and uid of the application.
137      * @param num Indicates the number of slot.
138      * @return Returns ERR_OK on success, others on failure.
139      */
140     virtual ErrCode GetSlotNumAsBundle(const sptr<NotificationBundleOption> &bundleOption, uint64_t &num) = 0;
141 
142     /**
143      * @brief Obtains active notifications of the current application in the system.
144      *
145      * @param notifications Indicates active NotificationRequest objects of the current application.
146      * @return Returns ERR_OK on success, others on failure.
147      */
148     virtual ErrCode GetActiveNotifications(std::vector<sptr<NotificationRequest>> &notifications) = 0;
149 
150     /**
151      * @brief Obtains the number of active notifications of the current application in the system.
152      *
153      * @param num Indicates the number of active notifications of the current application.
154      * @return Returns ERR_OK on success, others on failure.
155      */
156     virtual ErrCode GetActiveNotificationNums(uint64_t &num) = 0;
157 
158     /**
159      * @brief Obtains all active notifications in the current system. The caller must have system permissions to
160      * call this method.
161      *
162      * @param notifications Indicates all active notifications of this application.
163      * @return Returns ERR_OK on success, others on failure.
164      */
165     virtual ErrCode GetAllActiveNotifications(std::vector<sptr<Notification>> &notifications) = 0;
166 
167     /**
168      * @brief Obtains the active notifications corresponding to the specified key in the system. To call this method
169      * to obtain particular active notifications, you must have received the notifications and obtained the key
170      * via {Notification::GetKey()}.
171      *
172      * @param key Indicates the key array for querying corresponding active notifications.
173      *            If this parameter is null, this method returns all active notifications in the system.
174      * @param notification Indicates the set of active notifications corresponding to the specified key.
175      * @return Returns ERR_OK on success, others on failure.
176      */
177     virtual ErrCode GetSpecialActiveNotifications(
178         const std::vector<std::string> &key, std::vector<sptr<Notification>> &notifications) = 0;
179 
180     /**
181      * @brief Allows another application to act as an agent to publish notifications in the name of your application
182      * bundle.
183      *
184      * @param agent Indicates the name of the application bundle that can publish notifications for your application.
185      * @return Returns ERR_OK on success, others on failure.
186      */
187     virtual ErrCode SetNotificationAgent(const std::string &agent) = 0;
188 
189     /**
190      * @brief Obtains the name of the application bundle that can publish notifications in the name of your application.
191      *
192      * @param agent Indicates the name of the application bundle that can publish notifications for your application if
193      * any; returns null otherwise.
194      * @return Returns ERR_OK on success, others on failure.
195      */
196     virtual ErrCode GetNotificationAgent(std::string &agent) = 0;
197 
198     /**
199      * @brief Checks whether your application has permission to publish notifications by calling
200      * PublishNotificationAsBundle(string, NotificationRequest) in the name of another application indicated by the
201      * given representativeBundle.
202      *
203      * @param representativeBundle Indicates the name of application bundle your application is representing.
204      * @param canPublish Indicates whether your application has permission to publish notifications.
205      * @return Returns ERR_OK on success, others on failure.
206      */
207     virtual ErrCode CanPublishAsBundle(const std::string &representativeBundle, bool &canPublish) = 0;
208 
209     /**
210      * @brief Publishes a notification in the name of a specified application bundle.
211      * @note If the notification to be published has the same ID as a published notification that has not been canceled,
212      * the existing notification will be replaced by the new one.
213      *
214      * @param notification Indicates the NotificationRequest object for setting the notification content.
215      *                This parameter must be specified.
216      * @param representativeBundle Indicates the name of the application bundle that allows your application to publish
217      *                             notifications for it by calling setNotificationAgent.
218      * @return Returns ERR_OK on success, others on failure.
219      */
220     virtual ErrCode PublishAsBundle(
221         const sptr<NotificationRequest> notification, const std::string &representativeBundle) = 0;
222 
223     /**
224      * @brief Sets the number of active notifications of the current application as the number to be displayed on the
225      * notification badge.
226      *
227      * @param num Indicates the badge number.
228      * @return Returns ERR_OK on success, others on failure.
229      */
230     virtual ErrCode SetNotificationBadgeNum(int num) = 0;
231 
232     /**
233      * @brief Obtains the importance level of this application.
234      *
235      * @param importance Indicates the importance level of this application, which can be LEVEL_NONE,
236                LEVEL_MIN, LEVEL_LOW, LEVEL_DEFAULT, LEVEL_HIGH, or LEVEL_UNDEFINED.
237      * @return Returns ERR_OK on success, others on failure.
238      */
239     virtual ErrCode GetBundleImportance(int &importance) = 0;
240 
241     /**
242      * @brief Checks whether this application has permission to modify the Do Not Disturb (DND) notification policy.
243      *
244      * @param granted True if the application has permission; false for otherwise.
245      * @return Returns ERR_OK on success, others on failure.
246      */
247     virtual ErrCode HasNotificationPolicyAccessPermission(bool &granted) = 0;
248 
249     /**
250      * @brief Delete notification based on key.
251      *
252      * @param key Indicates the key to delete notification.
253      * @param removeReason Indicates the reason of remove notification.
254      * @return Returns ERR_OK on success, others on failure.
255      */
256     virtual ErrCode Delete(const std::string &key, int32_t removeReason) = 0;
257 
258     /**
259      * @brief Delete notification.
260      *
261      * @param bundleOption Indicates the NotificationBundleOption of the notification.
262      * @param notificationId Indicates the id of the notification.
263      * @param label Indicates the label of the notification.
264      * @param removeReason Indicates the reason of remove notification.
265      * @return Returns ERR_OK on success, others on failure.
266      */
267     virtual ErrCode RemoveNotification(const sptr<NotificationBundleOption> &bundleOption, int notificationId,
268         const std::string &label, int32_t removeReason) = 0;
269 
270     /**
271      * @brief Delete all notifications.
272      *
273      * @param bundleOption Indicates the NotificationBundleOption of notifications.
274      * @return Returns ERR_OK on success, others on failure.
275      */
276     virtual ErrCode RemoveAllNotifications(const sptr<NotificationBundleOption> &bundleOption) = 0;
277 
278     virtual ErrCode RemoveNotifications(const std::vector<std::string> &hashcodes, int32_t removeReason) = 0;
279 
280     /**
281      * @brief Remove notifications based on bundle.
282      *
283      * @param bundleOption Indicates the NotificationBundleOption of notifications.
284      * @return Returns ERR_OK on success, others on failure.
285      */
286     virtual ErrCode DeleteByBundle(const sptr<NotificationBundleOption> &bundleOption) = 0;
287 
288     /**
289      * @brief Remove all notifications.
290      *
291      * @return Returns ERR_OK on success, others on failure.
292      */
293     virtual ErrCode DeleteAll() = 0;
294 
295     /**
296      * @brief Get all the slots corresponding to the bundle.
297      *
298      * @param bundleOption Indicates the NotificationBundleOption object.
299      * @param slots Indicates the notification slots.
300      * @return Returns ERR_OK on success, others on failure.
301      */
302     virtual ErrCode GetSlotsByBundle(
303         const sptr<NotificationBundleOption> &bundleOption, std::vector<sptr<NotificationSlot>> &slots) = 0;
304 
305     /**
306      * @brief Update slots according to bundle.
307      *
308      * @param bundleOption Indicates the NotificationBundleOption object.
309      * @param slots Indicates the notification slots to be updated.
310      * @return Returns ERR_OK on success, others on failure.
311      */
312     virtual ErrCode UpdateSlots(
313         const sptr<NotificationBundleOption> &bundleOption, const std::vector<sptr<NotificationSlot>> &slots) = 0;
314 
315     /**
316      * @brief Allow notifications to be sent based on the deviceId.
317      *
318      * @param deviceId Indicates the device Id.
319      * @return Returns ERR_OK on success, others on failure.
320      */
321     virtual ErrCode RequestEnableNotification(const std::string &deviceId, const sptr<IRemoteObject> &callerToken) = 0;
322 
323     /**
324      * @brief Set whether to allow the specified deviceId to send notifications for current bundle.
325      *
326      * @param deviceId Indicates the device Id.
327      * @param enabled Indicates the flag that allows notification to be pulished.
328      * @return Returns ERR_OK on success, others on failure.
329      */
330     virtual ErrCode SetNotificationsEnabledForBundle(const std::string &deviceId, bool enabled) = 0;
331 
332     /**
333      * @brief Set whether to allow the specified deviceId to send notifications for all bundles.
334      *
335      * @param deviceId Indicates the device Id.
336      * @param enabled Indicates the flag that allows notification to be pulished.
337      * @return Returns ERR_OK on success, others on failure.
338      */
339     virtual ErrCode SetNotificationsEnabledForAllBundles(const std::string &deviceId, bool enabled) = 0;
340 
341     /**
342      * @brief Set whether to allow the specified bundle to send notifications.
343      *
344      * @param bundleOption Indicates the NotificationBundleOption object.
345      * @param enabled Indicates the flag that allows notification to be pulished.
346      * @return Returns ERR_OK on success, others on failure.
347      */
348     virtual ErrCode SetNotificationsEnabledForSpecialBundle(
349         const std::string &deviceId, const sptr<NotificationBundleOption> &bundleOption, bool enabled) = 0;
350 
351     /**
352      * @brief Sets whether the bundle allows the banner to display notification.
353      *
354      * @param bundleOption Indicates the NotificationBundleOption object.
355      * @param enabled Indicates the flag that allows badge to be shown.
356      * @return Returns ERR_OK on success, others on failure.
357      */
358     virtual ErrCode SetShowBadgeEnabledForBundle(const sptr<NotificationBundleOption> &bundleOption, bool enabled) = 0;
359 
360     /**
361      * @brief Gets whether the bundle allows the badge to display the status of notifications.
362      *
363      * @param bundleOption Indicates the NotificationBundleOption object.
364      * @param enabled Indicates the flag that allows badge to be shown.
365      * @return Returns ERR_OK on success, others on failure.
366      */
367     virtual ErrCode GetShowBadgeEnabledForBundle(const sptr<NotificationBundleOption> &bundleOption, bool &enabled) = 0;
368 
369     /**
370      * @brief Gets whether allows the badge to display the status of notifications.
371      *
372      * @param enabled Indicates the flag that allows badge to be shown.
373      * @return Returns ERR_OK on success, others on failure.
374      */
375     virtual ErrCode GetShowBadgeEnabled(bool &enabled) = 0;
376 
377     /**
378      * @brief Subscribes notifications.
379      *
380      * @param subscriber Indicates the subscriber.
381      * @param info Indicates the NotificationSubscribeInfo object.
382      * @return Returns ERR_OK on success, others on failure.
383      */
384     virtual ErrCode Subscribe(const sptr<AnsSubscriberInterface> &subscriber,
385         const sptr<NotificationSubscribeInfo> &info) = 0;
386 
387     /**
388      * @brief Unsubscribes notifications.
389      *
390      * @param subscriber Indicates the subscriber.
391      * @param info Indicates the NotificationSubscribeInfo object.
392      * @return Returns ERR_OK on success, others on failure.
393      */
394     virtual ErrCode Unsubscribe(
395         const sptr<AnsSubscriberInterface> &subscriber, const sptr<NotificationSubscribeInfo> &info) = 0;
396 
397     /**
398      * @brief Checks whether this device is allowed to publish notifications.
399      *
400      * @param allowed Indicates the flag that allows notification.
401      * @return Returns ERR_OK on success, others on failure.
402      */
403     virtual ErrCode IsAllowedNotify(bool &allowed) = 0;
404 
405     /**
406      * @brief Checks whether this application is allowed to publish notifications.
407      *
408      * @param allowed Indicates the flag that allows notification.
409      * @return Returns ERR_OK on success, others on failure.
410      */
411     virtual ErrCode IsAllowedNotifySelf(bool &allowed) = 0;
412 
413     /**
414      * @brief Checks whether notifications are allowed for a specific bundle.
415      *
416      * @param bundleOption Indicates the NotificationBundleOption object.
417      * @param allowed Indicates the flag that allows notification.
418      * @return Returns ERR_OK on success, others on failure.
419      */
420     virtual ErrCode IsSpecialBundleAllowedNotify(const sptr<NotificationBundleOption> &bundleOption, bool &allowed) = 0;
421 
422     /**
423      * @brief Set do not disturb date.
424      *
425      * @param date Indicates the NotificationDoNotDisturbDate object.
426      * @return Returns ERR_OK on success, others on failure.
427      */
428     virtual ErrCode SetDoNotDisturbDate(const sptr<NotificationDoNotDisturbDate> &date) = 0;
429 
430     /**
431      * @brief Get do not disturb date.
432      *
433      * @param date Indicates the NotificationDoNotDisturbDate object.
434      * @return Returns ERR_OK on success, others on failure.
435      */
436     virtual ErrCode GetDoNotDisturbDate(sptr<NotificationDoNotDisturbDate> &date) = 0;
437 
438     /**
439      * @brief Get whether Do Not Disturb mode is supported.
440      *
441      * @param doesSupport Indicates the flag that supports DND mode.
442      * @return Returns ERR_OK on success, others on failure.
443      */
444     virtual ErrCode DoesSupportDoNotDisturbMode(bool &doesSupport) = 0;
445 
446     /**
447      * @brief Cancel notifications according to group.
448      *
449      * @param groupName Indicates the group name.
450      * @return Returns ERR_OK on success, others on failure.
451      */
452     virtual ErrCode CancelGroup(const std::string &groupName) = 0;
453 
454     /**
455      * @brief Delete notifications according to bundle and group.
456      *
457      * @param bundleOption Indicates the NotificationBundleOption object.
458      * @param groupName Indicates the group name.
459      * @return Returns ERR_OK on success, others on failure.
460      */
461     virtual ErrCode RemoveGroupByBundle(
462         const sptr<NotificationBundleOption> &bundleOption, const std::string &groupName) = 0;
463 
464     /**
465      * @brief Gets whether distributed notification is enabled.
466      *
467      * @param enabled Indicates the enabled flag.
468      * @return Returns ERR_OK on success, others on failure.
469      */
470     virtual ErrCode IsDistributedEnabled(bool &enabled) = 0;
471 
472     /**
473      * @brief Sets distributed notification enabled or disabled.
474      *
475      * @param enabled Indicates the enabled flag.
476      * @return Returns ERR_OK on success, others on failure.
477      */
478     virtual ErrCode EnableDistributed(bool enabled) = 0;
479 
480     /**
481      * @brief Sets distributed notification enabled or disabled for specific bundle.
482      *
483      * @param bundleOption Indicates the NotificationBundleOption object.
484      * @param enabled Indicates the enabled flag.
485      * @return Returns ERR_OK on success, others on failure.
486      */
487     virtual ErrCode EnableDistributedByBundle(const sptr<NotificationBundleOption> &bundleOption, bool enabled) = 0;
488 
489     /**
490      * @brief Sets distributed notification enabled or disabled for current bundle.
491      *
492      * @param enabled Indicates the enabled flag.
493      * @return Returns ERR_OK on success, others on failure.
494      */
495     virtual ErrCode EnableDistributedSelf(bool enabled) = 0;
496 
497     /**
498      * @brief Gets whether distributed notification is enabled for specific bundle.
499      *
500      * @param bundleOption Indicates the NotificationBundleOption object.
501      * @param enabled Indicates the enabled flag.
502      * @return Returns ERR_OK on success, others on failure.
503      */
504     virtual ErrCode IsDistributedEnableByBundle(const sptr<NotificationBundleOption> &bundleOption, bool &enabled) = 0;
505 
506     /**
507      * @brief Get the reminder type of the current device.
508      *
509      * @param remindType Reminder type for the device.
510      * @return Returns ERR_OK on success, others on failure.
511      */
512     virtual ErrCode GetDeviceRemindType(NotificationConstant::RemindType &remindType) = 0;
513 
514     /**
515      * @brief Publishes a continuous notification.
516      *
517      * @param request Notification requests that need to be posted.
518      * @return Returns ERR_OK on success, others on failure.
519      */
520     virtual ErrCode PublishContinuousTaskNotification(const sptr<NotificationRequest> &request) = 0;
521 
522     /**
523      * @brief Cancels a continuous notification.
524      *
525      * @param label Identifies the label of the specified notification.
526      * @param notificationId Identifies the id of the specified notification.
527      * @return Returns ERR_OK on success, others on failure.
528      */
529     virtual ErrCode CancelContinuousTaskNotification(const std::string &label, int32_t notificationId) = 0;
530 
531     /**
532      * @brief Publishes a reminder notification.
533      *
534      * @param reminder Identifies the reminder notification request that needs to be published.
535      * @return Returns ERR_OK on success, others on failure.
536      */
537     virtual ErrCode PublishReminder(sptr<ReminderRequest> &reminder) = 0;
538 
539     /**
540      * @brief Cancel a reminder notifications.
541      *
542      * @param reminderId Identifies the reminders id that needs to be canceled.
543      * @return Returns ERR_OK on success, others on failure.
544      */
545     virtual ErrCode CancelReminder(const int32_t reminderId) = 0;
546 
547     /**
548      * @brief Get all valid reminder notifications.
549      *
550      * @param reminders Identifies the list of all valid notifications.
551      * @return Returns ERR_OK on success, others on failure.
552      */
553     virtual ErrCode GetValidReminders(std::vector<sptr<ReminderRequest>> &reminders) = 0;
554 
555     /**
556      * @brief Cancel all reminder notifications.
557      *
558      * @return Returns ERR_OK on success, others on failure.
559      */
560     virtual ErrCode CancelAllReminders() = 0;
561 
562     /**
563      * @brief Checks whether this device is support template.
564      *
565      * @param templateName Identifies the template name for searching as a condition.
566      * @param support Identifies the support flag.
567      * @return Returns ERR_OK on success, others on failure.
568      */
569     virtual ErrCode IsSupportTemplate(const std::string &templateName, bool &support) = 0;
570 
571     /**
572      * @brief Checks Whether the specified users is allowed to publish notifications.
573      *
574      * @param userId Identifies the user's id.
575      * @param allowed Identifies the allowed flag.
576      * @return Returns ERR_OK on success, others on failure.
577      */
578     virtual ErrCode IsSpecialUserAllowedNotify(const int32_t &userId, bool &allowed) = 0;
579 
580     /**
581      * @brief Sets whether to allow all applications to publish notifications on a specified device. The caller must
582      * have system permissions to call this method.
583      *
584      * @param deviceId Indicates the ID of the device running the application. At present, this parameter can only
585      *                 be null or an empty string, indicating the current device.
586      * @param enabled Specifies whether to allow all applications to publish notifications. The value true
587      *                indicates that notifications are allowed, and the value false indicates that notifications
588      *                are not allowed.
589      * @return Returns ERR_OK on success, others on failure.
590      */
591     virtual ErrCode SetNotificationsEnabledByUser(const int32_t &deviceId, bool enabled) = 0;
592 
593     /**
594      * @brief Delete all notifications by user.
595      *
596      * @param userId Indicates the user id.
597      * @return Returns ERR_OK on success, others on failure.
598      */
599     virtual ErrCode DeleteAllByUser(const int32_t &userId) = 0;
600 
601     /**
602      * @brief Set do not disturb date by user.
603      *
604      * @param userId Indicates the user id.
605      * @param date Indicates NotificationDoNotDisturbDate object.
606      * @return Returns ERR_OK on success, others on failure.
607      */
608     virtual ErrCode SetDoNotDisturbDate(const int32_t &userId, const sptr<NotificationDoNotDisturbDate> &date) = 0;
609 
610     /**
611      * @brief Get the do not disturb date by user.
612      *
613      * @param userId Indicates the user id.
614      * @param date Indicates the NotificationDoNotDisturbDate object.
615      * @return Returns ERR_OK on success, others on failure.
616      */
617     virtual ErrCode GetDoNotDisturbDate(const int32_t &userId, sptr<NotificationDoNotDisturbDate> &date) = 0;
618     virtual ErrCode SetEnabledForBundleSlot(const sptr<NotificationBundleOption> &bundleOption,
619         const NotificationConstant::SlotType &slotType, bool enabled) = 0;
620     virtual ErrCode GetEnabledForBundleSlot(const sptr<NotificationBundleOption> &bundleOption,
621         const NotificationConstant::SlotType &slotType, bool &enabled) = 0;
622 
623     /**
624      * @brief Obtains specific datas via specified dump option.
625      *
626      * @param cmd Indicates the specified dump command.
627      * @param bundle Indicates the specified bundle name.
628      * @param userId Indicates the specified userId.
629      * @param dumpInfo Indicates the container containing datas.
630      * @return Returns check result.
631      */
632     virtual ErrCode ShellDump(const std::string &cmd, const std::string &bundle, int32_t userId,
633         std::vector<std::string> &dumpInfo) = 0;
634 
635     /**
636      * @brief Set whether to sync notifications to devices that do not have the app installed.
637      *
638      * @param userId Indicates the specific user.
639      * @param enabled Allow or disallow sync notifications.
640      * @return Returns set enabled result.
641      */
642     virtual ErrCode SetSyncNotificationEnabledWithoutApp(const int32_t userId, const bool enabled) = 0;
643 
644     /**
645      * @brief Obtains whether to sync notifications to devices that do not have the app installed.
646      *
647      * @param userId Indicates the specific user.
648      * @param enabled Allow or disallow sync notifications.
649      * @return Returns get enabled result.
650      */
651     virtual ErrCode GetSyncNotificationEnabledWithoutApp(const int32_t userId, bool &enabled) = 0;
652 
653     /**
654      * @brief Set badge number.
655      *
656      * @param badgeNumber The badge number.
657      * @return Returns set badge number result.
658      */
659     virtual ErrCode SetBadgeNumber(int32_t badgeNumber) = 0;
660 
661     /**
662      * @brief Register Push Callback.
663      *
664      * @param pushCallback PushCallBack.
665      * @return Returns register PushCallback result.
666      */
667     virtual ErrCode RegisterPushCallback(const sptr<IRemoteObject> &pushCallback) = 0;
668 
669     /**
670      * @brief Unregister Push Callback.
671      *
672      * @return Returns unregister push Callback result.
673      */
674     virtual ErrCode UnregisterPushCallback() = 0;
675 };
676 }  // namespace Notification
677 }  // namespace OHOS
678 
679 #endif  // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_MANAGER_INTERFACE_H
680