• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 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_SERVICES_NOTIFICATION_PREFERENCES_DATABASE_H
17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_NOTIFICATION_PREFERENCES_DATABASE_H
18 
19 #include <functional>
20 #include <memory>
21 #include <sstream>
22 #include <string>
23 
24 #include "notification_rdb_data_mgr.h"
25 #include "notification_preferences_info.h"
26 
27 namespace OHOS {
28 namespace Notification {
29 class NotificationPreferencesDatabase final {
30 public:
31     NotificationPreferencesDatabase();
32     ~NotificationPreferencesDatabase();
33 
34     /**
35      * @brief Put notification slots into disturbe DB.
36      *
37      * @param bundleName Indicates bundle name.
38      * @param bundleUid Indicates bundle uid.
39      * @param slots Indicates notification slots.
40      * @return Return true on success, false on failure.
41      */
42     bool PutSlotsToDisturbeDB(
43         const std::string &bundleName, const int32_t &bundleUid, const std::vector<sptr<NotificationSlot>> &slots);
44 
45     /**
46      * @brief Put notification bundle into disturbe DB.
47      *
48      * @param bundleInfo Indicates bundle info.
49      * @return Return true on success, false on failure.
50      */
51     bool PutBundlePropertyToDisturbeDB(const NotificationPreferencesInfo::BundleInfo &bundleInfo);
52 
53     /**
54      * @brief Put show badge in the of bundle into disturbe DB.
55      *
56      * @param bundleInfo Indicates bundle info.
57      * @param enable Indicates to whether show badge.
58      * @return Return true on success, false on failure.
59      */
60     bool PutShowBadge(const NotificationPreferencesInfo::BundleInfo &bundleInfo, const bool &enable);
61 
62     /**
63      * @brief Put importance in the of bundle into disturbe DB.
64      *
65      * @param bundleInfo Indicates bundle info.
66      * @param importance Indicates to importance level  which can be LEVEL_NONE,
67                LEVEL_MIN, LEVEL_LOW, LEVEL_DEFAULT, LEVEL_HIGH, or LEVEL_UNDEFINED.
68      * @return Return true on success, false on failure.
69      */
70     bool PutImportance(const NotificationPreferencesInfo::BundleInfo &bundleInfo, const int32_t &importance);
71 
72     /**
73      * @brief Put badge total nums in the of  bundle into disturbe DB.
74      *
75      * @param bundleInfo Indicates bundle info.
76      * @param totalBadgeNum Indicates to total badge num.
77      * @return Return true on success, false on failure.
78      */
79     bool PutTotalBadgeNums(const NotificationPreferencesInfo::BundleInfo &bundleInfo, const int32_t &totalBadgeNum);
80 
81     /**
82      * @brief Put enable notification in the of  bundle into disturbe DB.
83      *
84      * @param bundleInfo Indicates bundle info.
85      * @param state Indicates to whether to enabled
86      * @return Return true on success, false on failure.
87      */
88     bool PutNotificationsEnabledForBundle(
89         const NotificationPreferencesInfo::BundleInfo &bundleInfo, const NotificationConstant::SWITCH_STATE &state);
90 
91     /**
92      * @brief Put distributed enable notification in the of  bundle into disturbe DB.
93      *
94      * @param deviceType Indicates device type.
95      * @param bundleInfo Indicates bundle info.
96      * @param enabled Indicates to whether to enabled
97      * @return Return true on success, false on failure.
98      */
99     bool PutDistributedEnabledForBundle(const std::string deviceType,
100         const NotificationPreferencesInfo::BundleInfo &bundleInfo, const bool &enabled);
101 
102     /**
103      * @brief Sets whether to allow a specified application to publish notifications cross
104      * device collaboration. The caller must have system permissions to call this method.
105      *
106      * @param bundles Indicates the bundles.
107      * @param deviceType Indicates the type of the device running the application.
108      * @param userId userId
109      * @return Returns set distributed enabled for specified bundle result.
110      */
111     bool PutDistributedBundleOption(
112         const std::vector<sptr<DistributedBundleOption>> &bundles,
113         const std::string &deviceType,
114         const int32_t &userId
115         );
116 
117     /**
118      * @brief Get distributed enable notification in the of  bundle into disturbe DB.
119      *
120      * @param deviceType Indicates device type.
121      * @param bundleInfo Indicates bundle info.
122      * @param enabled Indicates to whether to enabled
123      * @return Return true on success, false on failure.
124      */
125     bool GetDistributedEnabledForBundle(const std::string deviceType,
126         const NotificationPreferencesInfo::BundleInfo &bundleInfo, bool &enabled);
127 
128     /**
129      * @brief Put distributed enable notification in the of  bundle into disturbe DB.
130      *
131      * @param bundleInfo Indicates bundle info.
132      * @param enabled Indicates to whether to enabled
133      * @return Return true on success, false on failure.
134      */
135     bool SetSilentReminderEnabled(
136         const NotificationPreferencesInfo::SilentReminderInfo &silentReminderInfo);
137 
138     /**
139      * @brief Get distributed enable notification in the of  bundle into disturbe DB.
140      *
141      * @param bundleInfo Indicates bundle info.
142      * @param enabled Indicates to whether to enabled
143      * @return Return true on success, false on failure.
144      */
145     bool IsSilentReminderEnabled(
146         NotificationPreferencesInfo::SilentReminderInfo &silentReminderInfo);
147 
148     /**
149      * @brief Put distributed enable notification in the of  bundle into disturbe DB.
150      *
151      * @param deviceType Indicates device type.
152      * @param enabled Indicates to whether to enabled
153      * @return Return true on success, false on failure.
154      */
155     bool PutDistributedEnabled(const std::string &deviceType, const NotificationConstant::SWITCH_STATE &enabled);
156 
157     /**
158      * @brief get distributed enable notification in the of  bundle into disturbe DB.
159      *
160      * @param deviceType Indicates device type.
161      * @param enabled Indicates to whether to enabled
162      * @return Return true on success, false on failure.
163      */
164     bool GetDistributedEnabled(const std::string &deviceType, NotificationConstant::SWITCH_STATE &enabled);
165 
166     /**
167      * @brief Get the target device's authorization status.
168      *
169      * @param deviceType Type of the target device whose status you want to set.
170      * @param deviceId The id of the target device.
171      * @param targetUserId The userid of the target device.
172      * @param isAuth Return The authorization status.
173      * @return Returns get result.
174      */
175     bool GetDistributedAuthStatus(
176         const std::string &deviceType, const std::string &deviceId, int32_t targetUserId, bool &isAuth);
177 
178     /**
179      * @brief Set the target device's authorization status.
180      *
181      * @param deviceType Type of the target device whose status you want to set.
182      * @param deviceId The id of the target device.
183      * @param targetUserId The userid of the target device.
184      * @param isAuth The authorization status.
185      * @return Returns set result.
186      */
187     bool SetDistributedAuthStatus(
188         const std::string &deviceType, const std::string &deviceId, int32_t targetUserId, bool isAuth);
189 
190     /**
191      * @brief Put smart reminder enable notification in the of  bundle into disturbe DB.
192      *
193      * @param deviceType Indicates device type.
194      * @param enabled Indicates to whether to enabled
195      * @return Return true on success, false on failure.
196      */
197     bool SetSmartReminderEnabled(const std::string deviceType, const bool &enabled);
198 
199     /**
200      * @brief Get smart reminder enable notification in the of  bundle into disturbe DB.
201      *
202      * @param deviceType Indicates device type.
203      * @param enabled Indicates to whether to enabled
204      * @return Return true on success, false on failure.
205      */
206     bool IsSmartReminderEnabled(const std::string deviceType, bool &enabled);
207 
208     /**
209      * @brief Set the channel switch for collaborative reminders.
210        The caller must have system permissions to call this method.
211      *
212      * @param slotType Indicates the slot type of the application.
213      * @param deviceType Indicates the type of the device running the application.
214      * @param enabled Indicates slot switch status.
215      * @return Returns set channel switch result.
216      */
217     bool SetDistributedEnabledBySlot(
218         const NotificationConstant::SlotType &slotType, const std::string &deviceType, const bool enabled);
219 
220     /**
221      * @brief Query the channel switch for collaborative reminders.
222        The caller must have system permissions to call this method.
223      *
224      * @param slotType Indicates the slot type of the application.
225      * @param deviceType Indicates the type of the device running the application.
226      * @param enabled Indicates slot switch status.
227      * @return Returns channel switch result.
228      */
229     bool IsDistributedEnabledBySlot(
230         const NotificationConstant::SlotType &slotType, const std::string &deviceType, bool &enabled);
231 
232     /**
233      * @brief Querying Aggregation Configuration Values
234      *
235      * @return Configured value
236      */
237     std::string GetAdditionalConfig(const std::string &key);
238 
239     /**
240      * @brief Put enable notification into disturbe DB.
241      *
242      * @param userId Indicates user.
243      * @param enabled Indicates to whether to enabled
244      * @return Return true on success, false on failure.
245      */
246     bool PutNotificationsEnabled(const int32_t &userId, const bool &enabled);
247     bool PutSlotFlags(NotificationPreferencesInfo::BundleInfo &bundleInfo, const int32_t &slotFlags);
248     bool PutHasPoppedDialog(const NotificationPreferencesInfo::BundleInfo &bundleInfo, const bool &hasPopped);
249 
250     /**
251      * @brief Put do not disturbe date into disturbe DB.
252      *
253      * @param userId Indicates user.
254      * @param date Indicates to do not disturbe date.
255      * @return Return true on success, false on failure.
256      */
257     bool PutDoNotDisturbDate(const int32_t &userId, const sptr<NotificationDoNotDisturbDate> &date);
258 
259     /**
260      * @brief Parse notification info from disturbe DB.
261      *
262      * @param info Indicates notification info.
263      * @return Return true on success, false on failure.
264      */
265     bool ParseFromDisturbeDB(NotificationPreferencesInfo &info, int32_t userId = -1);
266 
267     /**
268      * @brief Delete all data from disturbe DB.
269      *
270      * @return Return true on success, false on failure.
271      */
272     bool RemoveAllDataFromDisturbeDB();
273 
274     /**
275      * @brief Delete bundle data from disturbe DB.
276      *
277      * @param bundleKey Indicates the bundle key.
278      * @param bundleId Indicates to bundle uid.
279      * @return Return true on success, false on failure.
280      */
281     bool RemoveBundleFromDisturbeDB(const std::string &bundleKey, const int32_t &bundleUid);
282 
283     /**
284      * @brief Delete slot from disturbe DB.
285      *
286      * @param bundleKey Indicates to which a bundle.
287      * @param type Indicates to slot type.
288      * @param bundleId Indicates to bundle uid.
289      * @return Return true on success, false on failure.
290      */
291     bool RemoveSlotFromDisturbeDB(const std::string &bundleKey, const NotificationConstant::SlotType &type,
292         const int32_t &bundleUid);
293 
294     /**
295      * @brief Obtains allow notification application list.
296      *
297      * @param bundleOption Indicates the bundle bundleOption.
298      * @return Returns ERR_OK on success, others on failure.
299      */
300     bool GetAllNotificationEnabledBundles(std::vector<NotificationBundleOption> &bundleOption);
301 
302     /**
303      * @brief Delete all slots in the of bundle from disturbe DB.
304      *
305      * @param bundleKey Indicates to which a bundle.
306      * @param bundleUid Indicates to the bundle uid.
307      * @return Return true on success, false on failure.
308      */
309     bool RemoveAllSlotsFromDisturbeDB(const std::string &bundleKey, const int32_t &bundleUid);
310 
311      /**
312      * @brief Get bundleInfo from DB.
313      *
314      * @param bundleOption Indicates the bundle bundleOption.
315      * @param bundleInfo Indicates bundle info.
316      * @return Return true on success, false on failure.
317      */
318     bool GetBundleInfo(const sptr<NotificationBundleOption> &bundleOption,
319         NotificationPreferencesInfo::BundleInfo &bundleInfo);
320 
321     /**
322      * @brief Query whether there is a agent relationship between the two apps.
323      *
324      * @param agentBundleName The bundleName of the agent app.
325      * @param sourceBundleName The bundleName of the source app.
326      * @return Returns true if There is an agent relationship; returns false otherwise.
327      */
328     bool IsAgentRelationship(const std::string &agentBundleName, const std::string &sourceBundleName);
329     bool RemoveNotificationEnable(const int32_t userId);
330     bool RemoveDoNotDisturbDate(const int32_t userId);
331     bool RemoveAnsBundleDbInfo(std::string bundleName, int32_t uid);
332     bool RemoveSilentEnabledDbByBundle(std::string bundleName, int32_t uid);
333     bool AddDoNotDisturbProfiles(int32_t userId, const std::vector<sptr<NotificationDoNotDisturbProfile>> &profiles);
334     bool RemoveDoNotDisturbProfiles(
335         int32_t userId, const std::vector<sptr<NotificationDoNotDisturbProfile>> &profiles);
336     bool GetDoNotDisturbProfiles(
337         const std::string &key, sptr<NotificationDoNotDisturbProfile> &profile, const int32_t &userId);
338     bool RemoveEnabledDbByBundleName(std::string bundleName, const int32_t &bundleUid);
339     int32_t SetKvToDb(const std::string &key, const std::string &value, const int32_t &userId);
340     int32_t SetByteToDb(const std::string &key, const std::vector<uint8_t> &value, const int32_t &userId);
341     int32_t GetKvFromDb(const std::string &key, std::string &value, const int32_t &userId);
342 #ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER
343     int32_t GetKvFromDb(const std::string &key, std::string &value, const int32_t &userId, int32_t &retCode);
344 #endif
345     int32_t GetByteFromDb(const std::string &key, std::vector<uint8_t> &value, const int32_t &userId);
346     int32_t GetBatchKvsFromDb(
347         const std::string &key, std::unordered_map<std::string, std::string> &values, const int32_t &userId);
348     int32_t GetBatchKvsFromDbContainsKey(
349         const std::string &key, std::unordered_map<std::string, std::string> &values, const int32_t &userId);
350     int32_t DeleteKvFromDb(const std::string &key, const int32_t &userId);
351     int32_t DeleteBatchKvFromDb(const std::vector<std::string> &keys, const int &userId);
352     int32_t DropUserTable(const int32_t userId);
353     bool UpdateBundlePropertyToDisturbeDB(int32_t userId, const NotificationPreferencesInfo::BundleInfo &bundleInfo);
354     bool UpdateBundleSlotToDisturbeDB(int32_t userId, const std::string &bundleName,
355         const int32_t &bundleUid, const std::vector<sptr<NotificationSlot>> &slots);
356     bool IsNotificationSlotFlagsExists(const sptr<NotificationBundleOption> &bundleOption);
357     bool DelCloneProfileInfo(const int32_t &userId, const sptr<NotificationDoNotDisturbProfile>& info);
358     bool UpdateBatchCloneProfileInfo(const int32_t &userId,
359         const std::vector<sptr<NotificationDoNotDisturbProfile>>& profileInfo);
360     void GetAllCloneProfileInfo(const int32_t &userId,
361         std::vector<sptr<NotificationDoNotDisturbProfile>>& profilesInfo);
362     void GetAllCloneBundleInfo(const int32_t &userId, std::vector<NotificationCloneBundleInfo>& cloneBundleInfo);
363     bool UpdateBatchCloneBundleInfo(const int32_t &userId,
364         const std::vector<NotificationCloneBundleInfo>& cloneBundleInfo);
365     bool DelCloneBundleInfo(const int32_t &userId, const NotificationCloneBundleInfo& cloneBundleInfo);
366     bool DelBatchCloneProfileInfo(const int32_t &userId,
367         const std::vector<sptr<NotificationDoNotDisturbProfile>>& profileInfo);
368     bool DelBatchCloneBundleInfo(const int32_t &userId,
369         const std::vector<NotificationCloneBundleInfo>& cloneBundleInfo);
370     bool SetDisableNotificationInfo(const sptr<NotificationDisable> &notificationDisable);
371     bool GetDisableNotificationInfo(NotificationDisable &notificationDisable);
372     bool GetUserDisableNotificationInfo(int32_t userId, NotificationDisable &notificationDisable);
373     bool SetSubscriberExistFlag(const std::string& deviceType, bool existFlag);
374     bool GetSubscriberExistFlag(const std::string& deviceType, bool& existFlag);
375     bool IsDistributedEnabledEmptyForBundle(
376         const std::string& deviceType, const NotificationPreferencesInfo::BundleInfo& bundleInfo);
377     bool GetAllDistribuedEnabledBundles(int32_t userId,
378         const std::string &deviceType, std::vector<NotificationBundleOption> &bundleOption);
379     /**
380      * @brief set rule of generate hashCode.
381      *
382      * @param uid uid.
383      * @param type generate hashCode.
384      * @return result true:success.
385      */
386     bool SetHashCodeRule(const int32_t uid, const uint32_t type);
387 
388     /**
389      * @brief set rule of generate hashCode.
390      *
391      * @param uid uid.
392      * @return type generate hashCode.
393      */
394     uint32_t GetHashCodeRule(const int32_t uid);
395 
396     bool SetBundleRemoveFlag(const sptr<NotificationBundleOption> &bundleOption,
397         const NotificationConstant::SlotType &slotType, int32_t sourceType);
398 
399     bool GetBundleRemoveFlag(const sptr<NotificationBundleOption> &bundleOption,
400         const NotificationConstant::SlotType &slotType, int32_t sourceType);
401 
402     /**
403      * @brief ParseBundleFromDistureDB
404      * @param info bundle info.
405      * @param entries bundle keys.
406      * @param userId userId.
407      * @return void
408      */
409     void ParseBundleFromDistureDB(NotificationPreferencesInfo &info,
410         const std::unordered_map<std::string, std::string> &entries, const int32_t &userId);
411 
412     /**
413      * @brief Put distributed device list into disturbe DB.
414      *
415      * @param deviceTypes Indicates device types.
416      * @param userId Indicates userId
417      * @return Return true on success, false on failure.
418      */
419     bool PutDistributedDevicelist(const std::string &deviceTypes, const int32_t &userId);
420 
421     /**
422      * @brief get distributed device list from disturbe DB.
423      *
424      * @param deviceTypes Indicates device types.
425      * @return Return true on success, false on failure.
426      */
427     bool GetDistributedDevicelist(std::string &deviceTypes);
428 
429 private:
430     bool CheckRdbStore();
431 
432     bool CheckBundle(const std::string &bundleName, const int32_t &bundleUid);
433     bool PutBundlePropertyValueToDisturbeDB(const NotificationPreferencesInfo::BundleInfo &bundleInfo);
434     template <typename T>
435     int32_t PutBundlePropertyToDisturbeDB(
436         const std::string &bundleKey, const BundleType &type, const T &t, const int32_t &bundleUid);
437     template <typename T>
438     int32_t PutDataToDB(const std::string &key, const T &t, const int32_t &userId);
439     bool PutBundleToDisturbeDB(
440         const std::string &bundleKey, const NotificationPreferencesInfo::BundleInfo &bundleInfo);
441     bool HandleDataBaseMap(
442         const std::unordered_map<std::string, std::string> &datas, std::vector<NotificationBundleOption> &bundleOption);
443 
444     void GetValueFromDisturbeDB(const std::string &key, const int &userId,
445         std::function<void(std::string &)> function);
446     void GetValueFromDisturbeDB(const std::string &key, const int &userId,
447         std::function<void(int32_t &, std::string &)> function);
448 
449     bool SlotToEntry(const std::string &bundleName, const int32_t &bundleUid, const sptr<NotificationSlot> &slot,
450         std::unordered_map<std::string, std::string> &values);
451     void GenerateSlotEntry(const std::string &bundleKey, const sptr<NotificationSlot> &slot,
452         std::unordered_map<std::string, std::string> &values) const;
453     void GenerateEntry(
454         const std::string &key, const std::string &value, std::unordered_map<std::string, std::string> &values) const;
455 
456     std::string FindLastString(const std::string &findString, const std::string &inputString) const;
457     std::string SubUniqueIdentifyFromString(const std::string &findString, const std::string &keyStr) const;
458     std::string VectorToString(const std::vector<int64_t> &data) const;
459     void StringToVector(const std::string &str, std::vector<int64_t> &data) const;
460     int32_t StringToInt(const std::string &str) const;
461     int64_t StringToInt64(const std::string &str) const;
462     void StringSplit(const std::string content, char delim, std::vector<std::string>& result) const;
463     bool IsSlotKey(const std::string &bundleKey, const std::string &key) const;
464     bool IsSilentReminderKey(const std::string &bundleKey, const std::string &key) const;
465     std::string GenerateSlotKey(
466         const std::string &bundleKey, const std::string &type = "", const std::string &subType = "") const;
467     std::string GenerateBundleKey(const std::string &bundleKey, const std::string &type = "") const;
468 
469     void ParseSlotFromDisturbeDB(NotificationPreferencesInfo::BundleInfo &bundleInfo, const std::string &bundleKey,
470         const std::pair<std::string, std::string> &entry, const int32_t &userId);
471     void ParseSilentReminderFromDisturbeDB(NotificationPreferencesInfo::SilentReminderInfo &silentReminderInfo,
472         const std::pair<std::string, std::string> &entry);
473     void ParseBundlePropertyFromDisturbeDB(NotificationPreferencesInfo::BundleInfo &bundleInfo,
474         const std::string &bundleKey, const std::pair<std::string, std::string> &entry);
475     void ParseBundleName(NotificationPreferencesInfo::BundleInfo &bundleInfo, const std::string &value) const;
476     void ParseBundleImportance(NotificationPreferencesInfo::BundleInfo &bundleInfo, const std::string &value) const;
477     void ParseBundleSlotFlags(NotificationPreferencesInfo::BundleInfo &bundleInfo, const std::string &value) const;
478     void ParseBundleShowBadgeEnable(NotificationPreferencesInfo::BundleInfo &bundleInfo,
479         const std::string &value) const;
480     void ParseBundleBadgeNum(NotificationPreferencesInfo::BundleInfo &bundleInfo, const std::string &value) const;
481     void ParseBundleEnableNotification(
482         NotificationPreferencesInfo::BundleInfo &bundleInfo, const std::string &value) const;
483     void ParseBundlePoppedDialog(
484         NotificationPreferencesInfo::BundleInfo &bundleInfo, const std::string &value) const;
485     void ParseBundleUid(NotificationPreferencesInfo::BundleInfo &bundleInfo, const std::string &value) const;
486     void ParseSlot(const std::string &findString, sptr<NotificationSlot> &slot,
487         const std::pair<std::string, std::string> &entry, const int32_t &userId);
488     void ParseSlotDescription(sptr<NotificationSlot> &slot, const std::string &value) const;
489     void ParseSlotLevel(sptr<NotificationSlot> &slot, const std::string &value) const;
490     void ParseSlotShowBadge(sptr<NotificationSlot> &slot, const std::string &value) const;
491     void ParseSlotEnableLight(sptr<NotificationSlot> &slot, const std::string &value) const;
492     void ParseSlotEnableVrbration(sptr<NotificationSlot> &slot, const std::string &value) const;
493     void ParseSlotLedLightColor(sptr<NotificationSlot> &slot, const std::string &value) const;
494     void ParseSlotLockscreenVisibleness(sptr<NotificationSlot> &slot, const std::string &value) const;
495     void ParseSlotSound(sptr<NotificationSlot> &slot, const std::string &value) const;
496     void ParseSlotVibrationSytle(sptr<NotificationSlot> &slot, const std::string &value) const;
497     void ParseSlotEnableBypassDnd(sptr<NotificationSlot> &slot, const std::string &value) const;
498     void ParseSlotEnabled(sptr<NotificationSlot> &slot, const std::string &value) const;
499     void ParseSlotFlags(sptr<NotificationSlot> &slot, const std::string &value) const;
500     void ParseSlotAuthorizedStatus(sptr<NotificationSlot> &slot, const std::string &value) const;
501     void ParseSlotAuthHitnCnt(sptr<NotificationSlot> &slot, const std::string &value) const;
502     void ParseSlotReminderMode(sptr<NotificationSlot> &slot, const std::string &value) const;
503     bool UpdateCloneToDisturbeDB(const int32_t &userId,
504         const std::unordered_map<std::string, std::string> values);
505 
506     std::string GenerateBundleLablel(const NotificationPreferencesInfo::BundleInfo &bundleInfo) const;
507     std::string GenerateBundleLablel(const NotificationPreferencesInfo::BundleInfo &bundleInfo,
508         const std::string &deviceType) const;
509     std::string GenerateBundleLablel(const std::string &deviceType, const int32_t userId) const;
510     std::string GenerateBundleLablel(const NotificationConstant::SlotType &slotType,
511         const std::string &deviceType, const int32_t userId) const;
512     std::string GenerateBundleLablel(
513         const std::string &deviceType, const std::string &deviceId, const int32_t userId) const;
514     std::string GenerateSilentReminderKey(
515         const NotificationPreferencesInfo::SilentReminderInfo &silentReminderInfo) const;
516     void GetDoNotDisturbType(NotificationPreferencesInfo &info, int32_t userId);
517     void GetDoNotDisturbBeginDate(NotificationPreferencesInfo &info, int32_t userId);
518     void GetDoNotDisturbEndDate(NotificationPreferencesInfo &info, int32_t userId);
519     void GetEnableAllNotification(NotificationPreferencesInfo &info, int32_t userId);
520     void GetDoNotDisturbProfile(NotificationPreferencesInfo &info, int32_t userId);
521     void GetDisableNotificationInfo(NotificationPreferencesInfo &info);
522     void SetSoltProperty(sptr<NotificationSlot> &slot, std::string &typeStr, std::string &valueStr,
523         const std::string &findString, const int32_t &userId);
524     void ExecuteDisturbeDB(sptr<NotificationSlot> &slot, std::string &typeStr, std::string &valueStr,
525         const std::string &findString, const int32_t &userId);
526     bool CheckApiCompatibility(const std::string &bundleName, const int32_t &uid);
527     std::shared_ptr<NotificationDataMgr> rdbDataManager_;
528     std::string GenerateSubscriberExistFlagKey(const std::string& deviceType, const int32_t userId) const;
529     void GetSmartReminderEnableFromCCM(const std::string& deviceType, bool& enabled);
530     bool isCachedSmartReminderEnableList_ = false;
531     std::vector<std::string> smartReminderEnableList_ = {};
532     std::string GenerateHashCodeGenerate(int32_t uid);
533 };
534 } // namespace Notification
535 } // namespace OHOS
536 #endif  // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_NOTIFICATION_PREFERENCES_DATABASE_H
537