diff --git a/bundle.json b/bundle.json index 5908c6c581511c9c1912a800c5e4b99ece9b05f0..7a8154240824c154bdbf167c14e7c9dcb032bd8f 100644 --- a/bundle.json +++ b/bundle.json @@ -44,9 +44,9 @@ "SystemCapability.Notification.NotificationSettings" ], "features": [ + "distributed_notification_service_feature_privileged_message", "distributed_notification_service_feature_additional_control", "distributed_notification_service_feature_disable_fa_model", - "distributed_notification_service_feature_privileged_message", "distributed_notification_service_disable_control", "distributed_notification_service_feature_badge_manager", "distributed_notification_service_feature_local_liveview", diff --git a/frameworks/ans/IAnsManager.idl b/frameworks/ans/IAnsManager.idl index 3668425a7865aa9c35ad529a43367ee6b379d419..fbdcb4d8f067b363a3bc84aa8d5e5e5ed0a986a9 100644 --- a/frameworks/ans/IAnsManager.idl +++ b/frameworks/ans/IAnsManager.idl @@ -128,7 +128,7 @@ interface OHOS.Notification.IAnsManager { void SetNotificationsEnabledForAllBundles([in] String deviceId, [in] boolean enabled); void SetNotificationsEnabledForSpecialBundle( - [in] String deviceId, [in] sptr bundleOption, [in] boolean enabled, [in] boolean updateUnEnbaleTime); + [in] String deviceId, [in] sptr bundleOption, [in] boolean enabled, [in] boolean updateUnEnableTime); void SetShowBadgeEnabledForBundle([in] sptr bundleOption, [in] boolean enabled); diff --git a/services/ans/include/notification_preferences_database.h b/services/ans/include/notification_preferences_database.h index 941a6d6c6c6ce1a26ad162ac164003965e023da2..92ed70479c648eed1fc76eee88b95c5287de43e4 100644 --- a/services/ans/include/notification_preferences_database.h +++ b/services/ans/include/notification_preferences_database.h @@ -303,7 +303,9 @@ public: int32_t SetKvToDb(const std::string &key, const std::string &value, const int32_t &userId); int32_t SetByteToDb(const std::string &key, const std::vector &value, const int32_t &userId); int32_t GetKvFromDb(const std::string &key, std::string &value, const int32_t &userId); +#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER int32_t GetKvFromDb(const std::string &key, std::string &value, const int32_t &userId, int32_t &retCode); +#endif int32_t GetByteFromDb(const std::string &key, std::vector &value, const int32_t &userId); int32_t GetBatchKvsFromDb( const std::string &key, std::unordered_map &values, const int32_t &userId); diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index ff2ab339987a70a8f9c1fc0de45eb8f8f77e4551..f3c8893948f1265a07dd9b56818dc83b36c05083 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -971,6 +971,17 @@ bool AdvancedNotificationService::IsDuplicateMsg(const std::list &bundleOption) +{ + ANS_LOGD("SetDialogPoppedRefuseTime called."); + int32_t userId = SUBSCRIBE_USER_INIT; + OHOS::AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(bundleOption->GetUid(), userId); + EXTENTION_WRAPPER->SetDialogOpenSuccessTimeStamp(bundleOption, userId); + ANS_LOGD("SetDialogPoppedRefuseTime end."); +} +#endif + ErrCode AdvancedNotificationService::PublishRemoveDuplicateEvent(const std::shared_ptr &record) { if (record == nullptr) { diff --git a/services/ans/src/enable_manager/enable_manager.cpp b/services/ans/src/enable_manager/enable_manager.cpp index 16d71a698e2daa2627e224a7179c22a9f5f408cd..4bc7c4faf41b9bb21cc85011ba82ef69d4aec3fc 100644 --- a/services/ans/src/enable_manager/enable_manager.cpp +++ b/services/ans/src/enable_manager/enable_manager.cpp @@ -142,6 +142,7 @@ ErrCode AdvancedNotificationService::CommonRequestEnableNotification(const std:: #ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER int32_t userId = -1; OsAccountManagerHelper::GetInstance().GetOsAccountLocalIdFromUid(bundleOption->GetUid(), userId); + ANS_LOGD("GetOsAccountLocalIdFromUid PRI, %{public}d, %{public}d", bundleOption->GetUid(), userId); if (!EXTENTION_WRAPPER->GetPrivilegeDialogPopped(bundleOption, userId)) { ANS_LOGE("GetPrivilegeDialogPopped false."); message.ErrorCode(ERR_ANS_NOT_ALLOWED).Append(" Has no permission popped"); @@ -347,6 +348,7 @@ ErrCode AdvancedNotificationService::CanPopEnableNotificationDialog( #ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER int32_t userId = -1; OsAccountManagerHelper::GetInstance().GetOsAccountLocalIdFromUid(bundleOption->GetUid(), userId); + ANS_LOGD("GetOsAccountLocalIdFromUid PRI, %{public}d, %{public}d", bundleOption->GetUid(), userId); if (!EXTENTION_WRAPPER->GetPrivilegeDialogPopped(bundleOption, userId)) { ANS_LOGE("GetPrivilegeDialogPopped false."); message.ErrorCode(ERR_ANS_NOT_ALLOWED).Append(" Has no permission popped"); diff --git a/services/ans/src/notification_dialog_manager.cpp b/services/ans/src/notification_dialog_manager.cpp index c58cdf8d4e8429e1b5412416de440b55b605dc58..10639edbb13b113ee4a6be37d79cabac603bfd36 100644 --- a/services/ans/src/notification_dialog_manager.cpp +++ b/services/ans/src/notification_dialog_manager.cpp @@ -24,8 +24,10 @@ #include "notification_bundle_option.h" #include "notification_dialog.h" #include "notification_preferences.h" +#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER #include "os_account_manager_helper.h" #include "notification_extension_wrapper.h" +#endif #include #include diff --git a/services/ans/src/notification_extension_wrapper.cpp b/services/ans/src/notification_extension_wrapper.cpp index 4e0028176f480e93a4686f318d1aa250944c1b4b..5398af24e8bf95167653e4319ca287beebd66f53 100644 --- a/services/ans/src/notification_extension_wrapper.cpp +++ b/services/ans/src/notification_extension_wrapper.cpp @@ -52,13 +52,13 @@ void UpdateUnifiedGroupInfo(const std::string &key, std::shared_ptrUpdateUnifiedGroupInfo(key, groupInfo); } +#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER SYMBOL_EXPORT void GetAdditionalConfig(const std::string &key, std::string &value) { value = NotificationPreferences::GetInstance()->GetAdditionalConfig(key); ANS_LOGD("GetAdditionalConfig SYMBOL_EXPORT valiue %{public}s", value.c_str()); } -#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER SYMBOL_EXPORT int32_t SetKvToDb(const std::string &key, const std::string &value, const int32_t &userId) { return NotificationPreferences::GetInstance()->SetKvToDb(key, value, userId); diff --git a/services/ans/src/notification_preferences.cpp b/services/ans/src/notification_preferences.cpp index 13404d66f6ebf42c39ad07bd75a5f2de1cbb5dcb..6a605aea73ca3752a6b2a4da81b1533d55f146be 100644 --- a/services/ans/src/notification_preferences.cpp +++ b/services/ans/src/notification_preferences.cpp @@ -1318,17 +1318,6 @@ int32_t NotificationPreferences::GetBatchKvsFromDbContainsKey( return preferncesDB_->GetBatchKvsFromDbContainsKey(key, values, userId); } -#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER -int32_t NotificationPreferences::GetKvFromDb( - const std::string &key, std::string &value, const int32_t &userId, int32_t &retCode) -{ - if (preferncesDB_ == nullptr) { - return ERR_ANS_SERVICE_NOT_READY; - } - return preferncesDB_->GetKvFromDb(key, value, userId, retCode); -} -#endif - int32_t NotificationPreferences::GetBatchKvsFromDb( const std::string &key, std::unordered_map &values, const int32_t &userId) { @@ -1586,5 +1575,16 @@ bool NotificationPreferences::SetBundleRemoveFlag(const sptrSetBundleRemoveFlag(bundleOption, slotType, sourceType); } + +#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER +int32_t NotificationPreferences::GetKvFromDb( + const std::string &key, std::string &value, const int32_t &userId, int32_t &retCode) +{ + if (preferncesDB_ == nullptr) { + return ERR_ANS_SERVICE_NOT_READY; + } + return preferncesDB_->GetKvFromDb(key, value, userId, retCode); +} +#endif } // namespace Notification } // namespace OHOS diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index 53f9126001d57f30ba884a66404cd95993bff756..32a931dac48c6bf82a7daa73a7ceb40676ade548 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -1901,6 +1901,7 @@ int32_t NotificationPreferencesDatabase::GetKvFromDb( return NativeRdb::E_OK; } +#ifdef ENABLE_ANS_PRIVILEGED_MESSAGE_EXT_WRAPPER int32_t NotificationPreferencesDatabase::GetKvFromDb( const std::string &key, std::string &value, const int32_t &userId, int32_t &retCode) { @@ -1912,6 +1913,7 @@ int32_t NotificationPreferencesDatabase::GetKvFromDb( retCode = rdbDataManager_->QueryData(key, value, userId); return retCode; } +#endif int32_t NotificationPreferencesDatabase::GetByteFromDb( const std::string &key, std::vector &value, const int32_t &userId)