• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_REQUEST_H
17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_REQUEST_H
18 
19 #include "ans_const_define.h"
20 #include "message_user.h"
21 #include "notification_action_button.h"
22 #include "notification_constant.h"
23 #include "notification_content.h"
24 #include "notification_distributed_options.h"
25 #include "notification_flags.h"
26 #include "notification_json_convert.h"
27 #include "notification_template.h"
28 #include "parcel.h"
29 #include "pixel_map.h"
30 #include "want_agent.h"
31 #include "want_params.h"
32 #include "notification_check_request.h"
33 #include "notification_bundle_option.h"
34 #include "notification_unified_group_Info.h"
35 #include <string>
36 #include <map>
37 
38 namespace OHOS {
39 namespace Notification {
40 
41 inline const std::string REQUEST_STORAGE_KEY_PREFIX {"ans_live_view"};
42 inline const std::string REQUEST_STORAGE_SECURE_KEY_PREFIX {"secure_live_view"};
43 
44 struct NotificationKey {
45     int32_t id {};
46     std::string label {};
47 };
48 
49 struct LiveViewFilter {
50     NotificationBundleOption bundle;
51     int32_t userId {-1};
52     NotificationKey notificationKey;
53     std::vector<std::string> extraInfoKeys;
54 };
55 
56 class NotificationRequest : public Parcelable, public NotificationJsonConvertionBase {
57 public:
58     enum class BadgeStyle {
59         /**
60          * displays only numbers.
61          */
62         NONE,
63         /**
64          * displayed as a large icon.
65          */
66         BIG,
67         /**
68          * displayed as a small icon.
69          */
70         LITTLE,
71         /**
72          * invalid type
73          * It is used as the upper limit of the enumerated value.
74          */
75         ILLEGAL_TYPE
76     };
77 
78     enum class GroupAlertType {
79         /**
80          * all notifications in a group have sound or vibration if sound or vibration is enabled
81          * for the associated NotificationSlot objects.
82          */
83         ALL,
84         /**
85          * child notifications have sound or vibration but the overview notification is muted (no sound or vibration)
86          * in a group if sound or vibration is enabled for the associated NotificationSlot objects.
87          */
88         CHILD,
89         /**
90          * the overview notification has sound or vibration but child notifications are muted (no sound or vibration)
91          * in a group if sound or vibration is enabled for the associated NotificationSlot objects.
92          */
93         OVERVIEW,
94         /**
95          * invalid type
96          * It is used as the upper limit of the enumerated value.
97          */
98         ILLEGAL_TYPE
99     };
100 
101     /**
102      * Indicates the classification of notifications for alarms or timers.
103      */
104     static const std::string CLASSIFICATION_ALARM;
105     /**
106      * Indicates the classification of notifications for incoming calls or similar synchronous communication requests.
107      */
108     static const std::string CLASSIFICATION_CALL;
109     /**
110      * Indicates the classification of notifications for emails.
111      */
112     static const std::string CLASSIFICATION_EMAIL;
113     /**
114      * Indicates the classification of notifications for errors occurred during background operations or identity
115      * authentication.
116      */
117     static const std::string CLASSIFICATION_ERROR;
118     /**
119      * Indicates the classification of notifications for calendar events.
120      */
121     static const std::string CLASSIFICATION_EVENT;
122     /**
123      * Indicates the classification of notifications for short messages or instant messages.
124      */
125     static const std::string CLASSIFICATION_MESSAGE;
126     /**
127      * Indicates the classification of notifications for map navigation.
128      */
129     static const std::string CLASSIFICATION_NAVIGATION;
130     /**
131      * Indicates the classification of notifications for processes that are operated in the background for a long time.
132      */
133     static const std::string CLASSIFICATION_PROGRESS;
134     /**
135      * Indicates the classification of notifications for advertisement or promotion information.
136      */
137     static const std::string CLASSIFICATION_PROMO;
138     /**
139      * Indicates the classification of notifications for specific and timely recommendations of a particular
140      * transaction.
141      */
142     static const std::string CLASSIFICATION_RECOMMENDATION;
143     /**
144      * Indicates the classification of notifications for reminders previously set by the user.
145      */
146     static const std::string CLASSIFICATION_REMINDER;
147     /**
148      * Indicates the classification of notifications for ongoing background services.
149      */
150     static const std::string CLASSIFICATION_SERVICE;
151     /**
152      * Indicates the classification of notifications for social network or sharing updates.
153      */
154     static const std::string CLASSIFICATION_SOCIAL;
155     /**
156      * Indicates the classification of notifications for ongoing information about the device and contextual status.
157      */
158     static const std::string CLASSIFICATION_STATUS;
159     /**
160      * Indicates the classification of notifications for system or device status updates.
161      */
162     static const std::string CLASSIFICATION_SYSTEM;
163     /**
164      * Indicates the classification of notifications for media transport control during playback.
165      */
166     static const std::string CLASSIFICATION_TRANSPORT;
167 
168     /**
169      * Indicates the default notification background color, which means that no color is displayed.
170      */
171     static const uint32_t COLOR_DEFAULT;
172 
173 public:
174     NotificationRequest() = default;
175 
176     /**
177      * @brief A constructor used to create a NotificationRequest instance with the input parameter notificationId
178      * passed.
179      *
180      * @param notificationId Indicates notification ID.
181      */
182     explicit NotificationRequest(int32_t notificationId);
183 
184     /**
185      * @brief A constructor used to create a NotificationRequest instance by copying parameters from an existing one.
186      *
187      * @param other Indicates the existing object.
188      */
189     NotificationRequest(const NotificationRequest &other);
190 
191     /**
192      * @brief A constructor used to create a NotificationRequest instance by copying parameters from an existing one.
193      *
194      * @param other Indicates the existing object.
195      */
196     NotificationRequest &operator=(const NotificationRequest &other);
197 
198     virtual ~NotificationRequest();
199 
200     /**
201      * @brief Checks whether this notification is in progress.
202      *
203      * @return Returns true if this notification is in progress; returns false otherwise.
204      */
205     bool IsInProgress() const;
206 
207     /**
208      * @brief Sets whether this notification is in progress.
209      * Users cannot directly dismiss notifications in progress because
210      * they usually contain some ongoing background services such as music playback.
211      *
212      * @param isOngoing Specifies whether this notification is in progress.
213      */
214     void SetInProgress(bool isOngoing);
215 
216     /**
217      * @brief Checks whether this notification is unremovable.
218      *
219      * @return Returns true if this notification is unremovable; returns false otherwise.
220      */
221     bool IsUnremovable() const;
222 
223     /**
224      * @brief Sets whether this notification is unremovable.
225      * If it is set to be unremovable, it cannot be removed by users.
226      *
227      * @param isUnremovable Specifies whether this notification is unremovable.
228      */
229     void SetUnremovable(bool isUnremovable);
230 
231     /**
232      * @brief Sets the number to be displayed for this notification.
233      *
234      * @param number Indicates the number to set.
235      */
236     void SetBadgeNumber(uint32_t number);
237 
238     /**
239      * @brief Obtains the number to be displayed for this notification.
240      *
241      * @return Returns the number to be displayed for this notification.
242      */
243     uint32_t GetBadgeNumber() const;
244 
245     /**
246      * @brief Sets the notification control flags for this notification.
247      *
248      * @param notificationControlFlags Indicates the flags to set.
249      */
250     void SetNotificationControlFlags(uint32_t notificationControlFlags);
251 
252     /**
253      * @brief Obtains the notification control flags for this notification.
254      *
255      * @return Returns the notification control flags for this notification.
256      */
257     uint32_t GetNotificationControlFlags() const;
258 
259     /**
260      * @brief Sets the current notification ID to uniquely identify the notification in the application.
261      * After a notification is received, its ID is obtained by using the getNotificationId() method.
262      *
263      * @param notificationId Indicates the ID of the notification to be set.
264      */
265     void SetNotificationId(int32_t notificationId);
266 
267     /**
268      * @brief Obtains the notification ID, which is unique in the current application.
269      *
270      * @return the notification ID.
271      */
272     int32_t GetNotificationId() const;
273 
274     /**
275      * @brief Adds an WantAgent to this notification.
276      * After a notification is tapped, subsequent operations such as ability and common events will be triggered as
277      * set by WantAgent.
278      *
279      * @param wantAgent Indicates the operation triggered by tapping the notification, which can be set by
280      * WantAgent.
281      */
282     void SetWantAgent(const std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> &wantAgent);
283 
284     /**
285      * @brief Obtains the WantAgent contained in this notification.
286      *
287      * @return Returns the WantAgent contained in this notification.
288      */
289     const std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> GetWantAgent() const;
290 
291     /**
292      * @brief Sets an WantAgent object that is triggered when the user explicitly removes this notification.
293      *
294      * @param wantAgent Indicates the WantAgent object to be triggered.
295      */
296     void SetRemovalWantAgent(const std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> &wantAgent);
297 
298     /**
299      * @brief Obtains the WantAgent object that is triggered when the user explicitly removes this notification.
300      *
301      * @return Returns the WantAgent object to be triggered.
302      */
303     const std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> GetRemovalWantAgent() const;
304 
305     /**
306      * @brief Sets the WantAgent to start when the device is not in use,
307      * instead of showing this notification in the status bar.
308      * When the device is in use, the system UI displays a pop-up notification
309      * instead of starting the WantAgent specified by maxScreenWantAgent.
310      * Your application must have the ohos.permission.USE_WHOLE_SCREEN permission to use this method.
311      *
312      * @param wantAgent Indicates the WantAgent object containing information about the to-be-started ability that
313      * uses the Page template.
314      */
315     void SetMaxScreenWantAgent(const std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> &wantAgent);
316 
317     /**
318      * @brief Obtains the full-screen WantAgent set by calling setMaxScreenWantAgent(WantAgent).
319      *
320      * @return Returns the full-screen WantAgent.
321      */
322     const std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> GetMaxScreenWantAgent() const;
323 
324     /**
325      * @brief Sets extra parameters that are stored as key-value pairs for the notification.
326      *
327      * @param extras Indicates the WantParams object containing the extra parameters in key-value pair format.
328      */
329     void SetAdditionalData(const std::shared_ptr<AAFwk::WantParams> &extras);
330 
331     /**
332      * @brief Obtains the WantParams object set in the notification.
333      *
334      * @return Returns the WantParams object.
335      */
336     const std::shared_ptr<AAFwk::WantParams> GetAdditionalData() const;
337 
338     /**
339      * @brief Sets extendInfo that are stored as key-value pairs for the notification.
340      *
341      * @param extras Indicates the WantParams object containing the extendInfo in key-value pair format.
342      */
343     void SetExtendInfo(const std::shared_ptr<AAFwk::WantParams> &extendInfo);
344 
345     /**
346      * @brief Obtains the WantParams object set in the notification.
347      *
348      * @return Returns the WantParams object.
349      */
350     const std::shared_ptr<AAFwk::WantParams> GetExtendInfo() const;
351 
352     /**
353      * @brief Sets the time to deliver a notification.
354      *
355      * @param deliveryTime Indicates the time in milliseconds.
356      */
357     void SetDeliveryTime(int64_t deliveryTime);
358 
359     /**
360      * @brief Obtains the time when a notification is delivered.
361      *
362      * @return Returns the time in milliseconds.
363      */
364     int64_t GetDeliveryTime() const;
365 
366     /**
367      * @brief Checks whether the notification delivery time is displayed for this notification.
368      *
369      * @return Returns true if the time is displayed; returns false otherwise.
370      */
371     bool IsShowDeliveryTime() const;
372 
373     /**
374      * @brief Sets whether to show the notification delivery time for this notification.
375      * This method is valid only when the notification delivery time has been set by calling setDeliveryTime(int64_t).
376      *
377      * @param showDeliveryTime Specifies whether to show the notification delivery time.
378      */
379     void SetShowDeliveryTime(bool showDeliveryTime);
380 
381     /**
382      * @brief Adds a NotificationActionButton to this notification.
383      * An operation button is usually placed next to the notification content by the system.
384      * Each action button must contain an icon, a title, and an WantAgent. When a notification is expanded,
385      * a maximum of three action buttons can be displayed from left to right in the order they were added.
386      * When the notification is collapsed, no action buttons will be displayed.
387      *
388      * @param actionButton Indicates the NotificationActionButton object to add.
389      */
390     void AddActionButton(const std::shared_ptr<NotificationActionButton> &actionButton);
391 
392     /**
393      * @brief Obtains the list of all NotificationActionButton objects included in this notification.
394      *
395      * @return Returns the list of NotificationActionButton objects.
396      */
397     const std::vector<std::shared_ptr<NotificationActionButton>> GetActionButtons() const;
398 
399     /**
400      * @brief Clear the list of all NotificationActionButton objects included in this notification.
401      */
402     void ClearActionButtons();
403 
404     /**
405      * @brief Checks whether the platform is allowed to generate contextual NotificationActionButton objects for this
406      * notification.
407      *
408      * @return Returns true if the platform is allowed to generate contextual NotificationActionButton objects;
409      * returns false otherwise.
410      */
411     bool IsPermitSystemGeneratedContextualActionButtons() const;
412 
413     /**
414      * @brief Sets whether to allow the platform to generate contextual NotificationActionButton objects for this
415      * notification.
416      *
417      * @param permitted Specifies whether to allow the platform to generate contextual NotificationActionButton objects.
418      * The default value true indicates that the platform is allowed to generate contextual action buttons,
419      * and the value false indicates not.
420      */
421     void SetPermitSystemGeneratedContextualActionButtons(bool permitted);
422 
423     bool IsAgentNotification() const;
424 
425     void SetIsAgentNotification(bool isAgent);
426 
427     /**
428      * @brief Adds a MessageUser object and associates it with this notification.
429      *
430      * @param messageUser Indicates the MessageUser object to add.
431      */
432     void AddMessageUser(const std::shared_ptr<MessageUser> &messageUser);
433 
434     /**
435      * @brief Obtains all MessageUser objects associated with this notification.
436      *
437      * @return Returns the list of MessageUser objects associated with this notification.
438      */
439     const std::vector<std::shared_ptr<MessageUser>> GetMessageUsers() const;
440 
441     /**
442      * @brief Checks whether this notification is set to alert only once,
443      * which means that sound or vibration will no longer be played
444      * for notifications with the same ID upon their updates.
445      *
446      * @return Returns true if this notification is set to alert only once; returns false otherwise.
447      */
448     bool IsAlertOneTime() const;
449 
450     /**
451      * @brief Sets whether to have this notification alert only once.
452      * If a notification alerts only once, sound or vibration will no longer be played
453      * for notifications with the same ID upon their updates after they are published.
454      *
455      * @param isAlertOnce Specifies whether to have this notification alert only once.
456      */
457     void SetAlertOneTime(bool isAlertOnce);
458 
459     /**
460      * @brief Sets the time to delete a notification.
461      *
462      * @param deletedTime Indicates the time in milliseconds.
463      * The default value is 0, indicating that the notification will not be automatically deleted.
464      * To enable the notification to be automatically deleted, set this parameter to an integer greater than 0.
465      */
466     void SetAutoDeletedTime(int64_t deletedTime);
467 
468     /**
469      * @brief Obtains the period during which a notification is deleted.
470      *
471      * @return Returns the period in milliseconds.
472      */
473     int64_t GetAutoDeletedTime() const;
474 
475     /**
476      * @brief Sets the update deadline time before deleting a notification.
477      *
478      * @param updateDeadLine Indicates the time in milliseconds.
479      * The default value is 0, indicating that the notification will not be automatically deleted.
480      * To enable the notification to be automatically deleted, set this parameter to an integer greater than 0.
481      */
482     void SetUpdateDeadLine(int64_t updateDeadLine);
483 
484     /**
485      * @brief Obtains the time point which a notification must be updated.
486      *
487      * @return Returns the time point in milliseconds.
488      */
489     int64_t GetUpdateDeadLine() const;
490 
491     /**
492      * @brief Sets the finish deadline time before deleting a notification.
493      *
494      * @param finishDeadLine Indicates the time in milliseconds.
495      * The default value is 0, indicating that the notification will not be automatically deleted.
496      * To enable the notification to be automatically deleted, set this parameter to an integer greater than 0.
497      */
498     void SetFinishDeadLine(int64_t finishDeadLine);
499 
500     /**
501      * @brief Obtains the time point which a notification must be finished.
502      *
503      * @return Returns the time point in milliseconds.
504      */
505     int64_t GetFinishDeadLine() const;
506 
507     /**
508      * @brief Sets the finish deadline time before deleting a notification.
509      *
510      * @param finishDeadLine Indicates the time in milliseconds.
511      * The default value is 0, indicating that the notification will not be automatically deleted.
512      * To enable the notification to be automatically deleted, set this parameter to an integer greater than 0.
513      */
514     void SetArchiveDeadLine(int64_t archiveDeadLine);
515 
516     /**
517      * @brief Obtains the time point which a notification must be finished.
518      *
519      * @return Returns the time point in milliseconds.
520      */
521     int64_t GetArchiveDeadLine() const;
522 
523     /**
524      * @brief Sets the little icon of the notification.
525      *
526      * @param littleIcon Indicates the icon of the notification.
527      */
528     void SetLittleIcon(const std::shared_ptr<Media::PixelMap> &littleIcon);
529 
530     /**
531      * @brief Obtains the icon of the notification.
532      *
533      * @return Returns the notification icon.
534      */
535     const std::shared_ptr<Media::PixelMap> GetLittleIcon() const;
536 
537     /**
538      * @brief Obtains the icon type of the notification.
539      *
540      * @return Returns the notification icon type
541      */
542     const std::string GetLittleIconType() const;
543 
544     /**
545      * @brief Sets the large icon of this notification, which is usually displayed on the right of the notification.
546      *
547      * @param bigIcon Indicates the large icon to set. It must be a PixelMap object.
548      */
549     void SetBigIcon(const std::shared_ptr<Media::PixelMap> &bigIcon);
550 
551     /**
552      * @brief reset the large icon of this notification, which is usually displayed on the right of the notification.
553      *
554      */
555     void ResetBigIcon() const;
556 
557     /**
558      * @brief Obtains the large icon of this notification.
559      *
560      * @return Returns the large icon of this notification.
561      */
562     const std::shared_ptr<Media::PixelMap> GetBigIcon() const;
563 
564     /**
565      * @brief Sets the overlay icon of this notification.
566      *
567      * @param overlayIcon Indicates the overlay icon of the notification.
568      */
569     void SetOverlayIcon(const std::shared_ptr<Media::PixelMap> &overlayIcon);
570 
571     /**
572      * @brief Obtains the overlay icon of this notification.
573      *
574      * @return Returns the overlay icon of this notification.
575      */
576     const std::shared_ptr<Media::PixelMap> GetOverlayIcon() const;
577 
578     /**
579      * @brief Sets the classification of this notification, which describes the purpose of this notification.
580      * Notification classifications are used to filter and sort notifications.
581      *
582      * @param classification Indicates the notification classification predefined in the system,
583      * such as CLASSIFICATION_CALL or CLASSIFICATION_NAVIGATION etc.
584      */
585     void SetClassification(const std::string &classification);
586 
587     /**
588      * @brief Obtains the classification of this notification.
589      *
590      * @return Returns the classification of this notification.
591      */
592     std::string GetClassification() const;
593 
594     /**
595      * @brief Sets the background color of this notification.
596      * This method is valid only when background color has been enabled by calling setColorEnabled(bool).
597      *
598      * @param color Indicates the background color to set. For details about the value range, see Color.
599      */
600     void SetColor(uint32_t color);
601 
602     /**
603      * @brief Obtains the background color of this notification.
604      * The return value, except for the default color COLOR_DEFAULT,
605      * is the bitwise OR operation result of 0xFF000000 and the ARGB value set by setColor(uint32_t).
606      *
607      * @return Returns the background color of this notification.
608      */
609     uint32_t GetColor() const;
610 
611     /**
612      * @brief Checks whether background color is enabled for this notification.
613      *
614      * @return Returns true if background color is enabled; returns false otherwise.
615      */
616     bool IsColorEnabled() const;
617 
618     /**
619      * @brief Sets whether to enable background color for this notification.
620      * If colorEnabled is set to true, this method takes effect only
621      * when the notification content type has been set to NotificationRequest.
622      * NotificationMediaContent in the NotificationRequest object through
623      * NotificationRequest::setContent(NotificationContent) and an AVToken has been attached to
624      * that NotificationMediaContent object through NotificationMediaContent::setAVToken(AVToken).
625      *
626      * @param colorEnabled Specifies whether to enable background color.
627      */
628     void SetColorEnabled(bool colorEnabled);
629 
630     /**
631      * @brief Sets the notification content type to NotificationNormalContent, NotificationLongTextContent,
632      * or NotificationPictureContent etc.
633      * Each content type indicates a particular notification content.
634      *
635      * @param content Indicates the notification content type.
636      */
637     void SetContent(const std::shared_ptr<NotificationContent> &content);
638 
639     /**
640      * @brief Obtains the notification content set by calling the setContent(NotificationContent) method.
641      *
642      * @return Returns the notification content.
643      */
644     const std::shared_ptr<NotificationContent> GetContent() const;
645 
646     /**
647      * @brief Obtains the notification type.
648      *
649      * @return Returns the type of the current notification, which can be
650      * NotificationContent::Type::BASIC_TEXT,
651      * NotificationContent::Type::LONG_TEXT,
652      * NotificationContent::Type::PICTURE,
653      * NotificationContent::Type::CONVERSATION,
654      * NotificationContent::Type::MULTILINE,
655      * NotificationContent::Type::MEDIA,
656      * or NotificationContent::Type::LIVE_VIEW
657      */
658     NotificationContent::Type GetNotificationType() const;
659 
660     /**
661      * @brief Checks whether the notification creation time is displayed as a countdown timer.
662      *
663      * @return Returns true if the time is displayed as a countdown timer; returns false otherwise.
664      */
665     bool IsCountdownTimer() const;
666 
667     /**
668      * @brief Sets whether to show the notification creation time as a countdown timer.
669      * This method is valid only when setShowStopwatch(boolean) is set to true.
670      *
671      * @param isCountDown Specifies whether to show the notification creation time as a countdown timer.
672      */
673     void SetCountdownTimer(bool isCountDown);
674 
675     /**
676      * @brief Sets the group alert type for this notification,
677      * which determines how the group overview and other notifications in a group are published.
678      * The group information must have been set by calling setGroupValue(string).
679      * Otherwise, this method does not take effect.
680      *
681      * @param type Indicates the group alert type to set. which can be GroupAlertType::ALL (default value),
682      * GroupAlertType::OVERVIEW, or GroupAlertType::CHILD etc.
683      */
684     void SetGroupAlertType(NotificationRequest::GroupAlertType type);
685 
686     /**
687      * @brief Obtains the group alert type of this notification.
688      *
689      * @return Returns the group alert type of this notification.
690      */
691     NotificationRequest::GroupAlertType GetGroupAlertType() const;
692 
693     /**
694      * @brief Checks whether this notification is the group overview.
695      *
696      * @return Returns true if this notification is the group overview; returns false otherwise.
697      */
698     bool IsGroupOverview() const;
699 
700     /**
701      * @brief Sets whether to use this notification as the overview of its group.
702      * This method helps display the notifications that are assigned the same group name by calling
703      * setGroupName(string) as one stack in the notification bar.
704      * Each group requires only one group overview. After a notification is set as the group overview,
705      * it becomes invisible if another notification in the same group is published.
706      *
707      * @param overView Specifies whether to set this notification as the group overview.
708      */
709     void SetGroupOverview(bool overView);
710 
711     /**
712      * @brief Sets the group information for this notification.
713      * If no groups are set for notifications, all notifications from the same application will appear
714      * in the notification bar as one stack with the number of stacked notifications displayed.
715      * If notifications are grouped and there are multiple groups identified by different groupName,
716      * notifications with different groupName will appear in separate stacks.
717      * Note that one of the notifications in a group must be set as the overview of its group by calling
718      * setGroupOverview(bool), and other notifications are considered as child notifications.
719      * Otherwise, notifications will not be displayed as one group even if they are assigned the same groupName by
720      * calling setGroupName(string).
721      *
722      * @param groupName Specifies whether to set this notification as the group overview.
723      */
724     void SetGroupName(const std::string &groupName);
725 
726     /**
727      * @brief Obtains the group information about this notification.
728      *
729      * @return Returns the group information about this notification.
730      */
731     std::string GetGroupName() const;
732 
733     /**
734      * @brief Checks whether this notification is relevant only to the local device and cannot be displayed on remote
735      * devices.
736      *
737      * @return Returns true if this notification is relevant only to the local device; returns false otherwise.
738      */
739     bool IsOnlyLocal() const;
740 
741     /**
742      * @brief Sets whether this notification is relevant only to the local device and cannot be displayed on remote
743      * devices.This method takes effect only for notifications published by calling
744      * NotificationHelper::publishNotification(NotificationRequest) or
745      * NotificationHelper#publishNotification(string, NotificationRequest).
746      * Notifications published using NotificationHelper::publishNotification(NotificationRequest, string)
747      * in a distributed system will not be affected.
748      *
749      * @param flag Specifies whether this notification can be displayed only on the local device.
750      */
751     void SetOnlyLocal(bool flag);
752 
753     /**
754      * @brief Sets the text that will be displayed as a link to the settings of the application.
755      * Calling this method is invalid if the notification content type has been set to NotificationLongTextContent
756      * or NotificationPictureContent in the NotificationRequest object through setContent(NotificationContent).
757      *
758      * @param text Indicates the text to be included. You can set it to any valid link.
759      */
760     void SetSettingsText(const std::string &text);
761 
762     /**
763      * @brief Obtains the text that will be displayed as a link to the settings of the application.
764      *
765      * @return Returns the text displayed as the link to the application settings.
766      */
767     std::string GetSettingsText() const;
768 
769     /**
770      * @brief Deprecated. Obtains the time when a notification is created.
771      *
772      * @return Returns the time in milliseconds.
773      */
774     int64_t GetCreateTime() const;
775 
776     /**
777      * @brief Sets the time to create a notification.
778      *
779      * @param createTime Indicates the time in milliseconds.
780      */
781     void SetCreateTime(int64_t createTime);
782 
783     /**
784      * @brief Checks whether the notification creation time is displayed as a stopwatch.
785      *
786      * @return Returns true if the time is displayed as a stopwatch; returns false otherwise.
787      */
788     bool IsShowStopwatch() const;
789 
790     /**
791      * @brief Sets whether to show the notification creation time as a stopwatch.
792      * This method is valid only when the notification creation time has been set by calling setDeliveryTime(int64_t).
793      * When the notification creation time is set to be shown as a stopwatch, the interval between the current time
794      * and the creation time set by setDeliveryTime(int64_t) is dynamically displayed for this notification
795      * in Minutes: Seconds format. If the interval is longer than 60 minutes, it will be displayed
796      * in Hours: Minutes: Seconds format. If this method and setShowDeliveryTime(boolean) are both set to true, only
797      * this method takes effect, that is, the notification creation time will be shown as a stopwatch.
798      *
799      * @param isShow Specifies whether to show the notification creation time as a stopwatch.
800      */
801     void SetShowStopwatch(bool isShow);
802 
803     /**
804      * @brief Sets the slot type of a notification to bind the created NotificationSlot object.
805      * You can use NotificationSlot to create a slot object,
806      * then set the notification vibration and lock screen display, and use the current method to bind the slot.
807      * The value must be the type of an existing NotificationSlot object.
808      *
809      * @param slotType Indicates the unique type of the NotificationSlot object.
810      */
811     void SetSlotType(NotificationConstant::SlotType slotType);
812 
813     /**
814      * @brief Obtains the slot type of a notification set by calling the setSlotType(string) method.
815      *
816      * @return Returns the notification slot type.
817      */
818     NotificationConstant::SlotType GetSlotType() const;
819 
820     /**
821      * @brief Sets a key used for sorting notifications from the same application bundle.
822      *
823      * @param key Indicates the key to set.
824      */
825     void SetSortingKey(const std::string &key);
826 
827     /**
828      * @brief Obtains the key used for sorting notifications from the same application bundle.
829      *
830      * @return Returns the key for sorting notifications.
831      */
832     std::string GetSortingKey() const;
833 
834     /**
835      * @brief Sets the scrolling text to be displayed in the status bar when this notification is received.
836      *
837      * @param text Indicates the scrolling text to be displayed.
838      */
839     void SetStatusBarText(const std::string &text);
840 
841     /**
842      * @brief Obtains the scrolling text that will be displayed in the status bar when this notification is received.
843      *
844      * @return Returns the scrolling notification text.
845      */
846     std::string GetStatusBarText() const;
847 
848     /**
849      * @brief Checks whether the current notification will be automatically dismissed after being tapped.
850      *
851      * @return Returns true if the notification will be automatically dismissed; returns false otherwise.
852      */
853     bool IsTapDismissed() const;
854 
855     /**
856      * @brief Sets whether to automatically dismiss a notification after being tapped.
857      * If you set tapDismissed to true,
858      * you must call the setWantAgent(WantAgent) method to make the settings take effect.
859      *
860      * @param isDismissed Specifies whether a notification will be automatically dismissed after being tapped.
861      */
862     void SetTapDismissed(bool isDismissed);
863 
864     /**
865      * @brief Sets the notification display effect, including whether to display this notification on the lock screen,
866      * and how it will be presented if displayed.
867      * For details, see NotificationSlot::setLockscreenVisibleness(int).
868      * If the lock screen display effect is set for a NotificationRequest object
869      * and its associated NotificationSlot object, the display effect set in the NotificationRequest object prevails.
870      *
871      * @param type Indicates the notification display effect on the lock screen.
872      */
873     void SetVisibleness(NotificationConstant::VisiblenessType type);
874 
875     /**
876      * @brief Obtains the display effect of this notification on the lock screen.
877      *
878      * @return Returns the display effect of this notification on the lock screen.
879      */
880     NotificationConstant::VisiblenessType GetVisibleness() const;
881 
882     /**
883      * @brief Sets the badge icon style for this notification.
884      * This method does not take effect if the home screen does not support badge icons.
885      *
886      * @param style Indicates the type of the badge icon to be displayed for this notification.
887      * The value must be BadgeStyle::NONE, BadgeStyle::LITTLE, or BadgeStyle::BIG.
888      */
889     void SetBadgeIconStyle(NotificationRequest::BadgeStyle style);
890 
891     /**
892      * @brief Obtains the badge icon style of this notification.
893      *
894      * @return Returns the badge icon style of this notification.
895      */
896     NotificationRequest::BadgeStyle GetBadgeIconStyle() const;
897 
898     /**
899      * @brief Sets the shortcut ID for this notification.
900      * After a shortcut ID is set for a notification, the notification will be associated with the corresponding
901      * home-screen shortcut, and the shortcut will be hidden when the Home application displays the badge or content
902      * of the notification.
903      *
904      * @param shortcutId Indicates the shortcut ID to set.
905      */
906     void SetShortcutId(const std::string &shortcutId);
907 
908     /**
909      * @brief Obtains the shortcut ID associated with this notification.
910      *
911      * @return Returns the shortcut ID of this notification.
912      */
913     std::string GetShortcutId() const;
914 
915     /**
916      * @brief Sets whether this notification is displayed as a floating icon on top of the screen.
917      *
918      * @param floatingIcon Specifies whether a notification is displayed as a floating icon on top of the screen.
919      */
920     void SetFloatingIcon(bool floatingIcon);
921 
922     /**
923      * @brief Checks whether this notification is displayed as a floating icon on top of the screen.
924      *
925      * @return Returns true if this notification is displayed as a floating icon; returns false otherwise.
926      */
927     bool IsFloatingIcon() const;
928 
929     /**
930      * @brief Sets how the progress bar will be displayed for this notification.
931      * A progress bar is usually used in notification scenarios such as download.
932      *
933      * @param progress Indicates the current value displayed for the notification progress bar.
934      * @param progressMax Indicates the maximum value displayed for the notification progress bar.
935      * @param indeterminate Specifies whether the progress bar is indeterminate. The value true indicates that
936      * the progress bar is indeterminate, and users cannot see its current and maximum values.
937      */
938     void SetProgressBar(int32_t progress, int32_t progressMax, bool indeterminate);
939 
940     /**
941      * @brief Obtains the maximum value displayed for the progress bar of this notification.
942      *
943      * @return Returns the maximum value of the notification progress bar.
944      */
945     int32_t GetProgressMax() const;
946 
947     /**
948      * @brief Obtains the current value displayed for the progress bar of this notification.
949      *
950      * @return Returns the current value of the notification progress bar.
951      */
952     int32_t GetProgressValue() const;
953 
954     /**
955      * @brief Checks whether the progress bar of this notification is indeterminate.
956      *
957      * @return Returns true if the notification progress bar is indeterminate; returns false otherwise.
958      */
959     bool IsProgressIndeterminate() const;
960 
961     /**
962      * @brief Sets the most recent NotificationUserInput records that have been sent through this notification.
963      * The most recent input must be stored in index 0,
964      * the second most recent input must be stored in index 1, and so on.
965      * The system displays a maximum of five inputs.
966      *
967      * @param text Indicates the list of inputs to set.
968      */
969     void SetNotificationUserInputHistory(const std::vector<std::string> &text);
970 
971     /**
972      * @brief Obtains the most recent NotificationUserInput records.
973      *
974      * @return Returns the most recent NotificationUserInput records.
975      */
976     std::vector<std::string> GetNotificationUserInputHistory() const;
977 
978     /**
979      * @brief Obtains the unique hash code of a notification in the current application.
980      * To obtain a valid hash code, you must have subscribed to and received the notification.
981      * A valid notification hash code is a string composed of multiple attributes separated by an underscore (_),
982      * including the notification ID, creator bundle name, creator UID, and owner bundle name.
983      *
984      * @return Returns the hash code of the notification.
985      */
986     std::string GetNotificationHashCode() const;
987 
988     /**
989      * @brief Sets the bundle name of the notification owner.
990      * The notification owner refers to the application that subscribes to the notification.
991      *
992      * @param ownerName Indicates the bundle name of the notification owner.
993      */
994     void SetOwnerBundleName(const std::string &ownerName);
995 
996     /**
997      * @brief Obtains the bundle name of the notification owner.
998      * The notification owner refers to the application that subscribes to the notification.
999      *
1000      * @return Returns the bundle name of the notification owner.
1001      */
1002     std::string GetOwnerBundleName() const;
1003 
1004     /**
1005      * @brief Sets the bundle name of the notification creator.
1006      * The notification creator refers to the application that publishes the notification.
1007      *
1008      * @param creatorName Indicates the bundle name of the notification creator.
1009      */
1010     void SetCreatorBundleName(const std::string &creatorName);
1011 
1012     /**
1013      * @brief Obtains the bundle name of the notification creator.
1014      * The notification creator refers to the application that publishes the notification.
1015      *
1016      * @return Returns the bundle name of the notification creator.
1017      */
1018     std::string GetCreatorBundleName() const;
1019 
1020     /**
1021      * @brief Sets the PID of the notification creator.
1022      *
1023      * @param pid Indicates the PID of the notification creator.
1024      */
1025     void SetCreatorPid(pid_t pid);
1026 
1027     /**
1028      * @brief Obtains the PID of the notification creator.
1029      *
1030      * @return Returns the PID of the notification creator.
1031      */
1032     pid_t GetCreatorPid() const;
1033 
1034     /**
1035      * @brief Sets the UID of the notification creator.
1036      *
1037      * @param uid Indicates the UID of the notification creator.
1038      */
1039     void SetCreatorUid(int32_t uid);
1040 
1041     /**
1042      * @brief Obtains the UID of the notification creator.
1043      *
1044      * @return Returns the UID of the notification creator.
1045      */
1046     int32_t GetCreatorUid() const;
1047 
1048     /**
1049      * @brief Sets the UID of the notification owner.
1050      *
1051      * @param uid the UID of the notification owner.
1052      */
1053     void SetOwnerUid(int32_t uid);
1054 
1055     /**
1056      * @brief Obtains the UID of the notification owner.
1057      *
1058      * @return the UID of the notification owner.
1059      */
1060     int32_t GetOwnerUid() const;
1061 
1062     /**
1063      * @brief Sets the label of this notification.
1064      *
1065      * @param label Indicates the label of this notification.
1066      */
1067     void SetLabel(const std::string &label);
1068 
1069     /**
1070      * @brief Obtains the label of this notification.
1071      * The label is set via NotificationHelper::publishNotification(string, NotificationRequest).
1072      * This method returns null if no specific label is set for this notification.
1073      *
1074      * @return Returns the label of this notification.
1075      */
1076     std::string GetLabel() const;
1077 
1078     /**
1079      * @brief Sets whether this notification is distributed.
1080      *
1081      * @param distribute Specifies whether a notification is displayed as a floating icon on top of the screen.
1082      */
1083     void SetDistributed(bool distribute);
1084 
1085     /**
1086      * @brief Sets devices that support display.
1087      *
1088      * @param devices Indicates the devices that support display.
1089      */
1090     void SetDevicesSupportDisplay(const std::vector<std::string> &devices);
1091 
1092     /**
1093      * @brief Sets devices that support operate.
1094      *
1095      * @param devices Indicates the devices that support operate.
1096      */
1097     void SetDevicesSupportOperate(const std::vector<std::string> &devices);
1098 
1099     /**
1100      * @brief Obtains the distributed Options.
1101      *
1102      * @return Returns the distributed Options.
1103      */
1104     NotificationDistributedOptions GetNotificationDistributedOptions() const;
1105 
1106     /**
1107      * @brief Sets the UserId of the notification creator.
1108      *
1109      * @param userId Indicates the UserId of the notification creator.
1110      */
1111     void SetCreatorUserId(int32_t userId);
1112 
1113     /**
1114      * @brief Obtains the UserId of the notification creator.
1115      *
1116      * @return Returns the UserId of the notification creator.
1117      */
1118     int32_t GetCreatorUserId() const;
1119 
1120     /**
1121      * @brief Sets the InstanceKey of the notification creator.
1122      *
1123      * @param key Indicates the InstanceKey of the notification creator.
1124      */
1125     void SetCreatorInstanceKey(int32_t key);
1126 
1127     /**
1128      * @brief Obtains the InstanceKey of the notification creator.
1129      *
1130      * @return Returns the InstanceKey of the notification creator.
1131      */
1132     int32_t GetCreatorInstanceKey() const;
1133 
1134     /**
1135      * @brief Sets the InstanceKey of the notification creator.
1136      *
1137      * @param key Indicates the InstanceKey of the notification creator.
1138      */
1139     void SetAppInstanceKey(const std::string &key);
1140 
1141     /**
1142      * @brief Obtains the InstanceKey of the notification creator.
1143      *
1144      * @return Returns the InstanceKey of the notification creator.
1145      */
1146     std::string GetAppInstanceKey() const;
1147 
1148     /**
1149      * @brief Sets the UserId of the notification owner.
1150      *
1151      * @param userId the UserId of the notification owner.
1152      */
1153     void SetOwnerUserId(int32_t userId);
1154 
1155     /**
1156      * @brief Obtains the UserId of the notification owner.
1157      *
1158      * @return the UserId of the notification owner.
1159      */
1160     int32_t GetOwnerUserId() const;
1161 
1162     /**
1163      * @brief Returns a string representation of the object.
1164      *
1165      * @return Returns a string representation of the object.
1166      */
1167     std::string Dump();
1168 
1169     /**
1170      * @brief Converts a NotificationRequest object into a Json.
1171      *
1172      * @param jsonObject Indicates the Json object.
1173      * @return Returns true if succeed; returns false otherwise.
1174      */
1175     bool ToJson(nlohmann::json &jsonObject) const override;
1176 
1177     /**
1178      * @brief Creates a NotificationRequest object from a Json.
1179      *
1180      * @param jsonObject Indicates the Json object.
1181      * @return Returns the NotificationRequest.
1182      */
1183     static NotificationRequest *FromJson(const nlohmann::json &jsonObject);
1184 
1185     /**
1186      * @brief Marshal a NotificationRequest object into a Parcel.
1187      *
1188      * @param parcel Indicates the object into the parcel.
1189      * @return Returns true if succeed; returns false otherwise.
1190      */
1191     virtual bool Marshalling(Parcel &parcel) const override;
1192 
1193     /**
1194      * @brief Unmarshal object from a Parcel.
1195      *
1196      * @param parcel Indicates the parcel object.
1197      * @return Returns the NotificationRequest.
1198      */
1199     static NotificationRequest *Unmarshalling(Parcel &parcel);
1200 
1201     /**
1202      * @brief Sets the template of this notification.
1203      *
1204      * @param template Indicates the template of this notification.
1205      */
1206     void SetTemplate(const std::shared_ptr<NotificationTemplate> &templ);
1207 
1208     /**
1209      * @brief Obtains the Template of the notification.
1210      *
1211      * @return Returns the Template of the notification.
1212      */
1213     std::shared_ptr<NotificationTemplate> GetTemplate() const;
1214 
1215     /**
1216      * @brief Sets the flags of this notification.
1217      *
1218      * @param flags Indicates the flags of this notification.
1219      */
1220     void SetFlags(const std::shared_ptr<NotificationFlags> &flags);
1221 
1222     /**
1223      * @brief Obtains the flags of the notification.
1224      *
1225      * @return Returns the flags of the notification.
1226      */
1227     std::shared_ptr<NotificationFlags> GetFlags() const;
1228 
1229      /**
1230      * @brief Sets the flags of this notification and device.
1231      *
1232      * @param flags Indicates the flags of this notification and device.
1233      */
1234     void SetDeviceFlags(const std::shared_ptr<std::map<std::string, std::shared_ptr<NotificationFlags>>> &mapFlags);
1235 
1236     /**
1237      * @brief Obtains the flags of the notification and device.
1238      *
1239      * @return Returns the flags of the notification and device.
1240      */
1241     std::shared_ptr<std::map<std::string, std::shared_ptr<NotificationFlags>>> GetDeviceFlags() const;
1242 
1243     /**
1244      * @brief Sets the userId of the notification receiver.
1245      *
1246      * @param userId Indicates the userId of the notification receiver.
1247      */
1248     void SetReceiverUserId(int32_t userId);
1249 
1250     /**
1251      * @brief Obtains the userId of the notification receiver.
1252      *
1253      * @return Returns the userId of the notification receiver.
1254      */
1255     int32_t GetReceiverUserId() const;
1256 
1257     bool IsRemoveAllowed() const;
1258 
1259     void SetRemoveAllowed(bool isRemoveAllowed);
1260 
1261     bool IsForceDistributed() const;
1262 
1263     void SetForceDistributed(bool forceDistributed);
1264 
1265     bool IsNotDistributed() const;
1266 
1267     void SetNotDistributed(bool notDistributed);
1268 
1269     bool IsSystemApp() const;
1270 
1271     void SetIsSystemApp(bool isSystemApp);
1272 
1273     bool IsDoNotDisturbByPassed() const;
1274 
1275     void SetIsDoNotDisturbByPassed(bool isDoNotDisturbByPassed);
1276 
1277     bool IsCommonLiveView() const;
1278 
1279     bool IsSystemLiveView() const;
1280 
1281     /**
1282      * @brief Checks whether the image size exceeds the limit in content.
1283      *
1284      * @param pixelMap Indicates the image smart pointer.
1285      * @param maxSize The max size of image.
1286      * @return Returns the ErrCode.
1287      */
1288     static bool CheckImageOverSizeForPixelMap(const std::shared_ptr<Media::PixelMap> &pixelMap, uint32_t maxSize);
1289 
1290     /**
1291      * @brief Checks whether the picture size exceeds the limit in content.
1292      *
1293      * @param request Indicates the specified request.
1294      * @return Returns the ErrCode.
1295      */
1296     ErrCode CheckNotificationRequest(const sptr<NotificationRequest> &oldRequest) const;
1297 
1298     /**
1299      * @brief Fill missing parameters of the current notification request.
1300      *
1301      * @param oldRequest Indicates the old request.
1302      */
1303     void FillMissingParameters(const sptr<NotificationRequest> &oldRequest);
1304 
1305     /**
1306      * @brief incremental update liveview
1307      *
1308      * @param oldRequest Indicates the old request.
1309      */
1310     void IncrementalUpdateLiveview(const sptr<NotificationRequest> &oldRequest);
1311 
1312     /**
1313      * @brief Get notification request key.
1314      *
1315      * @return Return the unique key of notification request.
1316      */
1317     std::string GetKey();
1318 
1319     /**
1320      * @brief Get notification request key.
1321      *
1322      * @return Return the unique key of notification request.
1323      */
1324     std::string GetSecureKey();
1325 
1326     /**
1327      * @brief Get notification request base key.
1328      *
1329      * @return Return the base key of notification request.
1330      */
1331     std::string GetBaseKey(const std::string &deviceId);
1332 
1333     /**
1334      * @brief Check the image size in content.
1335      *
1336      * @return Return the check result, ERR_OK: check pass, others: not pass.
1337      */
1338     ErrCode CheckImageSizeForContent(bool collaborateFlag = false) const;
1339 
1340     /**
1341      * @brief Set notification isCoverActionButtons value.
1342      *
1343      * @param isCoverActionButtons the value of isCoverActionButtons.
1344      */
1345     void SetIsCoverActionButtons(bool isCoverActionButtons);
1346 
1347     /**
1348      * @brief Get notification isCoverActionButtons value.
1349      *
1350      * @return Return the value of isCoverActionButtons.
1351      */
1352     bool IsCoverActionButtons() const;
1353 
1354     /**
1355      * @brief Sets the bundleOption of this notification.
1356      *
1357      * @param bundleOption Indicates the bundleOption of this notification.
1358      */
1359     void SetBundleOption(const std::shared_ptr<NotificationBundleOption> &bundleOption);
1360 
1361     /**
1362      * @brief Obtains the bundleOption of the notification.
1363      *
1364      * @return Returns the bundleOption of the notification.
1365      */
1366     std::shared_ptr<NotificationBundleOption> GetBundleOption() const;
1367 
1368     /**
1369      * @brief Sets the agentBundle of this notification.
1370      *
1371      * @param bundleOption Indicates the agentBundle of this notification.
1372      */
1373     void SetAgentBundle(const std::shared_ptr<NotificationBundleOption> &agentBundle);
1374 
1375     /**
1376      * @brief Obtains the agentBundle of the notification.
1377      *
1378      * @return Returns the agentBundle of the notification.
1379      */
1380     std::shared_ptr<NotificationBundleOption> GetAgentBundle() const;
1381 
1382     /**
1383      * @brief Set notification appMessageId value.
1384      *
1385      * @param appMessageId the value of appMessageId.
1386      */
1387     void SetAppMessageId(const std::string &appMessageId);
1388 
1389     /**
1390      * @brief Get notification appMessageId value.
1391      *
1392      * @return Return the value of appMessageId.
1393      */
1394     std::string GetAppMessageId() const;
1395 
1396     /**
1397      * @brief Set notification sound value.
1398      *
1399      * @param sound the value of sound.
1400      */
1401     void SetSound(const std::string &sound);
1402 
1403     /**
1404      * @brief Get notification sound value.
1405      *
1406      * @return Return the value of sound.
1407      */
1408     std::string GetSound() const;
1409 
1410     /**
1411      * @brief Generate notification request unique key.
1412      *
1413      * @return Return the unique key of notification request.
1414      */
1415     std::string GenerateUniqueKey();
1416 
1417     /**
1418      * @brief Generate notification request distributed unique key.
1419      *
1420      * @return Return the distributed unique key of notification request.
1421      */
1422     std::string GenerateDistributedUniqueKey();
1423 
1424     /**
1425      * @brief Sets the unifiedGroupInfo of this notification.
1426      *
1427      * @param flags Indicates the unifiedGroupInfo of this notification.
1428      */
1429     void SetUnifiedGroupInfo(const std::shared_ptr<NotificationUnifiedGroupInfo> &unifiedGroupInfo);
1430 
1431     /**
1432      * @brief Obtains the unifiedGroupInfo of the notification.
1433      *
1434      * @return Returns the unifiedGroupInfo of the notification.
1435      */
1436     std::shared_ptr<NotificationUnifiedGroupInfo> GetUnifiedGroupInfo() const;
1437 
1438     /**
1439      * @brief Sets the delay time of this notification.
1440      *
1441      * @param delayTime Indicates the delay time of this notification.
1442      */
1443     void SetPublishDelayTime(uint32_t delayTime);
1444 
1445     /**
1446      * @brief Obtains the delay time of the notification.
1447      *
1448      * @return Returns the delay time of the notification.
1449      */
1450     uint32_t GetPublishDelayTime() const;
1451 
1452     /**
1453      * @brief Set notification isUpdateByOwnerAllowed value.
1454      *
1455      * @param isUpdateByOwnerAllowed Indicates the isUpdateByOwnerAllowed value of this notification.
1456      */
1457     void SetUpdateByOwnerAllowed(bool isUpdateByOwnerAllowed);
1458 
1459     /**
1460      * @brief Obtains the value of isUpdateByOwnerAllowed.
1461      *
1462      * @return Returns the isUpdateByOwnerAllowed value of the notification.
1463      */
1464     bool IsUpdateByOwnerAllowed() const;
1465 
1466     /**
1467      * @brief Set notification updateOnly value.
1468      *
1469      * @param updateOnly Indicates the updateOnly value of this notification.
1470      */
1471     void SetUpdateOnly(bool updateOnly);
1472 
1473     /**
1474      * @brief Obtains the value of updateOnly.
1475      *
1476      * @return Returns the updateOnly value of the notification.
1477      */
1478     bool IsUpdateOnly() const;
1479 
1480     bool GetDistributedCollaborate() const;
1481 
1482     void SetDistributedCollaborate(bool distributedCollaborate);
1483 
1484     const std::string GetDistributedHashCode() const;
1485 
1486     void SetDistributedHashCode(const std::string hashCode);
1487 
1488     bool HasUserInputButton();
1489 
1490     void AdddeviceStatu(const std::string &deviceType, const std::string deviceStatu);
1491 
1492     const std::map<std::string, std::string> GetdeviceStatus() const;
1493 
1494     void SetHashCodeGenerateType(uint32_t type);
1495 
1496     uint32_t GetHashCodeGenerateType() const;
1497 
1498     void SetCollaboratedReminderFlag(uint32_t reminderFlag);
1499 
1500     uint32_t GetCollaboratedReminderFlag() const;
1501 
1502     bool CollaborationToJson(std::string& data) const;
1503 
1504     static NotificationRequest *CollaborationFromJson(const std::string& basicInfo);
1505 
1506     bool IsAtomicServiceNotification();
1507 
1508     void SetDistributedFlagBit(
1509         const NotificationConstant::ReminderFlag &bit,
1510         const bool status,
1511         const std::set<std::string> &unaffectDevice = {});
1512 
1513 private:
1514     /**
1515      * Indicates the color mask, used for calculation with the ARGB value set by setColor(int32_t).
1516      */
1517     static const uint32_t COLOR_MASK;
1518 
1519     /**
1520      * the maximum number of user input history is 5.
1521      */
1522     static const std::size_t MAX_USER_INPUT_HISTORY;
1523 
1524     /**
1525      * the maximum number of action buttons is 3.
1526      */
1527     static const std::size_t MAX_ACTION_BUTTONS;
1528 
1529     /**
1530      * the maximum number of message users is 1000.
1531      */
1532     static const std::size_t MAX_MESSAGE_USERS;
1533 
1534 private:
1535     /**
1536      * @brief Read a NotificationRequest object from a Parcel.
1537      *
1538      * @param parcel Indicates the parcel object.
1539      * @return Returns true if succeed; returns false otherwise.
1540      */
1541     bool ReadFromParcel(Parcel &parcel);
1542 
1543     /**
1544      * @brief Obtains the current system time in milliseconds.
1545      *
1546      * @return Returns the current system time in milliseconds.
1547      */
1548     int64_t GetNowSysTime();
1549 
1550     void CopyBase(const NotificationRequest &other);
1551     void CopyOther(const NotificationRequest &other);
1552 
1553     bool ConvertObjectsToJson(nlohmann::json &jsonObject) const;
1554     ErrCode CheckVersion(const sptr<NotificationRequest> &oldRequest) const;
1555 
1556     static void ConvertJsonToNum(NotificationRequest *target, const nlohmann::json &jsonObject);
1557     static void ConvertJsonToNumExt(NotificationRequest *target, const nlohmann::json &jsonObject);
1558     static void ConvertJsonToString(NotificationRequest *target, const nlohmann::json &jsonObject);
1559     static void ConvertJsonToEnum(NotificationRequest *target, const nlohmann::json &jsonObject);
1560     static void ConvertJsonToBool(NotificationRequest *target, const nlohmann::json &jsonObject);
1561     static void ConvertJsonToBoolExt(NotificationRequest *target, const nlohmann::json &jsonObject);
1562     static void ConvertJsonToPixelMap(NotificationRequest *target, const nlohmann::json &jsonObject);
1563     static bool ConvertJsonToNotificationContent(NotificationRequest *target, const nlohmann::json &jsonObject);
1564     static bool ConvertJsonToNotificationActionButton(NotificationRequest *target, const nlohmann::json &jsonObject);
1565     static bool ConvertJsonToNotificationDistributedOptions(
1566         NotificationRequest *target, const nlohmann::json &jsonObject);
1567     static bool ConvertJsonToNotificationFlags(NotificationRequest *target, const nlohmann::json &jsonObject);
1568     static ErrCode CheckImageSizeForConverSation(std::shared_ptr<NotificationBasicContent> &content);
1569     static ErrCode CheckImageSizeForPicture(std::shared_ptr<NotificationBasicContent> &content);
1570     static ErrCode CheckImageSizeForLiveView(std::shared_ptr<NotificationBasicContent> &content,
1571         bool collaborateFlag = false);
1572     static bool ConvertJsonToNotificationBundleOption(NotificationRequest *target, const nlohmann::json &jsonObject);
1573     static bool ConvertJsonToAgentBundle(NotificationRequest *target, const nlohmann::json &jsonObject);
1574     static ErrCode CheckLockScreenPictureSizeForLiveView(std::shared_ptr<NotificationBasicContent> &content);
1575     void SetFlagBit(
1576         const NotificationConstant::ReminderFlag &bit,
1577         const bool status,
1578         std::shared_ptr<NotificationFlags> &flag);
1579 
1580 private:
1581     int32_t notificationId_ {0};
1582     uint32_t color_ {NotificationRequest::COLOR_DEFAULT};
1583     uint32_t badgeNumber_ {0};
1584     uint32_t notificationControlFlags_ {0};
1585     int32_t progressValue_ {0};
1586     int32_t progressMax_ {0};
1587     int64_t createTime_ {0};
1588     int64_t deliveryTime_ {0};
1589 
1590     int64_t autoDeletedTime_ {NotificationConstant::INVALID_AUTO_DELETE_TIME};
1591     int64_t updateDeadLine_ {0};
1592     int64_t finishDeadLine_ {0};
1593     int64_t archiveDeadLine_ {0};
1594     pid_t creatorPid_ {0};
1595     int32_t creatorUid_ {DEFAULT_UID};
1596     int32_t ownerUid_ {DEFAULT_UID};
1597     int32_t creatorUserId_ {SUBSCRIBE_USER_INIT};
1598     int32_t ownerUserId_ {SUBSCRIBE_USER_INIT};
1599     int32_t receiverUserId_ {SUBSCRIBE_USER_INIT};
1600     int32_t creatorInstanceKey_ {DEFAULT_UID};
1601     uint32_t hashCodeGenerateType_ {0};
1602     uint32_t collaboratedReminderFlag_ {0};
1603 
1604     std::string appInstanceKey_ {};
1605     std::string settingsText_ {};
1606     std::string creatorBundleName_ {};
1607     std::string ownerBundleName_ {};
1608     std::string groupName_ {};
1609     std::string statusBarText_ {};
1610     std::string label_ {};
1611     std::string shortcutId_ {};
1612     std::string sortingKey_ {};
1613     std::string classification_ {};
1614     std::string appMessageId_ {};
1615     std::string sound_ {};
1616     std::string distributedHashCode_ {};
1617     std::map<std::string, std::string> deviceStatus_ {};
1618 
1619     NotificationConstant::SlotType slotType_ {NotificationConstant::SlotType::OTHER};
1620     NotificationRequest::GroupAlertType groupAlertType_ {NotificationRequest::GroupAlertType::ALL};
1621     NotificationConstant::VisiblenessType visiblenessType_ {NotificationConstant::VisiblenessType::NO_OVERRIDE};
1622     NotificationRequest::BadgeStyle badgeStyle_ {NotificationRequest::BadgeStyle::NONE};
1623     NotificationContent::Type notificationContentType_ {NotificationContent::Type::NONE};
1624 
1625     bool showDeliveryTime_ {false};
1626     bool tapDismissed_ {true};
1627     bool colorEnabled_ {false};
1628     bool alertOneTime_ {false};
1629     bool showStopwatch_ {false};
1630     bool isCountdown_ {false};
1631     bool inProgress_ {false};
1632     bool groupOverview_ {false};
1633     bool progressIndeterminate_ {false};
1634     bool unremovable_ {false};
1635     bool floatingIcon_ {false};
1636     bool onlyLocal_ {false};
1637     bool permitted_ {true};
1638     bool isAgent_ {false};
1639     bool isRemoveAllowed_ {true};
1640     bool isCoverActionButtons_ {false};
1641     bool isUpdateByOwnerAllowed_ {false};
1642     bool distributedCollaborate_ {false};
1643     bool updateOnly_ {false};
1644     bool forceDistributed_ {false};
1645     bool notDistributed_ {false};
1646     bool isSystemApp_ {false};
1647     bool isDoNotDisturbByPassed_ {false};
1648 
1649     std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> wantAgent_ {};
1650     std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> removalWantAgent_ {};
1651     std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> maxScreenWantAgent_ {};
1652     std::shared_ptr<AAFwk::WantParams> additionalParams_ {};
1653     std::shared_ptr<AAFwk::WantParams> extendInfo_ {};
1654     std::shared_ptr<Media::PixelMap> littleIcon_ {};
1655     std::string littleIconType_ {};
1656     mutable std::shared_ptr<Media::PixelMap> bigIcon_ {};
1657     std::shared_ptr<Media::PixelMap> overlayIcon_ {};
1658     std::shared_ptr<NotificationContent> notificationContent_ {};
1659 
1660     std::vector<std::shared_ptr<NotificationActionButton>> actionButtons_ {};
1661     std::vector<std::shared_ptr<MessageUser>> messageUsers_ {};
1662     std::vector<std::string> userInputHistory_ {};
1663 
1664     NotificationDistributedOptions distributedOptions_;
1665 
1666     std::shared_ptr<NotificationTemplate> notificationTemplate_ {};
1667     std::shared_ptr<NotificationFlags> notificationFlags_ {};
1668     std::shared_ptr<NotificationBundleOption> notificationBundleOption_ {};
1669     std::shared_ptr<NotificationBundleOption> agentBundle_ {};
1670     std::shared_ptr<NotificationUnifiedGroupInfo> unifiedGroupInfo_ {};
1671     std::shared_ptr<std::map<std::string, std::shared_ptr<NotificationFlags>>> notificationFlagsOfDevices_ {};
1672 
1673     uint32_t publishDelayTime_ {0};
1674 };
1675 }  // namespace Notification
1676 }  // namespace OHOS
1677 
1678 #endif  // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_REQUEST_H
1679