diff --git a/frameworks/ans/core/common/include/ans_inner_errors.h b/frameworks/ans/core/common/include/ans_inner_errors.h index d488c230eb6ced020c7a98a739954568b957a42b..7600c5917c7864476f2b61ac2b1fb8da31d15950 100644 --- a/frameworks/ans/core/common/include/ans_inner_errors.h +++ b/frameworks/ans/core/common/include/ans_inner_errors.h @@ -59,7 +59,7 @@ enum ErrorCode : uint32_t { ERR_ANS_PERMISSION_DENIED, ERR_ANS_NOTIFICATION_NOT_EXISTS, ERR_ANS_NOTIFICATION_IS_UNREMOVABLE, - ERR_ANS_OVER_MAX_ACITVE_PERSECOND, + ERR_ANS_OVER_MAX_ACTIVE_PERSECOND, ERR_ANS_ICON_OVER_SIZE, ERR_ANS_PICTURE_OVER_SIZE, ERR_ANS_PREFERENCES_NOTIFICATION_DB_OPERATION_FAILED, diff --git a/frameworks/ans/native/src/notification.cpp b/frameworks/ans/native/src/notification.cpp index d84d422d29cb9cff94333f9751bd2b339a8a5999..7723258b80e2da49c025bb80cfe43d1747543a60 100644 --- a/frameworks/ans/native/src/notification.cpp +++ b/frameworks/ans/native/src/notification.cpp @@ -40,7 +40,7 @@ Notification::Notification(const Notification &other) { enableSound_ = other.enableSound_; enableLight_ = other.enableLight_; - enableViration_ = other.enableViration_; + enableVibration_ = other.enableVibration_; key_ = other.key_; ledLightColor_ = other.ledLightColor_; lockscreenVisibleness_ = other.lockscreenVisibleness_; @@ -69,7 +69,7 @@ bool Notification::EnableSound() const bool Notification::EnableVibrate() const { - return enableViration_; + return enableVibration_; } std::string Notification::GetBundleName() const @@ -145,7 +145,7 @@ Uri Notification::GetSound() const return Uri(""); } -uid_t Notification::GetUid() const +int32_t Notification::GetUid() const { if (request_ == nullptr) { return 0; @@ -230,8 +230,8 @@ bool Notification::MarshallingBool(Parcel &parcel) const return false; } - if (!parcel.WriteBool(enableViration_)) { - ANS_LOGE("Can't write enableViration_"); + if (!parcel.WriteBool(enableVibration_)) { + ANS_LOGE("Can't write enableVibration_"); return false; } @@ -344,8 +344,8 @@ void Notification::ReadFromParcelBool(Parcel &parcel) // Read enableSound_ enableSound_ = parcel.ReadBool(); - // Read enableViration_ - enableViration_ = parcel.ReadBool(); + // Read enableVibration_ + enableVibration_ = parcel.ReadBool(); // Read isRemoveAllowed_ isRemoveAllowed_ = parcel.ReadBool(); @@ -427,9 +427,9 @@ void Notification::SetEnableLight(const bool &enable) enableLight_ = enable; } -void Notification::SetEnableViration(const bool &enable) +void Notification::SetEnableVibration(const bool &enable) { - enableViration_ = enable; + enableVibration_ = enable; } void Notification::SetLedLightColor(const int32_t &color) diff --git a/frameworks/ans/native/src/notification_content.cpp b/frameworks/ans/native/src/notification_content.cpp index dbd39018996bea0abbe673bbffd8aaecac360848..44a866ba1a5c802e527411d57c1a509d7fb0f0a0 100644 --- a/frameworks/ans/native/src/notification_content.cpp +++ b/frameworks/ans/native/src/notification_content.cpp @@ -122,7 +122,7 @@ bool NotificationContent::ToJson(nlohmann::json &jsonObject) const } nlohmann::json contentObj; - if (!NotificationJsonConverter::ConvertToJosn(content_.get(), contentObj)) { + if (!NotificationJsonConverter::ConvertToJson(content_.get(), contentObj)) { ANS_LOGE("Cannot convert content to JSON"); return false; } @@ -258,19 +258,19 @@ bool NotificationContent::ConvertJsonToContent(NotificationContent *target, cons NotificationBasicContent *pBasicContent {nullptr}; switch (target->contentType_) { case NotificationContent::Type::BASIC_TEXT: - pBasicContent = NotificationJsonConverter::ConvertFromJosn(contentObj); + pBasicContent = NotificationJsonConverter::ConvertFromJson(contentObj); break; case NotificationContent::Type::CONVERSATION: - pBasicContent = NotificationJsonConverter::ConvertFromJosn(contentObj); + pBasicContent = NotificationJsonConverter::ConvertFromJson(contentObj); break; case NotificationContent::Type::LONG_TEXT: - pBasicContent = NotificationJsonConverter::ConvertFromJosn(contentObj); + pBasicContent = NotificationJsonConverter::ConvertFromJson(contentObj); break; case NotificationContent::Type::MULTILINE: - pBasicContent = NotificationJsonConverter::ConvertFromJosn(contentObj); + pBasicContent = NotificationJsonConverter::ConvertFromJson(contentObj); break; case NotificationContent::Type::PICTURE: - pBasicContent = NotificationJsonConverter::ConvertFromJosn(contentObj); + pBasicContent = NotificationJsonConverter::ConvertFromJson(contentObj); break; default: ANS_LOGE("Invalid contentType"); diff --git a/frameworks/ans/native/src/notification_conversational_content.cpp b/frameworks/ans/native/src/notification_conversational_content.cpp index 78d0494b0c1d463d089b886a6fa103a3303e3fbb..f63c5300d34eff731e67f8e70cc973101e8e589c 100644 --- a/frameworks/ans/native/src/notification_conversational_content.cpp +++ b/frameworks/ans/native/src/notification_conversational_content.cpp @@ -101,7 +101,7 @@ bool NotificationConversationalContent::ToJson(nlohmann::json &jsonObject) const } nlohmann::json userObj; - if (!NotificationJsonConverter::ConvertToJosn(&messageUser_, userObj)) { + if (!NotificationJsonConverter::ConvertToJson(&messageUser_, userObj)) { ANS_LOGE("Cannot convert messageUser to JSON"); return false; } @@ -117,7 +117,7 @@ bool NotificationConversationalContent::ToJson(nlohmann::json &jsonObject) const } nlohmann::json msgObj; - if (!NotificationJsonConverter::ConvertToJosn(msg.get(), msgObj)) { + if (!NotificationJsonConverter::ConvertToJson(msg.get(), msgObj)) { ANS_LOGE("Cannot convert conversationalMessage to JSON"); return false; } @@ -146,7 +146,7 @@ NotificationConversationalContent *NotificationConversationalContent::FromJson(c const auto &jsonEnd = jsonObject.cend(); if (jsonObject.find("messageUser") != jsonEnd) { auto userObj = jsonObject.at("messageUser"); - auto pUser = NotificationJsonConverter::ConvertFromJosn(userObj); + auto pUser = NotificationJsonConverter::ConvertFromJson(userObj); if (pUser != nullptr) { pContent->messageUser_ = *pUser; @@ -158,7 +158,7 @@ NotificationConversationalContent *NotificationConversationalContent::FromJson(c if (jsonObject.find("messages") != jsonEnd) { nlohmann::json msgsArr = jsonObject.at("messages"); for (auto &msgObj : msgsArr) { - auto pMsg = NotificationJsonConverter::ConvertFromJosn(msgObj); + auto pMsg = NotificationJsonConverter::ConvertFromJson(msgObj); if (pMsg == nullptr) { ANS_LOGE("Failed to parse message "); diff --git a/frameworks/ans/native/src/notification_conversational_message.cpp b/frameworks/ans/native/src/notification_conversational_message.cpp index 520a5fbfca36af631ac6a78b337c3edc8a2b25e2..51d33ed265991280e1fbb6fbebfb278e28c2b6f1 100644 --- a/frameworks/ans/native/src/notification_conversational_message.cpp +++ b/frameworks/ans/native/src/notification_conversational_message.cpp @@ -71,7 +71,7 @@ bool NotificationConversationalMessage::ToJson(nlohmann::json &jsonObject) const jsonObject["text"] = text_; nlohmann::json userObj; - if (!NotificationJsonConverter::ConvertToJosn(&sender_, userObj)) { + if (!NotificationJsonConverter::ConvertToJson(&sender_, userObj)) { ANS_LOGE("Cannot convert sender to JSON"); return false; } @@ -107,7 +107,7 @@ NotificationConversationalMessage *NotificationConversationalMessage::FromJson(c if (jsonObject.find("sender") != jsonEnd) { auto userObj = jsonObject.at("sender"); - auto pUser = NotificationJsonConverter::ConvertFromJosn(userObj); + auto pUser = NotificationJsonConverter::ConvertFromJson(userObj); if (pUser != nullptr) { pMessage->sender_ = *pUser; diff --git a/frameworks/ans/native/src/notification_request.cpp b/frameworks/ans/native/src/notification_request.cpp index 3da864ac845906b5069ba533d9ec59e6ee623ae8..b5dda2871b450dcb57638caef43209f62aeab6fc 100644 --- a/frameworks/ans/native/src/notification_request.cpp +++ b/frameworks/ans/native/src/notification_request.cpp @@ -595,22 +595,22 @@ pid_t NotificationRequest::GetCreatorPid() const return creatorPid_; } -void NotificationRequest::SetCreatorUid(uid_t uid) +void NotificationRequest::SetCreatorUid(int32_t uid) { creatorUid_ = uid; } -uid_t NotificationRequest::GetCreatorUid() const +int32_t NotificationRequest::GetCreatorUid() const { return creatorUid_; } -void NotificationRequest::SetOwnerUid(uid_t uid) +void NotificationRequest::SetOwnerUid(int32_t uid) { ownerUid_ = uid; } -uid_t NotificationRequest::GetOwnerUid() const +int32_t NotificationRequest::GetOwnerUid() const { return ownerUid_; } @@ -1240,8 +1240,8 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel) autoDeletedTime_ = parcel.ReadInt64(); creatorPid_ = static_cast(parcel.ReadInt32()); - creatorUid_ = static_cast(parcel.ReadInt32()); - ownerUid_ = static_cast(parcel.ReadInt32()); + creatorUid_ = parcel.ReadInt32(); + ownerUid_ = parcel.ReadInt32(); creatorUserId_ = parcel.ReadInt32(); ownerUserId_ = parcel.ReadInt32(); receiverUserId_ = parcel.ReadInt32(); @@ -1560,7 +1560,7 @@ bool NotificationRequest::ConvertObjectsToJson(nlohmann::json &jsonObject) const nlohmann::json contentObj; if (notificationContent_) { - if (!NotificationJsonConverter::ConvertToJosn(notificationContent_.get(), contentObj)) { + if (!NotificationJsonConverter::ConvertToJson(notificationContent_.get(), contentObj)) { ANS_LOGE("Cannot convert notificationContent to JSON"); return false; } @@ -1574,7 +1574,7 @@ bool NotificationRequest::ConvertObjectsToJson(nlohmann::json &jsonObject) const } nlohmann::json btnObj; - if (!NotificationJsonConverter::ConvertToJosn(btn.get(), btnObj)) { + if (!NotificationJsonConverter::ConvertToJson(btn.get(), btnObj)) { ANS_LOGE("Cannot convert actionButton to JSON"); return false; } @@ -1594,7 +1594,7 @@ bool NotificationRequest::ConvertObjectsToJson(nlohmann::json &jsonObject) const jsonObject["largeIcon"] = AnsImageUtil::PackImage(bigIcon_); nlohmann::json optObj; - if (!NotificationJsonConverter::ConvertToJosn(&distributedOptions_, optObj)) { + if (!NotificationJsonConverter::ConvertToJson(&distributedOptions_, optObj)) { ANS_LOGE("Cannot convert distributedOptions to JSON"); return false; } @@ -1602,7 +1602,7 @@ bool NotificationRequest::ConvertObjectsToJson(nlohmann::json &jsonObject) const if (notificationFlags_) { nlohmann::json flagsObj; - if (!NotificationJsonConverter::ConvertToJosn(notificationFlags_.get(), flagsObj)) { + if (!NotificationJsonConverter::ConvertToJson(notificationFlags_.get(), flagsObj)) { ANS_LOGE("Cannot convert notificationFlags to JSON"); return false; } @@ -1787,7 +1787,7 @@ bool NotificationRequest::ConvertJsonToNotificationContent( if (jsonObject.find("content") != jsonEnd) { auto contentObj = jsonObject.at("content"); if (!contentObj.is_null()) { - auto pContent = NotificationJsonConverter::ConvertFromJosn(contentObj); + auto pContent = NotificationJsonConverter::ConvertFromJson(contentObj); if (pContent == nullptr) { ANS_LOGE("Failed to parse notification content!"); return false; @@ -1813,7 +1813,7 @@ bool NotificationRequest::ConvertJsonToNotificationActionButton( if (jsonObject.find("actionButtons") != jsonEnd) { auto buttonArr = jsonObject.at("actionButtons"); for (auto &btnObj : buttonArr) { - auto pBtn = NotificationJsonConverter::ConvertFromJosn(btnObj); + auto pBtn = NotificationJsonConverter::ConvertFromJson(btnObj); if (pBtn == nullptr) { ANS_LOGE("Failed to parse actionButton!"); return false; @@ -1839,7 +1839,7 @@ bool NotificationRequest::ConvertJsonToNotificationDistributedOptions( if (jsonObject.find("distributedOptions") != jsonEnd) { auto optObj = jsonObject.at("distributedOptions"); if (!optObj.is_null()) { - auto pOpt = NotificationJsonConverter::ConvertFromJosn(optObj); + auto pOpt = NotificationJsonConverter::ConvertFromJson(optObj); if (pOpt == nullptr) { ANS_LOGE("Failed to parse distributedOptions!"); return false; @@ -1865,7 +1865,7 @@ bool NotificationRequest::ConvertJsonToNotificationFlags( if (jsonObject.find("notificationFlags") != jsonEnd) { auto flagsObj = jsonObject.at("notificationFlags"); if (!flagsObj.is_null()) { - auto pFlags = NotificationJsonConverter::ConvertFromJosn(flagsObj); + auto pFlags = NotificationJsonConverter::ConvertFromJson(flagsObj); if (pFlags == nullptr) { ANS_LOGE("Failed to parse notificationFlags!"); return false; diff --git a/frameworks/ans/test/moduletest/ans_fw_module_test.cpp b/frameworks/ans/test/moduletest/ans_fw_module_test.cpp index e6763424dbb05b7cc00bfb0d7faa15839f19b9b9..d4e0b3a47aad2d4dad5b69aa8e1589f063e376f1 100644 --- a/frameworks/ans/test/moduletest/ans_fw_module_test.cpp +++ b/frameworks/ans/test/moduletest/ans_fw_module_test.cpp @@ -659,7 +659,7 @@ HWTEST_F(AnsFWModuleTest, ANS_FW_MT_FlowControl_00100, Function | MediumTest | L if (i < MAX_ACTIVE_NUM_PERSECOND) { EXPECT_EQ(NotificationHelper::PublishNotification(req), ERR_OK); } else { - EXPECT_EQ(NotificationHelper::PublishNotification(req), (int)ERR_ANS_OVER_MAX_ACITVE_PERSECOND); + EXPECT_EQ(NotificationHelper::PublishNotification(req), (int)ERR_ANS_OVER_MAX_ACTIVE_PERSECOND); } } SleepForFC(); @@ -701,11 +701,11 @@ HWTEST_F(AnsFWModuleTest, ANS_FW_MT_FlowControl_00100, Function | MediumTest | L /** * - * @tc.number : ANS_FW_MT_RemoveNotificaitonsByKey_00100 - * @tc.name : RemoveNotificaitonsByKey_00100 + * @tc.number : ANS_FW_MT_RemoveNotificationsByKey_00100 + * @tc.name : RemoveNotificationsByKey_00100 * @tc.desc : Remove Notification by key. */ -HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificaitonsByKey_00100, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificationsByKey_00100, Function | MediumTest | Level1) { TestAnsSubscriber subscriber; NotificationSubscribeInfo info; @@ -747,11 +747,11 @@ HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificaitonsByKey_00100, Function | M /** * - * @tc.number : ANS_FW_MT_RemoveNotificaitonsByKey_00200 - * @tc.name : RemoveNotificaitonsByKey_00200 + * @tc.number : ANS_FW_MT_RemoveNotificationsByKey_00200 + * @tc.name : RemoveNotificationsByKey_00200 * @tc.desc : Remove Notification by a nonexistent key. */ -HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificaitonsByKey_00200, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificationsByKey_00200, Function | MediumTest | Level1) { TestAnsSubscriber subscriber; NotificationSubscribeInfo info; @@ -790,11 +790,11 @@ HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificaitonsByKey_00200, Function | M /** * - * @tc.number : ANS_FW_MT_RemoveNotificaitons_00100 - * @tc.name : RemoveNotificaitons_00100 + * @tc.number : ANS_FW_MT_RemoveNotifications_00100 + * @tc.name : RemoveNotifications_00100 * @tc.desc : Remove all Notifications. */ -HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificaitons_00100, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotifications_00100, Function | MediumTest | Level1) { TestAnsSubscriber subscriber; NotificationSubscribeInfo info; @@ -840,11 +840,11 @@ HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificaitons_00100, Function | Medium /** * - * @tc.number : ANS_FW_MT_RemoveNotificaitons_00200 - * @tc.name : RemoveNotificaitons_00200 + * @tc.number : ANS_FW_MT_RemoveNotifications_00200 + * @tc.name : RemoveNotifications_00200 * @tc.desc : Remove Notifications when no Notification. */ -HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotificaitons_00200, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_FW_MT_RemoveNotifications_00200, Function | MediumTest | Level1) { EventParser eventParser; TestAnsSubscriber subscriber; @@ -1968,7 +1968,7 @@ HWTEST_F(AnsFWModuleTest, DistributedNotification_Subscribe_00100, Function | Me ANS_LOGI("%{public}s", test_info_->name()); NotificationRequest request = CreateDistributedRequest(test_info_->name()); std::string jsonString; - NotificationJsonConverter::ConvertToJosnString(&request, jsonString); + NotificationJsonConverter::ConvertToJsonString(&request, jsonString); DistributedKv::AppId appId = {.appId = KVSTORE_APP_ID}; DistributedKv::StoreId storeId = {.storeId = KVSTORE_NOTIFICATION_STORE_ID}; @@ -2029,7 +2029,7 @@ HWTEST_F(AnsFWModuleTest, DistributedNotification_Subscribe_00200, Function | Me request.SetOwnerBundleName(APP_NAME); request.SetCreatorBundleName(APP_NAME); std::string jsonString; - NotificationJsonConverter::ConvertToJosnString(&request, jsonString); + NotificationJsonConverter::ConvertToJsonString(&request, jsonString); DistributedKv::AppId appId = {.appId = KVSTORE_APP_ID}; DistributedKv::StoreId storeId = {.storeId = KVSTORE_NOTIFICATION_STORE_ID}; @@ -2244,7 +2244,7 @@ HWTEST_F(AnsFWModuleTest, DefaultRemindPolicy_00500, Function | MediumTest | Lev request.SetCreatorBundleName(APP_NAME); request.SetDevicesSupportDisplay(devices); std::string jsonString; - NotificationJsonConverter::ConvertToJosnString(&request, jsonString); + NotificationJsonConverter::ConvertToJsonString(&request, jsonString); PublishCommonEventScreenStatus(true); @@ -2289,7 +2289,7 @@ HWTEST_F(AnsFWModuleTest, DefaultRemindPolicy_00600, Function | MediumTest | Lev request.SetCreatorBundleName(APP_NAME); request.SetDevicesSupportDisplay(devices); std::string jsonString; - NotificationJsonConverter::ConvertToJosnString(&request, jsonString); + NotificationJsonConverter::ConvertToJsonString(&request, jsonString); PublishCommonEventScreenStatus(false); @@ -2319,7 +2319,7 @@ HWTEST_F(AnsFWModuleTest, DefaultRemindPolicy_00600, Function | MediumTest | Lev } #endif -HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07100, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PublishContinuousTask_07100, Function | MediumTest | Level1) { IPCSkeleton::SetCallingUid(SYSTEM_SERVICE_UID); TestAnsSubscriber subscriber; @@ -2358,7 +2358,7 @@ HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07100, Function IPCSkeleton::SetCallingUid(1); } -HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07200, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PublishContinuousTask_07200, Function | MediumTest | Level1) { IPCSkeleton::SetCallingUid(SYSTEM_SERVICE_UID); TestAnsSubscriber subscriber; @@ -2399,7 +2399,7 @@ HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07200, Function IPCSkeleton::SetCallingUid(1); } -HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07300, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PublishContinuousTask_07300, Function | MediumTest | Level1) { IPCSkeleton::SetCallingUid(SYSTEM_SERVICE_UID); TestAnsSubscriber subscriber; @@ -2439,7 +2439,7 @@ HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07300, Function IPCSkeleton::SetCallingUid(1); } -HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07400, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PublishContinuousTask_07400, Function | MediumTest | Level1) { std::shared_ptr implContent = std::make_shared(); std::shared_ptr content = std::make_shared(implContent); @@ -2449,7 +2449,7 @@ HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07400, Function EXPECT_EQ(NotificationHelper::PublishContinuousTaskNotification(req), (int)ERR_ANS_NOT_SYSTEM_SERVICE); } -HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07500, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PublishContinuousTask_07500, Function | MediumTest | Level1) { TestAnsSubscriber subscriber; NotificationSubscribeInfo info; @@ -2485,7 +2485,7 @@ HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07500, Function SleepForFC(); } -HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07600, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PublishContinuousTask_07600, Function | MediumTest | Level1) { IPCSkeleton::SetCallingUid(SYSTEM_SERVICE_UID); TestAnsSubscriber subscriber; @@ -2515,7 +2515,7 @@ HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07600, Function IPCSkeleton::SetCallingUid(1); } -HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07700, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PublishContinuousTask_07700, Function | MediumTest | Level1) { IPCSkeleton::SetCallingUid(SYSTEM_SERVICE_UID); TestAnsSubscriber subscriber; @@ -2557,7 +2557,7 @@ HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07700, Function IPCSkeleton::SetCallingUid(1); } -HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PulbishContinuousTask_07800, Function | MediumTest | Level1) +HWTEST_F(AnsFWModuleTest, ANS_Interface_MT_PublishContinuousTask_07800, Function | MediumTest | Level1) { IPCSkeleton::SetCallingUid(SYSTEM_SERVICE_UID); TestAnsSubscriber subscriber; diff --git a/frameworks/ans/test/moduletest/ans_innerkits_module_publish_test.cpp b/frameworks/ans/test/moduletest/ans_innerkits_module_publish_test.cpp index 518b0dbff6171ccbf82af810f530bbd9371813ce..dbfa0dfb0f3a6d678c624d13e7ec9420d63ebfd5 100644 --- a/frameworks/ans/test/moduletest/ans_innerkits_module_publish_test.cpp +++ b/frameworks/ans/test/moduletest/ans_innerkits_module_publish_test.cpp @@ -501,34 +501,34 @@ void AnsInterfaceModulePublishTest::WaitOnUnsubscribeResult() void AnsInterfaceModulePublishTest::CheckJsonConverter(const NotificationRequest *request) { nlohmann::json jsonObject; - auto ret0 = NotificationJsonConverter::ConvertToJosn(request, jsonObject); + auto ret0 = NotificationJsonConverter::ConvertToJson(request, jsonObject); EXPECT_EQ(ret0, true); - GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertToJosn object dump ==========>" << jsonObject.dump(); + GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertToJson object dump ==========>" << jsonObject.dump(); std::string jsonString; - auto ret1 = NotificationJsonConverter::ConvertToJosnString(request, jsonString); - GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertToJosnString ret1 ==========>" + auto ret1 = NotificationJsonConverter::ConvertToJsonString(request, jsonString); + GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertToJsonString ret1 ==========>" << (ret1 ? "true" : "false"); EXPECT_EQ(ret1, true); - GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertToJosnString string ==========>" << jsonString; + GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertToJsonString string ==========>" << jsonString; GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::convert Json sleep start ==========>"; sleep(SLEEP_TIME); GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::convert Json sleep end ==========>"; - auto pRequest1 = NotificationJsonConverter::ConvertFromJosn(jsonObject); + auto pRequest1 = NotificationJsonConverter::ConvertFromJson(jsonObject); EXPECT_NE(pRequest1, nullptr); - GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertFromJosn jsonObject dump request ==========>" + GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertFromJson jsonObject dump request ==========>" << pRequest1->Dump(); - auto pRequest2 = NotificationJsonConverter::ConvertFromJosnString(jsonString); + auto pRequest2 = NotificationJsonConverter::ConvertFromJsonString(jsonString); EXPECT_NE(pRequest2, nullptr); - GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertFromJosnString jsonString dump request ==========>" + GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertFromJsonString jsonString dump request ==========>" << pRequest2->Dump(); nlohmann::json jsonObject2; - auto ret2 = NotificationJsonConverter::ConvertToJosn(pRequest1, jsonObject2); - GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertToJosn ret2 ==========>" << (ret2 ? "true" : "false"); + auto ret2 = NotificationJsonConverter::ConvertToJson(pRequest1, jsonObject2); + GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::ConvertToJson ret2 ==========>" << (ret2 ? "true" : "false"); EXPECT_EQ(ret2, true); GTEST_LOG_(INFO) << "ANS_Interface_MT_Publish_08000::FromJson -> ToJson object dump ==========>" << jsonObject2.dump(); diff --git a/interfaces/innerkits/ans/native/include/notification.h b/interfaces/innerkits/ans/native/include/notification.h index cec3185f24e170600577aef27aa44fd378cf9566..44d81eb44f091417cc94fc50c404d7922b7aa28e 100644 --- a/interfaces/innerkits/ans/native/include/notification.h +++ b/interfaces/innerkits/ans/native/include/notification.h @@ -128,7 +128,7 @@ public: std::string GetKey() const; /** - * @brief Obtains the notificanton request set by ANS. + * @brief Obtains the notification request set by ANS. * * @return Returns NotificationRequest object. */ @@ -153,7 +153,7 @@ public: * * @return Returns the UID of the notification creator. */ - uid_t GetUid() const; + int32_t GetUid() const; /** * @brief Obtains the PID of the notification creator. @@ -248,7 +248,7 @@ private: Notification(); void SetEnableSound(const bool &enable); void SetEnableLight(const bool &enable); - void SetEnableViration(const bool &enable); + void SetEnableVibration(const bool &enable); void SetLedLightColor(const int32_t &color); void SetLockScreenVisbleness(const NotificationConstant::VisiblenessType &visbleness); void SetPostTime(const int64_t &time); @@ -274,7 +274,7 @@ private: private: bool enableSound_ {false}; bool enableLight_ {false}; - bool enableViration_ {false}; + bool enableVibration_ {false}; bool isRemoveAllowed_ {true}; std::string key_ {""}; std::string deviceId_ {""}; diff --git a/interfaces/innerkits/ans/native/include/notification_json_convert.h b/interfaces/innerkits/ans/native/include/notification_json_convert.h index f6754941ac4f53e3fff8cf9f6d712f7d53126dc1..77720da48fdd7da7bd8f76e6fcf912fc9a988ca6 100644 --- a/interfaces/innerkits/ans/native/include/notification_json_convert.h +++ b/interfaces/innerkits/ans/native/include/notification_json_convert.h @@ -42,7 +42,7 @@ public: * @param jsonObject Indicates the json object. * @return Returns true if the conversion is successful; returns false otherwise. */ - static bool ConvertToJosn(const NotificationJsonConvertionBase *convertionBase, nlohmann::json &jsonObject) + static bool ConvertToJson(const NotificationJsonConvertionBase *convertionBase, nlohmann::json &jsonObject) { if (convertionBase == nullptr) { ANS_LOGE("Converter : Invalid base object"); @@ -59,7 +59,7 @@ public: * @param jsonString Indicates the json string. * @return Returns true if the conversion is successful; returns false otherwise. */ - static bool ConvertToJosnString(const NotificationJsonConvertionBase *convertionBase, std::string &jsonString) + static bool ConvertToJsonString(const NotificationJsonConvertionBase *convertionBase, std::string &jsonString) { if (convertionBase == nullptr) { ANS_LOGE("Converter : Invalid base object"); @@ -83,7 +83,7 @@ public: * @return Returns the subclass object. */ template - static T *ConvertFromJosn(const nlohmann::json &jsonObject) + static T *ConvertFromJson(const nlohmann::json &jsonObject) { if (jsonObject.is_null() or !jsonObject.is_object()) { ANS_LOGE("Converter : Invalid JSON object"); @@ -100,7 +100,7 @@ public: * @return Returns the subclass object. */ template - static T *ConvertFromJosnString(const std::string &jsonString) + static T *ConvertFromJsonString(const std::string &jsonString) { if (jsonString.empty()) { ANS_LOGE("Converter : Invalid JSON string"); diff --git a/interfaces/innerkits/ans/native/include/notification_request.h b/interfaces/innerkits/ans/native/include/notification_request.h index ea0e3c723caecd473aead8cb491d2f6b9c2751a0..6b820eee988deeae4a842623541a3223a484bfb1 100644 --- a/interfaces/innerkits/ans/native/include/notification_request.h +++ b/interfaces/innerkits/ans/native/include/notification_request.h @@ -909,28 +909,28 @@ public: * * @param uid Indicates the UID of the notification creator. */ - void SetCreatorUid(uid_t uid); + void SetCreatorUid(int32_t uid); /** * @brief Obtains the UID of the notification creator. * * @return Returns the UID of the notification creator. */ - uid_t GetCreatorUid() const; + int32_t GetCreatorUid() const; /** * @brief Sets the UID of the notification owner. * * @param uid the UID of the notification owner. */ - void SetOwnerUid(uid_t uid); + void SetOwnerUid(int32_t uid); /** * @brief Obtains the UID of the notification owner. * * @return the UID of the notification owner. */ - uid_t GetOwnerUid() const; + int32_t GetOwnerUid() const; /** * @brief Sets the label of this notification. @@ -1144,8 +1144,8 @@ private: int64_t autoDeletedTime_ {0}; pid_t creatorPid_ {0}; - uid_t creatorUid_ {0}; - uid_t ownerUid_ {0}; + int32_t creatorUid_ {0}; + int32_t ownerUid_ {0}; int32_t creatorUserId_ {SUBSCRIBE_USER_INIT}; int32_t ownerUserId_ {SUBSCRIBE_USER_INIT}; int32_t receiverUserId_ {SUBSCRIBE_USER_INIT}; diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 3be93044ceadf6b7447850da106a767077c02b36..226a84d73a736b3deb77ca9cb2063180f0ac5643 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -361,7 +361,7 @@ ErrCode AdvancedNotificationService::AssignToNotificationList(const std::shared_ if (record->request->IsAlertOneTime()) { record->notification->SetEnableLight(false); record->notification->SetEnableSound(false); - record->notification->SetEnableViration(false); + record->notification->SetEnableVibration(false); } UpdateInNotificationList(record); } @@ -1783,7 +1783,7 @@ ErrCode AdvancedNotificationService::PublishContinuousTaskNotification(const spt if (record->request->IsAlertOneTime()) { record->notification->SetEnableLight(false); record->notification->SetEnableSound(false); - record->notification->SetEnableViration(false); + record->notification->SetEnableVibration(false); } UpdateInNotificationList(record); } @@ -2079,7 +2079,7 @@ ErrCode AdvancedNotificationService::FlowControl(const std::shared_ptr= MAX_ACTIVE_NUM_PERSECOND) { - return ERR_ANS_OVER_MAX_ACITVE_PERSECOND; + return ERR_ANS_OVER_MAX_ACTIVE_PERSECOND; } flowControlTimestampList_.push_back(now); @@ -3003,7 +3003,7 @@ void AdvancedNotificationService::OnDistributedUpdate( if (record->request->IsAlertOneTime()) { record->notification->SetEnableLight(false); record->notification->SetEnableSound(false); - record->notification->SetEnableViration(false); + record->notification->SetEnableVibration(false); } UpdateInNotificationList(record); } diff --git a/services/ans/src/notification_slot_filter.cpp b/services/ans/src/notification_slot_filter.cpp index 9b4c59e6dc9bc00b3f4de75f86f22d73978e752d..caabc18d7835ae674173ffe69f475aa5c6278dfe 100644 --- a/services/ans/src/notification_slot_filter.cpp +++ b/services/ans/src/notification_slot_filter.cpp @@ -38,10 +38,10 @@ ErrCode NotificationSlotFilter::OnPublish(const std::shared_ptrslot->CanVibrate()) { - record->notification->SetEnableViration(true); + record->notification->SetEnableVibration(true); record->notification->SetVibrationStyle(record->slot->GetVibrationStyle()); } else { - record->notification->SetEnableViration(false); + record->notification->SetEnableVibration(false); } auto sound = record->slot->GetSound(); diff --git a/services/ans/src/notification_subscriber_manager.cpp b/services/ans/src/notification_subscriber_manager.cpp index 5b5180a73907c684a3dd3d0a62cca332e16e2108..96d85e0a92aabb4ba754332e5e15d42bedc358b4 100644 --- a/services/ans/src/notification_subscriber_manager.cpp +++ b/services/ans/src/notification_subscriber_manager.cpp @@ -76,10 +76,10 @@ ErrCode NotificationSubscriberManager::AddSubscriber( return ERR_ANS_INVALID_PARAM; } - ANS_LOGD("Get userId successed, callingUid = <%{public}d> userId = <%{public}d>", callingUid, userId); + ANS_LOGD("Get userId succeeded, callingUid = <%{public}d> userId = <%{public}d>", callingUid, userId); subInfo->AddAppUserId(userId); } - + ErrCode result = ERR_ANS_TASK_ERR; handler_->PostSyncTask(std::bind([this, &subscriber, &subInfo, &result]() { result = this->AddSubscriberInner(subscriber, subInfo); diff --git a/services/distributed/src/distributed_notification_manager.cpp b/services/distributed/src/distributed_notification_manager.cpp index 7bc78aa8c58927c542418a8db663c06676dc050f..26fb43a8d8eacd32e168442c756ed9144e3b6d87 100644 --- a/services/distributed/src/distributed_notification_manager.cpp +++ b/services/distributed/src/distributed_notification_manager.cpp @@ -143,7 +143,7 @@ void DistributedNotificationManager::OnDatabaseInsert( } sptr request = - NotificationJsonConverter::ConvertFromJosnString(value); + NotificationJsonConverter::ConvertFromJsonString(value); if (request == nullptr) { ANS_LOGE("convert json to request failed. key:%{public}s", key.c_str()); return; @@ -169,7 +169,7 @@ void DistributedNotificationManager::OnDatabaseUpdate( } sptr request = - NotificationJsonConverter::ConvertFromJosnString(value); + NotificationJsonConverter::ConvertFromJsonString(value); if (request == nullptr) { ANS_LOGE("convert json to request failed. key:%{public}s", key.c_str()); return; @@ -284,7 +284,7 @@ ErrCode DistributedNotificationManager::Publish( } std::string value; - if (!NotificationJsonConverter::ConvertToJosnString(request, value)) { + if (!NotificationJsonConverter::ConvertToJsonString(request, value)) { ANS_LOGE("convert request to json failed. key:%{public}s", key.c_str()); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } @@ -308,7 +308,7 @@ ErrCode DistributedNotificationManager::Update( } std::string value; - if (!NotificationJsonConverter::ConvertToJosnString(request, value)) { + if (!NotificationJsonConverter::ConvertToJsonString(request, value)) { ANS_LOGE("convert request to json failed. key:%{public}s", key.c_str()); return ERR_ANS_DISTRIBUTED_OPERATION_FAILED; } @@ -384,7 +384,7 @@ ErrCode DistributedNotificationManager::GetCurrentDistributedNotification( } sptr request = - NotificationJsonConverter::ConvertFromJosnString(index.value.ToString()); + NotificationJsonConverter::ConvertFromJsonString(index.value.ToString()); if (request == nullptr) { ANS_LOGE("convert json to request failed. key:%{public}s", index.key.ToString().c_str()); continue;