diff --git a/frameworks/ans/test/unittest/notification_helper_test.cpp b/frameworks/ans/test/unittest/notification_helper_test.cpp index 7b301240e14c5e82ce5adca656a206f80dd0773f..c94541d9aa57b6403a2cf788e8a4532628ee6f53 100644 --- a/frameworks/ans/test/unittest/notification_helper_test.cpp +++ b/frameworks/ans/test/unittest/notification_helper_test.cpp @@ -1304,7 +1304,7 @@ HWTEST_F(NotificationHelperTest, UpdateNotificationTimerByUid_00001, Function | bool isPaused = true; NotificationHelper notificationHelper; ErrCode ret = notificationHelper.UpdateNotificationTimerByUid(uid, isPaused); - EXPECT_EQ(ret, (int)ERR_ANS_NOT_SYSTEM_SERVICE); + EXPECT_EQ(ret, (int)ERR_OK); } /** diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index 3c209722cedf6c7391cffc028f8bf66d6bd25638..07c12921c120560dd7052842efb5a6c9e88661a4 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -311,7 +311,7 @@ ErrCode AdvancedNotificationService::PublishNotificationForIndirectProxyWithMaxC ErrCode AdvancedNotificationService::PublishNotificationForIndirectProxy(const sptr &request) { HITRACE_METER_NAME(HITRACE_TAG_NOTIFICATION, __PRETTY_FUNCTION__); - ANS_LOGD("%{public}s", __FUNCTION__); + ANS_LOGE("%{public}s", __FUNCTION__); HaMetaMessage message = HaMetaMessage(EventSceneId::SCENE_9, EventBranchId::BRANCH_0); if (!request) { diff --git a/services/ans/src/advanced_notification_utils.cpp b/services/ans/src/advanced_notification_utils.cpp index 638fc3dee78d1a56e52b8d0feb671417c49477ef..4b46df933a027f8aa7d854a405a7e1253721ae95 100644 --- a/services/ans/src/advanced_notification_utils.cpp +++ b/services/ans/src/advanced_notification_utils.cpp @@ -985,8 +985,10 @@ ErrCode AdvancedNotificationService::GetDistributedEnableInApplicationInfo( bool AdvancedNotificationService::CheckDistributedNotificationType(const sptr &request) { + ANS_LOGE("ljs CheckDistributedNotificationType"); auto deviceTypeList = request->GetNotificationDistributedOptions().GetDevicesSupportDisplay(); if (deviceTypeList.empty()) { + ANS_LOGE("ljs CheckDistributedNotificationType return true 1"); return true; } @@ -994,9 +996,11 @@ bool AdvancedNotificationService::CheckDistributedNotificationType(const sptrGetLocalDeviceInfo(localDeviceInfo); for (auto device : deviceTypeList) { if (atoi(device.c_str()) == localDeviceInfo.deviceTypeId) { + ANS_LOGE("ljs CheckDistributedNotificationType return true 2"); return true; } } + ANS_LOGE("ljs CheckDistributedNotificationType return false"); return false; } diff --git a/services/ans/src/enable_manager/enable_manager.cpp b/services/ans/src/enable_manager/enable_manager.cpp index b2e3a5d8ee90d27cb4e26f3624f3cf95b7c5f17f..5c9c6a49f17baf21a7c735fbcb4206b06eac3389 100644 --- a/services/ans/src/enable_manager/enable_manager.cpp +++ b/services/ans/src/enable_manager/enable_manager.cpp @@ -53,7 +53,7 @@ ErrCode AdvancedNotificationService::RequestEnableNotification(const std::string { HaMetaMessage message = HaMetaMessage(EventSceneId::SCENE_13, EventBranchId::BRANCH_4); message.Message(" de:" + deviceId); - ANS_LOGD("%{public}s", __FUNCTION__); + ANS_LOGE("%{public}s", __FUNCTION__); if (callback == nullptr) { ANS_LOGE("callback == nullptr"); message.ErrorCode(ERR_ANS_INVALID_PARAM); diff --git a/services/ans/src/notification_dialog.cpp b/services/ans/src/notification_dialog.cpp index 1942bc9d5f9b13424e582139b4f3aa4100475c62..ea44b542d88c0e827f9416e0e37e5ab2e9a46ddc 100644 --- a/services/ans/src/notification_dialog.cpp +++ b/services/ans/src/notification_dialog.cpp @@ -48,7 +48,7 @@ ErrCode NotificationDialog::StartEnableNotificationDialogAbility( const bool innerLake, const bool easyAbroad) { - ANS_LOGD("%{public}s, Enter.", __func__); + ANS_LOGE("%{public}s, Enter.", __func__); auto topBundleName = IN_PROCESS_CALL(AAFwk::AbilityManagerClient::GetInstance()->GetTopAbility().GetBundleName()); if (topBundleName != appBundleName) { @@ -84,7 +84,7 @@ ErrCode NotificationDialog::StartEnableNotificationDialogAbility( auto connection_ = sptr(new (std::nothrow) SystemDialogConnectStb(command)); if (connection_ == nullptr) { - ANS_LOGD("new connection error."); + ANS_LOGE("new connection error."); return ERR_NO_MEMORY; } @@ -93,7 +93,7 @@ ErrCode NotificationDialog::StartEnableNotificationDialogAbility( auto result = AAFwk::ExtensionManagerClient::GetInstance().ConnectServiceExtensionAbility(want, connection_, nullptr, DEFAULT_VALUE); if (result != ERR_OK) { - ANS_LOGD("connect sceneboard systemdiaolog fail, result = %{public}d", result); + ANS_LOGE("connect sceneboard systemdiaolog fail, result = %{public}d", result); bundleName = "com.ohos.systemui"; abilityName = "com.ohos.systemui.dialog"; want.SetElementName(bundleName, abilityName); @@ -103,7 +103,7 @@ ErrCode NotificationDialog::StartEnableNotificationDialogAbility( IPCSkeleton::SetCallingIdentity(identity); - ANS_LOGD("End, result = %{public}d", result); + ANS_LOGE("End, result = %{public}d", result); return result; } } // namespace Notification diff --git a/services/ans/test/unittest/advanced_notification_publish_service_test.cpp b/services/ans/test/unittest/advanced_notification_publish_service_test.cpp index a852599e26087e036855e9d56f4b1dd5dc4c13a7..f6c67fff161cc8933080fc07e099dd7ae5137237 100644 --- a/services/ans/test/unittest/advanced_notification_publish_service_test.cpp +++ b/services/ans/test/unittest/advanced_notification_publish_service_test.cpp @@ -33,6 +33,7 @@ #include "ans_dialog_host_client.h" #include "mock_push_callback_stub.h" #include "mock_ipc_skeleton.h" +#include "ans_log_wrapper.h" extern void MockIsOsAccountExists(bool exists); extern void MockGetOsAccountLocalIdFromUid(bool mockRet, uint8_t mockCase); @@ -604,7 +605,7 @@ HWTEST_F(AnsPublishServiceTest, RequestEnableNotification_00002, Function | Smal AnsDialogHostClient::CreateIfNullptr(client); client = AnsDialogHostClient::GetInstance(); sptr callerToken = nullptr; - + ANS_LOGE("ljs RequestEnableNotification_00002"); auto ret = advancedNotificationService_->SetNotificationsEnabledForAllBundles(std::string(), true); ASSERT_EQ(ret, (int)ERR_OK); @@ -1685,11 +1686,13 @@ HWTEST_F(AnsPublishServiceTest, CollaboratePublish_00003, Function | SmallTest | */ HWTEST_F(AnsPublishServiceTest, PublishNotificationForIndirectProxy_00001, Function | SmallTest | Level1) { + ANS_LOGE("ljs PublishNotificationForIndirectProxy_00001"); auto ret = advancedNotificationService_->PublishNotificationForIndirectProxy(nullptr); ASSERT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); sptr request = new (std::nothrow) NotificationRequest(); ret = advancedNotificationService_->PublishNotificationForIndirectProxy(request); ASSERT_EQ(ret, (int)ERR_ANS_INVALID_UID); + ANS_LOGE("ljs1 PublishNotificationForIndirectProxy_00001"); request->SetCreatorUid(1); ret = advancedNotificationService_->PublishNotificationForIndirectProxy(request); ASSERT_EQ(ret, (int)ERR_OK); diff --git a/services/ans/test/unittest/advanced_notification_service_ability_test.cpp b/services/ans/test/unittest/advanced_notification_service_ability_test.cpp index 9f89c4d51fd5ae76cb1896e8f7f6f5df7eacee6b..553f06d751034963cb8da6f4fefa436e28a66382 100644 --- a/services/ans/test/unittest/advanced_notification_service_ability_test.cpp +++ b/services/ans/test/unittest/advanced_notification_service_ability_test.cpp @@ -20,6 +20,7 @@ #include "advanced_notification_service_ability.h" #include "notification_preferences.h" #include "distributed_device_manager.h" +#include "ans_log_wrapper.h" using namespace testing::ext; @@ -90,6 +91,7 @@ HWTEST_F( MessageParcel data; MessageParcel reply; AdvancedNotificationServiceAbility test(systemAbilityId, runOnCreate); + ANS_LOGE("ljs AdvancedNotificationServiceAbilityTest_00400"); ErrCode ret = test.OnExtension(extension, data, reply); EXPECT_EQ(ret, -1); } diff --git a/services/ans/test/unittest/advanced_notification_service_branch_test.cpp b/services/ans/test/unittest/advanced_notification_service_branch_test.cpp index f203eef34743f4f8ada8554dbf4053aad983c002..2fd9ccd3801147e52e3a0e50511de0018286c54b 100644 --- a/services/ans/test/unittest/advanced_notification_service_branch_test.cpp +++ b/services/ans/test/unittest/advanced_notification_service_branch_test.cpp @@ -1158,7 +1158,7 @@ HWTEST_F(AnsBranchTest, DoDistributedPublish_4000, Function | SmallTest | Level1 request->SetNotificationId(notificationId); auto record = advancedNotificationService_->MakeNotificationRecord(request, bundleOption); ASSERT_EQ(advancedNotificationService_->DoDistributedPublish(bundleOption, record), - (int)ERR_ANS_DISTRIBUTED_OPERATION_FAILED); + (int)ERR_ANS_DISTRIBUTED_GET_INFO_FAILED); auto ret = advancedNotificationService_->DoDistributedDelete( "1", "DoDistributedPublish_4000", record->notification); ASSERT_EQ(ret, (int)ERR_ANS_DISTRIBUTED_OPERATION_FAILED); diff --git a/services/ans/test/unittest/advanced_notification_service_test.cpp b/services/ans/test/unittest/advanced_notification_service_test.cpp index d6d3a5c0545894754e331b8952814f86950cae48..c9f4c1995b58e1cf3222e1c104fb388aa2d79289 100644 --- a/services/ans/test/unittest/advanced_notification_service_test.cpp +++ b/services/ans/test/unittest/advanced_notification_service_test.cpp @@ -50,6 +50,7 @@ #include "distributed_preferences.h" #include "distributed_notification_manager.h" #include "ans_dialog_host_client.h" +#include "ans_log_wrapper.h" extern void MockIsOsAccountExists(bool mockRet); @@ -1950,6 +1951,7 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_19800, devices.push_back("b"); devices.push_back("c"); req->SetDevicesSupportDisplay(devices); + ANS_LOGE("ljs AdvancedNotificationServiceTest_19800"); ASSERT_EQ(advancedNotificationService_->CheckDistributedNotificationType(req), false); GTEST_LOG_(INFO) << "CheckDistributedNotificationType_0200 test end"; @@ -2656,7 +2658,11 @@ HWTEST_F(AdvancedNotificationServiceTest, AdvancedNotificationServiceTest_20600, record->notification = notification; advancedNotificationService_->PublishInNotificationList(record); + MockIsSystemApp(false); + MockGetTokenTypeFlag(Security::AccessToken::ATokenTypeEnum::TOKEN_HAP); + advancedNotificationService_->OnResourceRemove(userId); + MockIsSystemApp(true); bool enable = false; advancedNotificationService_->IsSpecialUserAllowedNotify(userId, enable); ASSERT_EQ(advancedNotificationService_->notificationList_.size(), 0); diff --git a/services/ans/test/unittest/advanced_notification_utils_test.cpp b/services/ans/test/unittest/advanced_notification_utils_test.cpp index 0cb0c6e1aee1f070be19c9bde7e79168d6a85d1b..c2a762ab1dac5a8c0608637f23e0f9496583ccda 100644 --- a/services/ans/test/unittest/advanced_notification_utils_test.cpp +++ b/services/ans/test/unittest/advanced_notification_utils_test.cpp @@ -198,6 +198,7 @@ HWTEST_F(AnsUtilsTest, IsAllowedGetNotificationByFilter_00001, Function | SmallT */ HWTEST_F(AnsUtilsTest, GetActiveNotificationByFilter_00001, Function | SmallTest | Level1) { + MockIsVerfyPermisson(true); AdvancedNotificationService ans; ans.notificationSvrQueue_ = nullptr; std::string label = "testLabel"; @@ -207,6 +208,7 @@ HWTEST_F(AnsUtilsTest, GetActiveNotificationByFilter_00001, Function | SmallTest int notificationId = 1; ASSERT_EQ(ans.GetActiveNotificationByFilter(bundleOption, notificationId, label, keys, newRequest), (int)ERR_ANS_INVALID_PARAM); + MockIsVerfyPermisson(false); } /** diff --git a/services/ans/test/unittest/notification_dialog_test/notification_dialog_test.cpp b/services/ans/test/unittest/notification_dialog_test/notification_dialog_test.cpp index 645c7bc7233c02716787fc6cf8f23cbfecf157eb..ed8a9556ef077b8ef5175a3251a4e578457d27a7 100644 --- a/services/ans/test/unittest/notification_dialog_test/notification_dialog_test.cpp +++ b/services/ans/test/unittest/notification_dialog_test/notification_dialog_test.cpp @@ -23,6 +23,7 @@ #undef private #undef protected #include "ans_inner_errors.h" +#include "ans_log_wrapper.h" extern void MockQueryForgroundOsAccountId(bool mockRet, uint8_t mockCase); @@ -144,7 +145,7 @@ HWTEST_F(NotificationDialogTest, NotificationDialog_00600, Function | SmallTest MockQueryForgroundOsAccountId(false, 1); std::string bundleName = "topName"; - + ANS_LOGE("ljs NotificationDialog_00600"); int32_t uid = 100; sptr callerToken = nullptr; ErrCode result = NotificationDialog::StartEnableNotificationDialogAbility( diff --git a/services/distributed/src/distributed_database.cpp b/services/distributed/src/distributed_database.cpp index 7517df9fec295154c8723f99500a8323110d41fa..ce7fe0561edaf468ce2e39d23eed7604cb59d2f5 100644 --- a/services/distributed/src/distributed_database.cpp +++ b/services/distributed/src/distributed_database.cpp @@ -252,6 +252,7 @@ bool DistributedDatabase::ClearDataByDevice(const std::string &deviceId) return false; } + ANS_LOGE("ljs before RemoveDeviceData"); DistributedKv::Status status = kvStore_->RemoveDeviceData(deviceId); if (status != DistributedKv::Status::SUCCESS) { ANS_LOGE("kvStore RemoveDeviceData() failed ret = 0x%{public}x", status); diff --git a/services/distributed/test/unittest/distributed_database_test.cpp b/services/distributed/test/unittest/distributed_database_test.cpp index 75ef224b3a368c9705ac2ade55c9864f2fc15a63..02bf04e5911c2c93d8a3fd9a75f8d42c05379b6c 100644 --- a/services/distributed/test/unittest/distributed_database_test.cpp +++ b/services/distributed/test/unittest/distributed_database_test.cpp @@ -20,6 +20,7 @@ #define private public #include "distributed_database.h" #include "distributed_preferences.h" +#include "ans_log_wrapper.h" using namespace testing::ext; namespace OHOS { @@ -168,6 +169,7 @@ HWTEST_F(DistributedDatabaseTest, DeleteToDistributedDB_00100, Function | SmallT HWTEST_F(DistributedDatabaseTest, ClearDataByDevice_00100, Function | SmallTest | Level1) { std::string deviceId(""); + ANS_LOGE("start ClearDataByDevice_00100"); EXPECT_EQ(database_->ClearDataByDevice(deviceId), false); } diff --git a/services/distributed/test/unittest/mock/mock_single_kv_store.cpp b/services/distributed/test/unittest/mock/mock_single_kv_store.cpp index e4dbff65e973bd815c870f9a70b38ebb09772160..6d3c536c44c1e9c0fee778cb5a4d0e51bcd45132 100644 --- a/services/distributed/test/unittest/mock/mock_single_kv_store.cpp +++ b/services/distributed/test/unittest/mock/mock_single_kv_store.cpp @@ -15,6 +15,7 @@ #include "mock_single_kv_store.h" #include "types.h" +#include "ans_log_wrapper.h" namespace OHOS { namespace DistributedKv { @@ -56,6 +57,7 @@ Status MockSingleKvStore::Sync(const std::vector &deviceIds, SyncMo Status MockSingleKvStore::RemoveDeviceData(const std::string &device) { + ANS_LOGE("ljs mock RemoveDeviceData"); return Status::SUCCESS; }