diff --git a/frameworks/js/napi/src/common.cpp b/frameworks/js/napi/src/common.cpp index ba1848030f6958b32562574e4532af920c41c51e..a78cf0604c6bf34256a54bfd4360cb8c9ac594b8 100644 --- a/frameworks/js/napi/src/common.cpp +++ b/frameworks/js/napi/src/common.cpp @@ -2779,7 +2779,7 @@ napi_value Common::GetNotificationBasicContentDetailed( NAPI_ASSERT(env, valuetype == napi_string, "Wrong argument type. String expected."); NAPI_CALL(env, napi_get_value_string_utf8(env, value, str, STR_MAX_SIZE - 1, &strLen)); basicContent->SetTitle(str); - ANS_LOGI("normal::title = %{public}s", str); + ANS_LOGD("normal::title = %{public}s", str); // text: string NAPI_CALL(env, napi_has_named_property(env, contentResult, "text", &hasProperty)); @@ -2789,7 +2789,7 @@ napi_value Common::GetNotificationBasicContentDetailed( NAPI_ASSERT(env, valuetype == napi_string, "Wrong argument type. String expected."); NAPI_CALL(env, napi_get_value_string_utf8(env, value, str, STR_MAX_SIZE - 1, &strLen)); basicContent->SetText(str); - ANS_LOGI("normal::text = %{public}s", str); + ANS_LOGD("normal::text = %{public}s", str); // additionalText?: string NAPI_CALL(env, napi_has_named_property(env, contentResult, "additionalText", &hasProperty)); @@ -2862,7 +2862,7 @@ napi_value Common::GetNotificationLongTextContentDetailed( NAPI_ASSERT(env, valuetype == napi_string, "Wrong argument type. String expected."); NAPI_CALL(env, napi_get_value_string_utf8(env, longContentResult, long_str, LONG_STR_MAX_SIZE, &strLen)); longContent->SetLongText(long_str); - ANS_LOGI("longText::longText = %{public}s", long_str); + ANS_LOGD("longText::longText = %{public}s", long_str); // briefText: string NAPI_CALL(env, napi_has_named_property(env, contentResult, "briefText", &hasProperty)); @@ -2872,7 +2872,7 @@ napi_value Common::GetNotificationLongTextContentDetailed( NAPI_ASSERT(env, valuetype == napi_string, "Wrong argument type. String expected."); NAPI_CALL(env, napi_get_value_string_utf8(env, longContentResult, str, STR_MAX_SIZE - 1, &strLen)); longContent->SetBriefText(str); - ANS_LOGI("longText::briefText = %{public}s", str); + ANS_LOGD("longText::briefText = %{public}s", str); // expandedTitle: string NAPI_CALL(env, napi_has_named_property(env, contentResult, "expandedTitle", &hasProperty)); @@ -2882,7 +2882,7 @@ napi_value Common::GetNotificationLongTextContentDetailed( NAPI_ASSERT(env, valuetype == napi_string, "Wrong argument type. String expected."); NAPI_CALL(env, napi_get_value_string_utf8(env, longContentResult, str, STR_MAX_SIZE - 1, &strLen)); longContent->SetExpandedTitle(str); - ANS_LOGI("longText::expandedTitle = %{public}s", str); + ANS_LOGD("longText::expandedTitle = %{public}s", str); return NapiGetNull(env); } @@ -3053,7 +3053,7 @@ napi_value Common::GetNotificationConversationalContentTitle( NAPI_ASSERT(env, valuetype == napi_string, "Wrong argument type. String expected."); NAPI_CALL(env, napi_get_value_string_utf8(env, conversationalContentResult, str, STR_MAX_SIZE - 1, &strLen)); conversationalContent->SetConversationTitle(str); - ANS_LOGI("conversationTitle = %{public}s", str); + ANS_LOGD("conversationTitle = %{public}s", str); return NapiGetNull(env); } @@ -3304,7 +3304,7 @@ napi_value Common::GetMessageUserByBool(const napi_env &env, const napi_value &r bool machine = false; napi_get_value_bool(env, machineResult, &machine); messageUser.SetMachine(machine); - ANS_LOGI("MessageUser::isMachine = %{public}d", machine); + ANS_LOGD("MessageUser::isMachine = %{public}d", machine); // isUserImportant: boolean NAPI_CALL(env, napi_has_named_property(env, result, "isUserImportant", &hasProperty)); @@ -3384,7 +3384,7 @@ napi_value Common::GetNotificationMultiLineContent( NAPI_ASSERT(env, valuetype == napi_string, "Wrong argument type. String expected."); NAPI_CALL(env, napi_get_value_string_utf8(env, multiLineContentResult, str, STR_MAX_SIZE - 1, &strLen)); multiLineContent->SetBriefText(str); - ANS_LOGI("multiLine: briefText = %{public}s", str); + ANS_LOGD("multiLine: briefText = %{public}s", str); // longTitle: string NAPI_CALL(env, napi_has_named_property(env, contentResult, "longTitle", &hasProperty)); @@ -3394,7 +3394,7 @@ napi_value Common::GetNotificationMultiLineContent( NAPI_ASSERT(env, valuetype == napi_string, "Wrong argument type. String expected."); NAPI_CALL(env, napi_get_value_string_utf8(env, multiLineContentResult, str, STR_MAX_SIZE - 1, &strLen)); multiLineContent->SetExpandedTitle(str); - ANS_LOGI("multiLine: longTitle = %{public}s", str); + ANS_LOGD("multiLine: longTitle = %{public}s", str); // lines: Array NAPI_CALL(env, napi_has_named_property(env, contentResult, "lines", &hasProperty)); @@ -3405,6 +3405,7 @@ napi_value Common::GetNotificationMultiLineContent( request.SetContent(std::make_shared(multiLineContent)); + ANS_LOGI("end"); return NapiGetNull(env); } diff --git a/services/ans/src/access_token_helper.cpp b/services/ans/src/access_token_helper.cpp index 881c810d9da8d501e79f6ddf07a765d44cf3a9ff..56c226c69dcd675a042caa05255a4efd49871cf1 100644 --- a/services/ans/src/access_token_helper.cpp +++ b/services/ans/src/access_token_helper.cpp @@ -32,7 +32,7 @@ bool AccessTokenHelper::VerifyCallerPermission( bool AccessTokenHelper::VerifyNativeToken(const AccessTokenID &callerToken) { ATokenTypeEnum tokenType = AccessTokenKit::GetTokenTypeFlag(callerToken); - return tokenType == ATokenTypeEnum::TOKEN_NATIVE; + return (tokenType == ATokenTypeEnum::TOKEN_NATIVE || tokenType == ATokenTypeEnum::TOKEN_SHELL); } bool AccessTokenHelper::IsSystemHap() diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index 8584d950dae5c8b5590e35eaba6200c44a99f396..bd9a13570f0f0beaaee3f338dc2d46eb446b3c99 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -3643,8 +3643,13 @@ ErrCode AdvancedNotificationService::ShellDump(const std::string &cmd, const std std::vector &dumpInfo) { ANS_LOGD("%{public}s", __FUNCTION__); - ErrCode result = ERR_ANS_NOT_ALLOWED; + if (!AccessTokenHelper::VerifyNativeToken(IPCSkeleton::GetCallingTokenID())) { + ANS_LOGE("Not subsystem or shell request"); + return ERR_ANS_NON_SYSTEM_APP; + } + + ErrCode result = ERR_ANS_NOT_ALLOWED; handler_->PostSyncTask(std::bind([&]() { if (cmd == ACTIVE_NOTIFICATION_OPTION) { result = ActiveNotificationDump(bundle, userId, dumpInfo); diff --git a/services/distributed/include/distributed_preferences_info.h b/services/distributed/include/distributed_preferences_info.h index 612b1653d4bae8accdcefb9451dc543785f0cfad..8548fa15175a6a67332f44e192031e56a4cc83b3 100644 --- a/services/distributed/include/distributed_preferences_info.h +++ b/services/distributed/include/distributed_preferences_info.h @@ -78,7 +78,7 @@ public: ErrCode GetSyncEnabledWithoutApp(const int32_t userId, bool &enabled); private: - bool distributedEnable_ = true; + bool distributedEnable_ = false; std::map, bool> bundleEnable_; std::map enabledWithoutApp_; }; diff --git a/services/distributed/src/distributed_device_callback.cpp b/services/distributed/src/distributed_device_callback.cpp index d598507838722597ed9e8218a92eb6b8dbc916b5..92a910f0caa0b888b214cada1f83e1c320e8bf57 100644 --- a/services/distributed/src/distributed_device_callback.cpp +++ b/services/distributed/src/distributed_device_callback.cpp @@ -29,7 +29,7 @@ void DistributedDeviceCallback::OnDeviceChanged( { ANS_LOGI("%{public}s start", __FUNCTION__); if (type == DistributedKv::DeviceChangeType::DEVICE_ONLINE) { - ANS_LOGI("device %{public}s is ONLINE", info.deviceId.c_str()); + ANS_LOGD("device %{public}s is ONLINE", info.deviceId.c_str()); if (callback_.OnConnected) { callback_.OnConnected(info.deviceId); } diff --git a/services/distributed/src/distributed_notification_manager.cpp b/services/distributed/src/distributed_notification_manager.cpp index 460405aab844b1f73adb020fd81cb0ac3187a42c..7228c9b93cd2bc5155ecfcee04227456bbc517de 100644 --- a/services/distributed/src/distributed_notification_manager.cpp +++ b/services/distributed/src/distributed_notification_manager.cpp @@ -134,7 +134,7 @@ void DistributedNotificationManager::OnDatabaseInsert( ANS_LOGD("%{public}s", __FUNCTION__); handler_->PostTask(std::bind([=]() { if (!CheckDeviceId(deviceId, key)) { - ANS_LOGW("device id are not the same. deviceId:%{public}s key:%{public}s", deviceId.c_str(), key.c_str()); + ANS_LOGD("device id are not the same. deviceId:%{public}s key:%{public}s", deviceId.c_str(), key.c_str()); } ResolveKey resolveKey; @@ -160,7 +160,7 @@ void DistributedNotificationManager::OnDatabaseUpdate( ANS_LOGD("%{public}s", __FUNCTION__); handler_->PostTask(std::bind([=]() { if (!CheckDeviceId(deviceId, key)) { - ANS_LOGW("device id are not the same. deviceId:%{public}s key:%{public}s", deviceId.c_str(), key.c_str()); + ANS_LOGD("device id are not the same. deviceId:%{public}s key:%{public}s", deviceId.c_str(), key.c_str()); } ResolveKey resolveKey; @@ -186,7 +186,7 @@ void DistributedNotificationManager::OnDatabaseDelete( ANS_LOGD("%{public}s", __FUNCTION__); handler_->PostTask(std::bind([=]() { if (!CheckDeviceId(deviceId, key)) { - ANS_LOGW("device id are not the same. deviceId:%{public}s key:%{public}s", deviceId.c_str(), key.c_str()); + ANS_LOGD("device id are not the same. deviceId:%{public}s key:%{public}s", deviceId.c_str(), key.c_str()); } ResolveKey resolveKey; diff --git a/services/distributed/src/distributed_screen_status_manager.cpp b/services/distributed/src/distributed_screen_status_manager.cpp index d8b0bd5bc3781aae55760dddf3d7cf8b27bfe8c3..695348a50dd017046bb555be6ca59e7d432e35d7 100644 --- a/services/distributed/src/distributed_screen_status_manager.cpp +++ b/services/distributed/src/distributed_screen_status_manager.cpp @@ -45,7 +45,7 @@ DistributedScreenStatusManager::~DistributedScreenStatusManager() void DistributedScreenStatusManager::OnDeviceConnected(const std::string &deviceId) { - ANS_LOGI("deviceId:%{public}s", deviceId.c_str()); + ANS_LOGD("deviceId:%{public}s", deviceId.c_str()); std::lock_guard lock(mutex_); CheckKvStore(); }