• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_REMINDER_REQUEST_H
17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_REMINDER_REQUEST_H
18 
19 #include <map>
20 #include <string>
21 
22 #include "abs_shared_result_set.h"
23 #include "notification_bundle_option.h"
24 #include "notification_constant.h"
25 #include "notification_request.h"
26 #include "values_bucket.h"
27 
28 namespace OHOS {
29 namespace Notification {
30 class ReminderRequest : public Parcelable {
31 public:
32     /**
33      * @brief Supported reminder type.
34      */
35     enum class ReminderType : uint8_t {
36         /**
37          * Indicates the classification of reminder for timer.
38          */
39         TIMER,
40 
41         /**
42          * Indicates the classification of reminder for calendar.
43          */
44         CALENDAR,
45 
46         /**
47          * Indicates the classification of reminder for alarm.
48          */
49         ALARM,
50         INVALID
51     };
52 
53     /**
54      * @brief Supported action button type.
55      */
56     enum class ActionButtonType : uint8_t {
57         /**
58          * @brief Indicates that this action button is used to close reminder's notification.
59          * It always works well, whether the application is running at the time.
60          *
61          */
62         CLOSE,
63 
64         /**
65          * @brief Indicates that this action button is used to snooze reminder.
66          * It always work well, whether the application is running at the time.
67          *
68          */
69         SNOOZE,
70 
71         /**
72          * @brief Indicates that this action button is custom.
73          *
74          */
75         CUSTOM,
76         INVALID
77     };
78 
79     /**
80      * @brief Supported notification update type.
81      */
82     enum class UpdateNotificationType : uint8_t {
83         COMMON,
84         REMOVAL_WANT_AGENT,
85         WANT_AGENT,
86         MAX_SCREEN_WANT_AGENT,
87         BUNDLE_INFO,
88         CONTENT
89     };
90 
91     /**
92      * @brief Enumerates the Time type for converting between c time and acture time.
93      */
94     enum class TimeTransferType : uint8_t {
95         YEAR,
96         MONTH,
97         WEEK
98     };
99 
100     /**
101      * @brief Enumerates the Time format for print.
102      */
103     enum class TimeFormat : uint8_t {
104         YMDHMS,
105         HM
106     };
107 
108     struct ButtonWantAgent {
109         std::string pkgName = "";
110         std::string abilityName = "";
111     };
112 
113     /**
114      * @brief Attributes of action button.
115      */
116     struct ActionButtonInfo {
117         /**
118          * Type of the button.
119          */
120         ActionButtonType type;
121 
122         /**
123          * Content show on the button.
124          */
125         std::string title = "";
126 
127         /**
128          * The ability that is redirected to when the button is clicked.
129          */
130         std::shared_ptr<ButtonWantAgent> wantAgent;
131     };
132 
133     /**
134      * @brief Want agent information. Indicates the package and the ability to switch to.
135      */
136     struct WantAgentInfo {
137         std::string pkgName = "";
138         std::string abilityName = "";
139     };
140 
141     struct MaxScreenAgentInfo {
142         std::string pkgName = "";
143         std::string abilityName = "";
144     };
145 
146     /**
147      * @brief Copy construct from an exist reminder.
148      *
149      * @param Indicates the exist reminder.
150      */
151     explicit ReminderRequest(const ReminderRequest &other);
152 
153     /**
154      * @brief This constructor should only be used in background proxy service process
155      * when reminder instance recovery from database.
156      *
157      * @param reminderId Indicates reminder id.
158      */
159     explicit ReminderRequest(int32_t reminderId);
160     ReminderRequest& operator = (const ReminderRequest &other);
~ReminderRequest()161     virtual ~ReminderRequest() override {};
162 
163     /**
164      * @brief Marshal a NotificationRequest object into a Parcel.
165      *
166      * @param parcel the object into the parcel
167      */
168     virtual bool Marshalling(Parcel &parcel) const override;
169 
170     /**
171      * @brief Unmarshal object from a Parcel.
172      *
173      * @return the NotificationRequest
174      */
175     static ReminderRequest *Unmarshalling(Parcel &parcel);
176     virtual bool ReadFromParcel(Parcel &parcel);
177 
178     /**
179      * @brief If the reminder is showing on the notification panel, it should not be removed automatically.
180      *
181      * @return true if it can be removed automatically.
182      */
183     bool CanRemove() const;
184 
185     bool CanShow() const;
186 
187     /**
188      * @brief Obtains all the information of the reminder.
189      *
190      * @return Information of the reminder.
191      */
192     std::string Dump() const;
193 
194     /**
195      * @brief Obtains the configured action buttons.
196      *
197      * @return map of action buttons.
198      */
199     std::map<ActionButtonType, ActionButtonInfo> GetActionButtons() const;
200 
201     /**
202      * @brief Obtains the configured content.
203      *
204      * @return content text.
205      */
206     std::string GetContent() const;
207 
208     /**
209      * @brief Obtains the configured expired content.
210      *
211      * @return expired content text.
212      */
213     std::string GetExpiredContent() const;
214 
215     std::shared_ptr<MaxScreenAgentInfo> GetMaxScreenWantAgentInfo() const;
216 
217     /**
218      * @brief Obtains notification id.
219      *
220      * @return notification id.
221      */
222     int32_t GetNotificationId() const;
223 
224     /**
225      * @brief Obtains notification request.
226      *
227      * @return notification request instance.
228      */
229     sptr<NotificationRequest> GetNotificationRequest() const;
230 
231     /**
232      * @brief Obtains reminder id.
233      *
234      * @return reminder id.
235      */
236     int32_t GetReminderId() const;
237 
238     uint64_t GetReminderTimeInMilli() const;
239 
240     /**
241      * @brief Obtains reminder type.
242      *
243      * @return reminder type.
244      */
245     ReminderType GetReminderType() const;
246 
247     /**
248      * @brief Obtains the ringing or vibration duration configured for this reminder.
249      *
250      * @return uint16_t The ringing or vibration duration in seconds.
251      */
252     uint16_t GetRingDuration() const;
253 
254     /**
255      * @brief Obtains slot type.
256      *
257      * @return slot type.
258      */
259     NotificationConstant::SlotType GetSlotType() const;
260 
261     std::string GetSnoozeContent() const;
262     uint8_t GetSnoozeTimes() const;
263     uint8_t GetSnoozeTimesDynamic() const;
264     uint8_t GetState() const;
265 
266     /**
267      * @brief Obtains the Time Interval in seconds.
268      *
269      * @return uint64_t Time Interval in seconds.
270      */
271     uint64_t GetTimeInterval() const;
272 
273     /**
274      * @brief Obtains title.
275      *
276      * @return title.
277      */
278     std::string GetTitle() const;
279 
280     /**
281      * @brief Obtains trigger time in milli.
282      *
283      * @return trigger time.
284      */
285     uint64_t GetTriggerTimeInMilli() const;
286 
287     int32_t GetUserId() const;
288     int32_t GetUid() const;
289 
290     /**
291      * @brief Set the app system.
292      *
293      */
294     void SetSystemApp(bool isSystem);
295 
296     /**
297      * @brief Check the app is system or not.
298      *
299      * @return true is the app is system.
300      */
301     bool IsSystemApp() const;
302 
303     /**
304      * @brief Obtains want agent information.
305      *
306      * @return want agent information.
307      */
308     std::shared_ptr<WantAgentInfo> GetWantAgentInfo() const;
309 
310     /**
311      * @brief Inits reminder id when publish reminder success.
312      * Assign a unique reminder id for each reminder.
313      */
314     void InitReminderId();
315 
316     /**
317      * @brief Inits reminder userId when publish reminder success.
318      *
319      * When package remove, user id is sended by wantAgent, but we cannot get the uid according user id as the
320      * package has been removed, and the bundleOption can not be create with correct uid. so we need to record
321      * the user id, and use it to judge which user the reminder belong to.
322      *
323      * @param userId Indicates the userId which the reminder belong to.
324      */
325     void InitUserId(const int32_t &userId);
326 
327     /**
328      * @brief Inites reminder uid when publish reminder success.
329      *
330      * When system reboot and recovery from database, we cannot get the uid according user id as BMS has not be
331      * ready. So we need to record the uid in order to create correct bundleOption.
332      *
333      * @param uid Indicates the uid which the reminder belong to.
334      */
335     void InitUid(const int32_t &uid);
336 
337     /**
338      * @brief Check the reminder is alerting or not.
339      *
340      * @return true if the reminder is playing sound or vibrating.
341      */
342     bool IsAlerting() const;
343 
344     /**
345      * @brief Check the reminder is expired or not.
346      *
347      * @return true is the reminder is expired.
348      */
349     bool IsExpired() const;
350 
351     /**
352      * @brief Check the reminder is showing on the panel.
353      *
354      * @return true if the reminder is showing on the panel.
355      */
356     bool IsShowing() const;
357 
358     /**
359      * @brief Closes the reminder by manual.
360      *
361      * 1) Resets the state of "Alering/Showing/Snooze"
362      * 2) Resets snoozeTimesDynamic_ if update to next trigger time, otherwise set reminder to expired.
363      *
364      * @param updateNext Whether to update to next reminder.
365      */
366     void OnClose(bool updateNext);
367 
368     /**
369      * @brief When date/time change, reminder need to refresh next trigger time.
370      *
371      * @return true if need to show reminder immediately.
372      */
373     virtual bool OnDateTimeChange();
374 
375     /**
376      * When shown notification is covered by a new notification with the same id, we should remove
377      * the state of showing, so that the reminder can be removed automatically when it is expired.
378      */
379     void OnSameNotificationIdCovered();
380 
381     /**
382      * @brief Shows the reminder on panel. TriggerTime will be updated to next.
383      *
384      * @param isPlaySoundOrVibration true means it is play sound or vibration.
385      * @param isSysTimeChanged true means it is called when the system time is changed by user, otherwise false.
386      * @param allowToNotify true means that the notification will be shown as normal, otherwise false.
387      */
388     void OnShow(bool isPlaySoundOrVibration, bool isSysTimeChanged, bool allowToNotify);
389 
390     /**
391      * @brief Reset the state of "Showing" when the reminder is shown failed.
392      */
393     void OnShowFail();
394 
395     /**
396      * @brief Snooze the reminder by manual.
397      *
398      * 1) Updates the trigger time to the next one.
399      * 2) Updates the notification content for "Snooze".
400      * 3) Switches the state from "Showing[, Alerting]" to "Snooze".
401      */
402     bool OnSnooze();
403 
404     /**
405      * @brief Starts the reminder
406      *
407      * Sets the state from "Inactive" to "Active".
408      */
409     void OnStart();
410 
411     /**
412      * @brief Stops the reminder.
413      *
414      * Sets the state from "Active" to "Inactive".
415      */
416     void OnStop();
417 
418     /**
419      * @brief Terminate the alerting reminder, which is executed when the ring duration is over.
420      *
421      * 1) Disables the state of "Alerting".
422      * 2) Updates the notification content for "Alert".
423      *
424      * @return false if alerting state has already been set false before calling the method.
425      */
426     bool OnTerminate();
427 
428     /**
429      * @brief When timezone change, reminder need to refresh next trigger time.
430      *
431      * @return true if need to show reminder immediately.
432      */
433     virtual bool OnTimeZoneChange();
434 
435     /**
436      * @brief Recovery reminder instance from database record.
437      *
438      * @param resultSet Indicates the resultSet with pointer to the row of record data.
439      */
440     virtual void RecoverFromDb(const std::shared_ptr<NativeRdb::ResultSet> &resultSet);
441     void RecoverActionButton(const std::shared_ptr<NativeRdb::ResultSet> &resultSet);
442     void RecoverWantAgent(const std::string &wantAgentInfo, const uint8_t &type);
443 
444     /**
445      * @brief Sets action button.
446      *
447      * @param title Indicates the title of the button.
448      * @param type Indicates the type of the button.
449      * @return Current reminder self.
450      */
451     ReminderRequest& SetActionButton(const std::string &title, const ActionButtonType &type,
452         const std::shared_ptr<ButtonWantAgent> &buttonWantAgent = nullptr);
453 
454     /**
455      * @brief Sets reminder content.
456      *
457      * @param content Indicates content text.
458      * @return Current reminder self.
459      */
460     ReminderRequest& SetContent(const std::string &content);
461 
462     /**
463      * @brief Sets reminder is expired or not.
464      *
465      * @param isExpired Indicates the reminder is expired or not.
466      */
467     void SetExpired(bool isExpired);
468 
469     /**
470      * @brief Sets expired content.
471      *
472      * @param expiredContent Indicates expired content.
473      * @return Current reminder self.
474      */
475     ReminderRequest& SetExpiredContent(const std::string &expiredContent);
476 
477     ReminderRequest& SetMaxScreenWantAgentInfo(const std::shared_ptr<MaxScreenAgentInfo> &maxScreenWantAgentInfo);
478 
479     /**
480      * @brief Sets notification id.
481      *
482      * @param notificationId Indicates notification id.
483      * @return Current reminder self.
484      */
485     ReminderRequest& SetNotificationId(int32_t notificationId);
486 
487     /**
488      * @brief Sets reminder id.
489      *
490      * @param reminderId Indicates reminder id.
491      */
492     void SetReminderId(int32_t reminderId);
493 
494     void SetReminderTimeInMilli(const uint64_t reminderTimeInMilli);
495 
496     /**
497      * @brief Sets the ringing or vibration duration for this reminder, in seconds.
498      *
499      * @param ringDurationInSeconds Indicates the duration. The default is 1 second.
500      * @return Current reminder self.
501      */
502     ReminderRequest& SetRingDuration(const uint64_t ringDurationInSeconds);
503 
504     /**
505      * @brief Sets slot type.
506      *
507      * @param slotType Indicates slot type.
508      * @return Current reminder self.
509      */
510     ReminderRequest& SetSlotType(const NotificationConstant::SlotType &slotType);
511 
512     ReminderRequest& SetSnoozeContent(const std::string &snoozeContent);
513 
514     /**
515      * @brief Set the number of snooze times for this reminder.
516      *
517      * @note If the value of snoozeTimes is less than or equals to 0, this reminder is a one-shot
518      * reminder and will not be snoozed.
519      *
520      * It the value of snoozeTimes is greater than 0, for example, snoozeTimes=3, this reminder
521      * will be snoozed three times after the first alarm, that is, this reminder will be triggered
522      * for four times.
523      *
524      * This method does not take affect on the reminders for countdown timers.
525      *
526      * @param snoozeTimes Indicates the number of times that the reminder will be snoozed.
527      * @return ReminderRequest& Current reminder self.
528      */
529     ReminderRequest& SetSnoozeTimes(const uint8_t snoozeTimes);
530 
531     ReminderRequest& SetSnoozeTimesDynamic(const uint8_t snooziTimes);
532 
533     /**
534      * @brief Sets the Time Interval for this reminder, in seconds. The default value is 0.
535      *
536      * @note The minimum snooze interval is 5 minute. If the snooze interval is set to a value greater
537      * than 0 and less than 5 minutes, the system converts it to 5 minutes by default.
538      *
539      * This method does not take effect on the reminders for countdown timers.
540      *
541      * @param timeIntervalInSeconds Indicates the snooze interval to set. If the value is less or equals to 0,
542      * the reminder will not be snoozed.
543      * @return ReminderRequest& Current reminder self.
544      */
545     ReminderRequest& SetTimeInterval(const uint64_t timeIntervalInSeconds);
546 
547     /**
548      * @brief Sets title.
549      *
550      * @param title Indicates title.
551      * @return Current reminder self.
552      */
553     ReminderRequest& SetTitle(const std::string &title);
554 
555     /**
556      * @brief Sets trigger time.
557      *
558      * @param triggerTimeInMilli Indicates trigger time in milli.
559      */
560     void SetTriggerTimeInMilli(uint64_t triggerTimeInMilli);
561 
562     /**
563      * @brief Sets want agent information.
564      *
565      * @param wantAgentInfo Indicates want agent information.
566      * @return Current reminder self.
567      */
568     ReminderRequest& SetWantAgentInfo(const std::shared_ptr<WantAgentInfo> &wantAgentInfo);
569 
570     bool ShouldShowImmediately() const;
571 
572     /**
573      * @brief Updates {@link triggerTimeInMilli_} to next.
574      * @note If next trigger time not exist, {@link isExpired_} flag will be set with true.
575      *
576      * @return true if next trigger time exist and set success.
577      */
578     virtual bool UpdateNextReminder();
579     virtual bool SetNextTriggerTime();
580 
581     /**
582      * @brief Sets tapDismissed.
583      *
584      * @param tapDismissed Indicates tapDismissed.
585      */
586     void SetTapDismissed(bool tapDismissed);
587 
588     /**
589      * @brief Gets tapDismissed.
590      *
591      * @return True if tapDismissed.
592      */
593     bool IsTapDismissed() const;
594 
595     /**
596      * @brief Sets autoDeletedTime.
597      *
598      * @param autoDeletedTime Indicates autoDeletedTime.
599      */
600     void SetAutoDeletedTime(int64_t autoDeletedTime);
601 
602     /**
603      * @brief Gets autoDeletedTime.
604      *
605      * @return AutoDeletedTime.
606      */
607     int64_t GetAutoDeletedTime() const;
608 
609     /**
610      * @brief Sets custom button uri.
611      *
612      * @param uri Indicates uri.
613      */
614     void SetCustomButtonUri(const std::string &uri);
615 
616     /**
617      * @brief Gets custom button uri.
618      *
619      * @return custom button uri.
620      */
621     std::string GetCustomButtonUri() const;
622 
623     /**
624      * @brief Update notification attributes.
625      *
626      * Some attributes need to be updated after the reminder published or before the notification publish.
627      * For example, action button should not init until the reminder is published successfully, as the reminder id is
628      * assigned after that.
629      *
630      * @param type Indicates the update type.
631      * @param extra Indicates the extra content.
632      */
633     void UpdateNotificationRequest(UpdateNotificationType type, std::string extra);
634 
635     static int32_t GetActualTime(const TimeTransferType &type, int32_t cTime);
636     static int32_t GetCTime(const TimeTransferType &type, int32_t actualTime);
637     static uint64_t GetDurationSinceEpochInMilli(const time_t target);
638     static int32_t GetUid(const int32_t &userId, const std::string &bundleName);
639     static int32_t GetUserId(const int32_t &uid);
640     static void AppendValuesBucket(const sptr<ReminderRequest> &reminder,
641         const sptr<NotificationBundleOption> &bundleOption, NativeRdb::ValuesBucket &values);
642 
643     static int32_t GLOBAL_ID;
644     static const uint64_t INVALID_LONG_LONG_VALUE;
645     static const uint16_t INVALID_U16_VALUE;
646     static const uint8_t INVALID_U8_VALUE;
647     static const uint16_t MILLI_SECONDS;
648     static const uint16_t SAME_TIME_DISTINGUISH_MILLISECONDS;
649     static const std::string NOTIFICATION_LABEL;
650     static const int32_t SUNDAY;
651 
652     /**
653      * @brief Show the reminder with a notification.
654      */
655     static const std::string REMINDER_EVENT_ALARM_ALERT;
656 
657     /**
658      * @brief Close the reminder when click the close button of notification.
659      */
660     static const std::string REMINDER_EVENT_CLOSE_ALERT;
661 
662     /**
663      * @brief Snooze the reminder when click the snooze button of notification.
664      */
665     static const std::string REMINDER_EVENT_SNOOZE_ALERT;
666 
667     static const std::string REMINDER_EVENT_CUSTOM_ALERT;
668 
669     /**
670      * @brief Used to control ring duration.
671      */
672     static const std::string REMINDER_EVENT_ALERT_TIMEOUT;
673 
674     /**
675      * @brief Update the reminder when remove notification from the systemUI.
676      */
677     static const std::string REMINDER_EVENT_REMOVE_NOTIFICATION;
678     static const std::string PARAM_REMINDER_ID;
679     static const uint8_t REMINDER_STATUS_INACTIVE;
680     static const uint8_t REMINDER_STATUS_ACTIVE;
681     static const uint8_t REMINDER_STATUS_ALERTING;
682     static const uint8_t REMINDER_STATUS_SHOWING;
683     static const uint8_t REMINDER_STATUS_SNOOZE;
684     static const uint8_t TIME_HOUR_OFFSET;
685 
686     // For database recovery.
687     static void InitDbColumns();
688     static const std::string REMINDER_ID;
689     static const std::string PKG_NAME;
690     static const std::string USER_ID;
691     static const std::string UID;
692     static const std::string SYS_APP;
693     static const std::string APP_LABEL;
694     static const std::string REMINDER_TYPE;
695     static const std::string REMINDER_TIME;
696     static const std::string TRIGGER_TIME;
697     static const std::string RTC_TRIGGER_TIME;
698     static const std::string TIME_INTERVAL;
699     static const std::string SNOOZE_TIMES;
700     static const std::string DYNAMIC_SNOOZE_TIMES;
701     static const std::string RING_DURATION;
702     static const std::string IS_EXPIRED;
703     static const std::string IS_ACTIVE;
704     static const std::string STATE;
705     static const std::string ZONE_ID;
706     static const std::string HAS_SCHEDULED_TIMEOUT;
707     static const std::string ACTION_BUTTON_INFO;
708     static const std::string CUSTOM_BUTTON_URI;
709     static const std::string SLOT_ID;
710     static const std::string NOTIFICATION_ID;
711     static const std::string TITLE;
712     static const std::string CONTENT;
713     static const std::string SNOOZE_CONTENT;
714     static const std::string EXPIRED_CONTENT;
715     static const std::string AGENT;
716     static const std::string MAX_SCREEN_AGENT;
717     static const std::string TAP_DISMISSED;
718     static const std::string AUTO_DELETED_TIME;
719     static std::string sqlOfAddColumns;
720     static std::vector<std::string> columns;
721 
722 protected:
723     enum class DbRecoveryType : uint8_t {
724         INT,
725         LONG
726     };
727     ReminderRequest();
728     explicit ReminderRequest(ReminderType reminderType);
729     std::string GetDateTimeInfo(const time_t &timeInSecond) const;
PreGetNextTriggerTimeIgnoreSnooze(bool ignoreRepeat,bool forceToGetNext)730     virtual uint64_t PreGetNextTriggerTimeIgnoreSnooze(bool ignoreRepeat, bool forceToGetNext) const
731     {
732         return INVALID_LONG_LONG_VALUE;
733     }
734     int64_t RecoverInt64FromDb(const std::shared_ptr<NativeRdb::ResultSet> &resultSet,
735         const std::string &columnName, const DbRecoveryType &columnType);
736 
737     /**
738      * @brief For database recovery.
739      *
740      * Add column to create table of database.
741      *
742      * @param name Indicates the column name.
743      * @param type Indicates the type of the column.
744      * @param isEnd Indicates whether it is the last column.
745      */
746     static void AddColumn(const std::string &name, const std::string &type, const bool &isEnd);
747 
748 private:
749     void AddActionButtons(const bool includeSnooze);
750     void AddRemovalWantAgent();
751     std::shared_ptr<AbilityRuntime::WantAgent::WantAgent> CreateWantAgent(AppExecFwk::ElementName &element) const;
752     std::string GetButtonInfo() const;
753     uint64_t GetNowInstantMilli() const;
754     std::string GetShowTime(const uint64_t showTime) const;
755     std::string GetTimeInfoInner(const time_t &timeInSecond, const TimeFormat &format, bool keep24Hour) const;
756     std::string GetState(const uint8_t state) const;
757     bool HandleSysTimeChange(uint64_t oriTriggerTime, uint64_t optTriggerTime);
758     bool HandleTimeZoneChange(uint64_t oldZoneTriggerTime, uint64_t newZoneTriggerTime, uint64_t optTriggerTime);
759     bool InitNotificationRequest();
760     void InitServerObj();
761     void SetMaxScreenWantAgent(AppExecFwk::ElementName &element);
762     void SetState(bool deSet, const uint8_t newState, std::string function);
763     void SetWantAgent(AppExecFwk::ElementName &element);
764     std::vector<std::string> StringSplit(std::string source, const std::string &split) const;
765     void UpdateActionButtons(const bool &setSnooze);
766     bool UpdateNextReminder(const bool &force);
767     void UpdateNotificationContent(const bool &setSnooze);
768     void UpdateNotificationCommon();
769 
770     /**
771      * @brief Used for reminder recovery from database.
772      *
773      * @param bundleName Indicates the third part bundle name.
774      */
775     void UpdateNotificationBundleInfo();
776 
777     /**
778      * @brief Update the notification, which will be shown for the "Alerting" reminder.
779      * 1. Update the notification label/content.
780      * 2. Restore the snooze action button.
781      */
782     void UpdateNotificationStateForAlert();
783 
784     /**
785      * @brief Update the notification, which will be shown when user do a snooze.
786      * 1. Update the notification label/content.
787      * 2. Remove the snooze action button.
788      */
789     void UpdateNotificationStateForSnooze();
790 
791     static const uint32_t MIN_TIME_INTERVAL_IN_MILLI;
792     static const std::string SEP_BUTTON_SINGLE;
793     static const std::string SEP_BUTTON_MULTI;
794     static const std::string SEP_WANT_AGENT;
795 
796     std::string content_ {};
797     std::string expiredContent_ {};
798     std::string snoozeContent_ {};
799     std::string displayContent_ {};
800     std::string title_ {};
801     std::string bundleName_ {};
802     bool isExpired_ {false};
803     uint8_t snoozeTimes_ {0};
804     uint8_t snoozeTimesDynamic_ {0};
805     uint8_t state_ {0};
806     int32_t notificationId_ {0};
807     int32_t reminderId_ {-1};
808     int32_t userId_ {-1};
809     int32_t uid_ {-1};
810     bool isSystemApp_ {false};
811     bool tapDismissed_ {true};
812     int64_t autoDeletedTime_ {0};
813     std::string customButtonUri_ {};
814 
815     // Indicates the reminder has been shown in the past time.
816     // When the reminder has been created but not showed, it is equals to 0.
817     uint64_t reminderTimeInMilli_ {0};
818     uint64_t ringDurationInMilli_ {MILLI_SECONDS};
819     uint64_t triggerTimeInMilli_ {0};
820     uint64_t timeIntervalInMilli_ {0};
821     ReminderType reminderType_ {ReminderType::INVALID};
822     NotificationConstant::SlotType slotType_ {NotificationConstant::SlotType::SOCIAL_COMMUNICATION};
823     sptr<NotificationRequest> notificationRequest_ = nullptr;
824     std::shared_ptr<WantAgentInfo> wantAgentInfo_ = nullptr;
825     std::shared_ptr<MaxScreenAgentInfo> maxScreenWantAgentInfo_ = nullptr;
826     std::map<ActionButtonType, ActionButtonInfo> actionButtonMap_ {};
827 };
828 }  // namespace Reminder
829 }  // namespace OHOS
830 #endif  // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_REMINDER_REQUEST_H