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