diff --git a/common/BUILD.gn b/common/BUILD.gn index b27d594d9d0b220aa2b742046832c990fe5626b5..de5326d3d1d55cbe735e0b016e349a270e3028eb 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -35,7 +35,6 @@ ohos_shared_library("distributed_screen_utils") { sources = [ "src/dscreen_hisysevent.cpp", "src/dscreen_json_util.cpp", - "src/dscreen_log.cpp", "src/dscreen_util.cpp", ] diff --git a/common/include/dscreen_log.h b/common/include/dscreen_log.h index 97928b57ad2a93371348c1e6b967aec2a5faf00e..3bd789a2a643ca6cd50bb24431f52888307112f3 100644 --- a/common/include/dscreen_log.h +++ b/common/include/dscreen_log.h @@ -17,28 +17,26 @@ #define OHOS_DSCREEN_LOG_H #include + +#include "hilog/log.h" +#include + namespace OHOS { namespace DistributedHardware { -typedef enum { - DH_LOG_DEBUG, - DH_LOG_INFO, - DH_LOG_WARN, - DH_LOG_ERROR, -} DHLogLevel; - -void DHLog(DHLogLevel logLevel, const char *fmt, ...); +#undef LOG_TAG +#define LOG_TAG "DSCREEN" -#define DHLOGD(fmt, ...) DHLog( \ - DH_LOG_DEBUG, (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) +#define DHLOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, \ + "[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__) -#define DHLOGI(fmt, ...) DHLog( \ - DH_LOG_INFO, (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) +#define DHLOGI(fmt, ...) HILOG_INFO(LOG_CORE, \ + "[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__) -#define DHLOGW(fmt, ...) DHLog( \ - DH_LOG_WARN, (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) +#define DHLOGW(fmt, ...) HILOG_WARN(LOG_CORE, \ + "[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__) -#define DHLOGE(fmt, ...) DHLog( \ - DH_LOG_ERROR, (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "]:" + fmt).c_str(), ##__VA_ARGS__) +#define DHLOGE(fmt, ...) HILOG_ERROR(LOG_CORE, \ + "[%{public}s][%{public}s]:" fmt, DH_LOG_TAG, __FUNCTION__, ##__VA_ARGS__) } // namespace DistributedHardware } // namespace OHOS #endif \ No newline at end of file diff --git a/common/src/dscreen_hisysevent.cpp b/common/src/dscreen_hisysevent.cpp index ccedffe47827e17bab9fe51589a8b70f2b6b37a5..40f40cf8971d631c8bde84b826ea22ac820cb347 100644 --- a/common/src/dscreen_hisysevent.cpp +++ b/common/src/dscreen_hisysevent.cpp @@ -32,7 +32,7 @@ void ReportSaFail(const std::string &eventName, int32_t errCode, int32_t saId, c "SAID", saId, "MSG", errMsg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%" PRId32, res); + DHLOGE("Write HiSysEvent error, res:%{public}" PRId32, res); } } @@ -43,7 +43,7 @@ void ReportRegisterFail(const std::string &eventName, int32_t errCode, const std OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, "ERRCODE", errCode, "DEVID", devId, "DHID", dhId, "MSG", errMsg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%" PRId32, res); + DHLOGE("Write HiSysEvent error, res:%{public}" PRId32, res); } } @@ -59,7 +59,7 @@ void ReportUnRegisterFail(const std::string &eventName, int32_t errCode, const s "DHID", dhId, "MSG", errMsg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%" PRId32, res); + DHLOGE("Write HiSysEvent error, res:%{public}" PRId32, res); } } @@ -72,7 +72,7 @@ void ReportOptFail(const std::string &eventName, int32_t errCode, const std::str "ERRCODE", errCode, "MSG", errMsg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%" PRId32, res); + DHLOGE("Write HiSysEvent error, res:%{public}" PRId32, res); } } @@ -85,7 +85,7 @@ void ReportSaEvent(const std::string &eventName, int32_t saId, const std::string "SAID", saId, "MSG", errMsg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%" PRId32, res); + DHLOGE("Write HiSysEvent error, res:%{public}" PRId32, res); } } @@ -96,7 +96,7 @@ void ReportRegisterScreenEvent(const std::string &eventName, const std::string & OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "DEVID", devId, "DHID", dhId, "MSG", errMsg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%" PRId32, res); + DHLOGE("Write HiSysEvent error, res:%{public}" PRId32, res); } } @@ -107,7 +107,7 @@ void ReportUnRegisterScreenEvent(const std::string &eventName, const std::string OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "DEVID", devId, "DHID", dhId, "MSG", errMsg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%" PRId32, res); + DHLOGE("Write HiSysEvent error, res:%{public}" PRId32, res); } } @@ -122,7 +122,7 @@ void ReportScreenMirrorEvent(const std::string &eventName, const std::string &de "DHID", dhId, "MSG", errMsg); if (res != DH_SUCCESS) { - DHLOGE("Write HiSysEvent error, res:%" PRId32, res); + DHLOGE("Write HiSysEvent error, res:%{public}" PRId32, res); } } } // namespace DistributedHardware diff --git a/common/src/dscreen_json_util.cpp b/common/src/dscreen_json_util.cpp index 0c8b5f7ef56c3f06153ee1b20a03587635178fcf..b192dab7be9bbb26c65e6d53a6223ec34d698ee4 100644 --- a/common/src/dscreen_json_util.cpp +++ b/common/src/dscreen_json_util.cpp @@ -24,7 +24,7 @@ bool IsString(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_string() && jsonObj[key].size() <= MAX_MESSAGES_LEN; if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } @@ -33,7 +33,7 @@ bool IsUInt8(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT8_MAX; if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } @@ -43,7 +43,7 @@ bool IsInt32(const nlohmann::json &jsonObj, const std::string &key) bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && jsonObj[key] >= INT32_MIN && jsonObj[key] <= INT32_MAX; if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } @@ -52,7 +52,7 @@ bool IsUInt32(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT32_MAX; if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } @@ -62,7 +62,7 @@ bool IsInt64(const nlohmann::json &jsonObj, const std::string &key) bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && jsonObj[key] >= INT64_MIN && jsonObj[key] <= INT64_MAX; if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } @@ -71,7 +71,7 @@ bool IsUInt64(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT64_MAX; if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } @@ -80,7 +80,7 @@ bool IsFloat(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_float(); if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } @@ -89,7 +89,7 @@ bool IsArray(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_array(); if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } @@ -98,7 +98,7 @@ bool IsBool(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_boolean(); if (!res) { - DHLOGE("the key %s in jsonObj is invalid.", key.c_str()); + DHLOGE("the key %{public}s in jsonObj is invalid.", key.c_str()); } return res; } diff --git a/common/src/dscreen_log.cpp b/common/src/dscreen_log.cpp deleted file mode 100644 index 7214cfb920be8efbec287a2d7cd6984ae3d6489b..0000000000000000000000000000000000000000 --- a/common/src/dscreen_log.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "dscreen_log.h" - -#include "securec.h" - -#ifdef HI_LOG_ENABLE -#include "hilog/log.h" -#else -#include -#endif - -#include "dscreen_constants.h" - -namespace OHOS { -namespace DistributedHardware { -static void DHLogOut(DHLogLevel logLevel, const char *logBuf) -{ -#ifdef HI_LOG_ENABLE - LogLevel hiLogLevel = LOG_INFO; - switch (logLevel) { - case DH_LOG_DEBUG: - hiLogLevel = LOG_DEBUG; - break; - case DH_LOG_INFO: - hiLogLevel = LOG_INFO; - break; - case DH_LOG_WARN: - hiLogLevel = LOG_WARN; - break; - case DH_LOG_ERROR: - hiLogLevel = LOG_ERROR; - break; - default: - break; - } - (void)HiLogPrint(LOG_CORE, hiLogLevel, LOG_DOMAIN, DSCREEN_LOG_TITLE_TAG.c_str(), "%{public}s", logBuf); -#else - switch (logLevel) { - case DH_LOG_DEBUG: - printf("[D]%s\n", logBuf); - break; - case DH_LOG_INFO: - printf("[I]%s\n", logBuf); - break; - case DH_LOG_WARN: - printf("[W]%s\n", logBuf); - break; - case DH_LOG_ERROR: - printf("[E]%s\n", logBuf); - break; - default: - break; - } -#endif -} - -void DHLog(DHLogLevel logLevel, const char *fmt, ...) -{ - char logBuf[DSCREEN_MAX_LEN] = {0}; - va_list arg; - - (void)memset_s(&arg, sizeof(va_list), 0, sizeof(va_list)); - va_start(arg, fmt); - int32_t result = vsprintf_s(logBuf, sizeof(logBuf), fmt, arg); - va_end(arg); - if (result < 0) { - DHLogOut(logLevel, "DH log length error."); - return; - } - DHLogOut(logLevel, logBuf); -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/common/src/dscreen_util.cpp b/common/src/dscreen_util.cpp index 260ebfb9af8c374109ae2832b223d1ff5b8a4abb..e0836d3968f8a0cb006000431b3282fa3c8c0fb1 100644 --- a/common/src/dscreen_util.cpp +++ b/common/src/dscreen_util.cpp @@ -47,7 +47,7 @@ int32_t GetLocalDeviceNetworkId(std::string &networkId) NodeBasicInfo basicInfo = { { 0 } }; int32_t ret = GetLocalNodeDeviceInfo(PKG_NAME.c_str(), &basicInfo); if (ret != DH_SUCCESS) { - DHLOGE("GetLocalDeviceNetworkId failed ret: %" PRId32, ret); + DHLOGE("GetLocalDeviceNetworkId failed ret: %{public}" PRId32, ret); return ret; } @@ -128,10 +128,10 @@ bool IsPartialRefreshEnabled() char tempValue[SYSTEM_PARAM_VALUE_SIZE] = {0}; auto ret = GetParameter(PARTIAL_REFRESH_PARAM, "-1", tempValue, sizeof(tempValue)); if (ret <= 0) { - DHLOGE("get system parameter (dscreen.partial.refresh.enable) failed, ret=%" PRId32, ret); + DHLOGE("get system parameter (dscreen.partial.refresh.enable) failed, ret=%{public}" PRId32, ret); return false; } - DHLOGI("get system parameter (dscreen.partial.refresh.enable) success, param value = %s", tempValue); + DHLOGI("get system parameter (dscreen.partial.refresh.enable) success, param value = %{public}s", tempValue); return (std::atoi(tempValue) == PARTIAL_REFRESH_ENABLED_VALUE); } diff --git a/common/test/unittest/BUILD.gn b/common/test/unittest/BUILD.gn index b37c0c2c433446e16c06e5d71b54b6eb37da2973..7204ccb4da5014fe6dc24ccb4d49c9979134fb92 100644 --- a/common/test/unittest/BUILD.gn +++ b/common/test/unittest/BUILD.gn @@ -36,7 +36,6 @@ ohos_unittest("ScreenCommonTest") { sources = [ "${common_path}/src/dscreen_hisysevent.cpp", - "${common_path}/src/dscreen_log.cpp", "${common_path}/src/dscreen_util.cpp", "${common_path}/test/unittest/src/screen_common_test.cpp", ] diff --git a/interfaces/innerkits/native_cpp/screen_sink/BUILD.gn b/interfaces/innerkits/native_cpp/screen_sink/BUILD.gn index 4f131e75ac96e878598aad0c719627b2b91a24df..2a524ff23017902248e1d863fa4458dc494ea813 100644 --- a/interfaces/innerkits/native_cpp/screen_sink/BUILD.gn +++ b/interfaces/innerkits/native_cpp/screen_sink/BUILD.gn @@ -50,6 +50,7 @@ ohos_shared_library("distributed_screen_sink_sdk") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", "samgr:samgr_proxy", diff --git a/interfaces/innerkits/native_cpp/screen_sink/src/callback/dscreen_sink_load_callback.cpp b/interfaces/innerkits/native_cpp/screen_sink/src/callback/dscreen_sink_load_callback.cpp index 625212111e16e4886958760a282e444946a95d30..1c8fd77a9be04f0564a8687e66d980e92a8c5c55 100644 --- a/interfaces/innerkits/native_cpp/screen_sink/src/callback/dscreen_sink_load_callback.cpp +++ b/interfaces/innerkits/native_cpp/screen_sink/src/callback/dscreen_sink_load_callback.cpp @@ -30,7 +30,7 @@ DScreenSinkLoadCallback::DScreenSinkLoadCallback( void DScreenSinkLoadCallback::OnLoadSystemAbilitySuccess( int32_t systemAbilityId, const sptr &remoteObject) { - DHLOGI("load screen SA success, systemAbilityId:%" PRId32 ", remoteObject result:%s", + DHLOGI("load screen SA success, systemAbilityId:%{public}" PRId32 ", remoteObject result:%{public}s", systemAbilityId, (remoteObject != nullptr) ? "true" : "false"); if (systemAbilityId != DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID) { DHLOGE("start systemabilityId is not sinkSAId!"); @@ -46,7 +46,7 @@ void DScreenSinkLoadCallback::OnLoadSystemAbilitySuccess( void DScreenSinkLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) { - DHLOGE("load screen SA failed, systemAbilityId: %" PRId32, systemAbilityId); + DHLOGE("load screen SA failed, systemAbilityId: %{public}" PRId32, systemAbilityId); ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT, systemAbilityId, "dscreen sink OnLoadSystemAbilityFail."); } diff --git a/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp b/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp index e537ec5d5509c16a9687a77afc868487cefa48b0..b13d6b77c8a4f7be905d303717a323f9cc4f2830 100644 --- a/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp +++ b/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp @@ -77,7 +77,7 @@ int32_t DScreenSinkHandler::InitSink(const std::string ¶ms) StartTrace(DSCREEN_HITRACE_LABEL, DSCREEN_SINK_LOAD_SYSTEM_ABILITY_START); int32_t ret = samgr->LoadSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, loadCallback); if (ret != ERR_OK) { - DHLOGE("Failed to Load systemAbility, systemAbilityId:%" PRId32 ", ret code:%" PRId32, + DHLOGE("Failed to Load systemAbility, systemAbilityId:%{public}" PRId32 ", ret code:%{public}" PRId32, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, ret); ReportSaFail(DSCREEN_INIT_FAIL, ret, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, "dscreen sink LoadSystemAbility call failed."); @@ -139,7 +139,7 @@ int32_t DScreenSinkHandler::ReleaseSink() int32_t DScreenSinkHandler::SubscribeLocalHardware(const std::string &dhId, const std::string ¶m) { - DHLOGI("DScreenSinkHandler SubscribeLocalHardware dhId: %s", GetAnonyString(dhId).c_str()); + DHLOGI("DScreenSinkHandler SubscribeLocalHardware dhId: %{public}s", GetAnonyString(dhId).c_str()); std::lock_guard lock(proxyMutex_); if (dScreenSinkProxy_ == nullptr) { DHLOGE("screen sink proxy not init."); @@ -151,7 +151,7 @@ int32_t DScreenSinkHandler::SubscribeLocalHardware(const std::string &dhId, cons int32_t DScreenSinkHandler::UnsubscribeLocalHardware(const std::string &dhId) { - DHLOGI("DScreenSinkHandler UnsubscribeLocalHardware dhId: %s", GetAnonyString(dhId).c_str()); + DHLOGI("DScreenSinkHandler UnsubscribeLocalHardware dhId: %{public}s", GetAnonyString(dhId).c_str()); std::lock_guard lock(proxyMutex_); if (dScreenSinkProxy_ == nullptr) { DHLOGE("screen sink proxy not init."); diff --git a/interfaces/innerkits/native_cpp/screen_source/BUILD.gn b/interfaces/innerkits/native_cpp/screen_source/BUILD.gn index f3a7f10e6d977c07955a2c8ed83f02f7879feb3c..e6f944abf8bd823cfb8945973cdf8c9838e09bdd 100644 --- a/interfaces/innerkits/native_cpp/screen_source/BUILD.gn +++ b/interfaces/innerkits/native_cpp/screen_source/BUILD.gn @@ -52,6 +52,7 @@ ohos_shared_library("distributed_screen_source_sdk") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", "samgr:samgr_proxy", diff --git a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback.cpp b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback.cpp index 2af5d905d1552d256e0671ae5b800601184c88c1..b2ad88a0f35eb6308cdba819287e2393ccb324e1 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback.cpp @@ -24,7 +24,7 @@ namespace DistributedHardware { int32_t DScreenSourceCallback::OnNotifyRegResult(const std::string &devId, const std::string &dhId, const std::string &reqId, int32_t status, const std::string &data) { - DHLOGI("DScreenSourceCallback OnNotifyRegResult devId: %s dhId: %s status: %" PRId32, + DHLOGI("DScreenSourceCallback OnNotifyRegResult devId: %{public}s dhId: %{public}s status: %{public}" PRId32, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), status); std::lock_guard lock(registerMutex_); const auto iter = registerCallbackMap_.find(reqId); @@ -44,7 +44,7 @@ int32_t DScreenSourceCallback::OnNotifyRegResult(const std::string &devId, const int32_t DScreenSourceCallback::OnNotifyUnregResult(const std::string &devId, const std::string &dhId, const std::string &reqId, int32_t status, const std::string &data) { - DHLOGI("DScreenSourceCallback OnNotifyUnregResult devId: %s dhId: %s status: %" PRId32, + DHLOGI("DScreenSourceCallback OnNotifyUnregResult devId: %{public}s dhId: %{public}s status: %{public}" PRId32, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), status); std::lock_guard lock(unregisterMutex_); const auto iter = unregisterCallbackMap_.find(reqId); diff --git a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_load_callback.cpp b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_load_callback.cpp index e2977afe5319cb3603c95e7d5c11c185f3d5d7d2..190fdc8b36c4f0fadc2b9e7ad20e191417820c09 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_load_callback.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_load_callback.cpp @@ -27,7 +27,7 @@ namespace DistributedHardware { void DScreenSourceLoadCallback::OnLoadSystemAbilitySuccess( int32_t systemAbilityId, const sptr &remoteObject) { - DHLOGI("load screen SA success, systemAbilityId:%," PRId32 " remoteObject result:%s", + DHLOGI("load screen SA success, systemAbilityId:%{public}" PRId32 ", remoteObject result:%{public}s", systemAbilityId, (remoteObject != nullptr) ? "true" : "false"); if (systemAbilityId != DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID) { DHLOGE("start systemabilityId is not sourceSAId!"); @@ -42,7 +42,7 @@ void DScreenSourceLoadCallback::OnLoadSystemAbilitySuccess( void DScreenSourceLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) { - DHLOGE("load screen SA failed, systemAbilityId:%" PRId32, systemAbilityId); + DHLOGE("load screen SA failed, systemAbilityId:%{public}" PRId32, systemAbilityId); ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SOURCEPROXY_NOT_INIT, systemAbilityId, "dscreen source OnLoadSystemAbilityFail."); } diff --git a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp index 4b14d84d1043141afb9f652d2831bd3268f3b9aa..d9cefe26cae9ef9976156b47a88c278557c8d006 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp @@ -72,7 +72,7 @@ int32_t DScreenSourceHandler::InitSource(const std::string ¶ms) StartTrace(DSCREEN_HITRACE_LABEL, DSCREEN_SOURCE_LOAD_SYSTEM_ABILITY_START); int32_t ret = samgr->LoadSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, loadCallback); if (ret != ERR_OK) { - DHLOGE("Failed to Load systemAbility, systemAbilityId:%" PRId32 ", ret code:%" PRId32, + DHLOGE("Failed to Load systemAbility, systemAbilityId:%{public}" PRId32 ", ret code:%{public}" PRId32, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, ret); ReportSaFail(DSCREEN_INIT_FAIL, ret, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, "dscreen source LoadSystemAbility call failed."); @@ -148,7 +148,7 @@ int32_t DScreenSourceHandler::RegisterDistributedHardware(const std::string &dev DHLOGE("callback is nullptr."); return ERR_DH_SCREEN_REGISTER_CALLBACK_NOT_INIT; } - DHLOGI("RegisterDistributedHardware, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), + DHLOGI("RegisterDistributedHardware, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); std::lock_guard lock(proxyMutex_); if (dScreenSourceProxy_ == nullptr) { @@ -176,7 +176,7 @@ int32_t DScreenSourceHandler::UnregisterDistributedHardware(const std::string &d DHLOGE("callback is nullptr."); return ERR_DH_SCREEN_REGISTER_CALLBACK_NOT_INIT; } - DHLOGI("UnregisterDistributedHardware, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), + DHLOGI("UnregisterDistributedHardware, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); std::lock_guard lock(proxyMutex_); if (dScreenSourceProxy_ == nullptr) { diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlerinitsink_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlerinitsink_fuzzer/BUILD.gn index f966cfeeec09d2e830984ce843ee92e5365454d3..f2cce162152fa670d0f48dd8a0b5744138fc54ba 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlerinitsink_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlerinitsink_fuzzer/BUILD.gn @@ -50,6 +50,7 @@ ohos_fuzztest("HandlerInitSinkFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", ] } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/BUILD.gn index 6fde8381262f50723336724eaa75559d3ffadacb..201e48813761e4c18d9ccae97fd395756eacd8eb 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handleronremotesinksvrdied_fuzzer/BUILD.gn @@ -50,6 +50,7 @@ ohos_fuzztest("HandlerOnRemoteSinkSvrDiedFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlersubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlersubscribelocalhardware_fuzzer/BUILD.gn index 7ab1e82eca48adfd748cb72010ba6e6854c4095e..6346a9a496ed36af5e4df2b2f103ce10cf4d5cb9 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlersubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlersubscribelocalhardware_fuzzer/BUILD.gn @@ -50,6 +50,7 @@ ohos_fuzztest("HandlerSubscribeLocalHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", ] } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlerunsubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlerunsubscribelocalhardware_fuzzer/BUILD.gn index 5d4fe44e9731109faac3ce3a4eec4f3b401507ad..cdbce4802f78117846a68d081606051bed50d1b1 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlerunsubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_handler/handlerunsubscribelocalhardware_fuzzer/BUILD.gn @@ -50,6 +50,7 @@ ohos_fuzztest("HandlerUnsubscribeLocalHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", ] } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyinitsink_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyinitsink_fuzzer/BUILD.gn index 651f06072a24579a84d482d3099436f17f2758c3..5c4bbb5aa8adbff9f030eda5c2b614dee2333a26 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyinitsink_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyinitsink_fuzzer/BUILD.gn @@ -50,6 +50,7 @@ ohos_fuzztest("ProxyInitSinkFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/BUILD.gn index 4b4099052397f364fce3840a13c335fc3825bfb5..40ae672d994b607f8ef639c49dc72791f7008459 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxysubscribelocalhardware_fuzzer/BUILD.gn @@ -50,6 +50,7 @@ ohos_fuzztest("ProxySubscribeLocalHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/BUILD.gn index 0ffda291a8dcc8f5419b5b904d72968dfd5886b1..378428faca26e024d75c67bbe2a9e391eb893210 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/proxyunsubscribelocalhardware_fuzzer/BUILD.gn @@ -50,6 +50,7 @@ ohos_fuzztest("ProxyUnsubscribeLocalHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/BUILD.gn index d9a3e3725316f74aedfb97d534e5917b85836700..2b67181e13297ebb61a4ae752ead3b3670638b2d 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_sink_proxy/sinkproxydscreennotify_fuzzer/BUILD.gn @@ -50,6 +50,7 @@ ohos_fuzztest("SinkProxyDScreenNotifyFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonnotifyregresult_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonnotifyregresult_fuzzer/BUILD.gn index 32a4c16eb12a749ad22e2704e2fcbe0bf9bd9831..0a85d4bed9891f8ad26a29cd4dad7ed46af523dc 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonnotifyregresult_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonnotifyregresult_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("CallBackOnNotifyRegResultFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonnotifyunregresult_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonnotifyunregresult_fuzzer/BUILD.gn index a0683a0431ae092518d56cba8fdbb5a1a649632e..03dcc4304c3313b4fa3ee7b49a4f81d57621a73f 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonnotifyunregresult_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonnotifyunregresult_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("CallBackOnNotifyUnregResultFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonremoterequest_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonremoterequest_fuzzer/BUILD.gn index 98f29d1d10868cb6c02977d92aad36f84961c13b..45da2fdd8bc1cd037550813c207f4704f806d951 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonremoterequest_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_callback/callbackonremoterequest_fuzzer/BUILD.gn @@ -56,6 +56,7 @@ ohos_fuzztest("CallbackOnRemoteRequestFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerconfigdistributedhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerconfigdistributedhardware_fuzzer/BUILD.gn index b78f2dfcfcfdd7aac41ab6d6cfbd11fad48db2d6..6965fef40ab6f66f5d6baf4a3c63c5bfab48a372 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerconfigdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerconfigdistributedhardware_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("HandlerConfigDistributedHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", ] } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerinitsource_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerinitsource_fuzzer/BUILD.gn index 8624c5163b4d0db6d08085fb563ce2bc27015b6b..5c691f369eecb7d160f154f5b398846e2c425364 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerinitsource_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerinitsource_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("HandlerInitSourceFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", ] } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handleronremotesourcesvrdied_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handleronremotesourcesvrdied_fuzzer/BUILD.gn index 861df2f96df7e2949692a9126724fddb96b596cc..a09672157f3ce03c7647250c3075f7f989ee3789 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handleronremotesourcesvrdied_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handleronremotesourcesvrdied_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("HandlerOnRemoteSourceSvrDiedFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerregisterdistributedhardware_fuzzer/BUILD.gn index 32075e8e28e62ac571ce33713555a1c6f9306ac4..75d2037c18e1be2089783ec175404a532bdba80e 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerregisterdistributedhardware_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("HandlerRegisterDistributedHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", ] } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerunregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerunregisterdistributedhardware_fuzzer/BUILD.gn index 379215753e68c26f467a5b3d6cf01bb8b70e8671..e08eb08f609bf8a1a677dc8dac433806579c4534 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerunregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_handler/handlerunregisterdistributedhardware_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("HandlerUnregisterDistributedHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", ] } diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyconfigdistributedhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyconfigdistributedhardware_fuzzer/BUILD.gn index 1cb6c52035419c3e7193a99683d32f9ea995b4d6..88eb50bf26275fb55383ebb30f0539be29182e13 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyconfigdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyconfigdistributedhardware_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("ProxyConfigDistributedHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxydscreennotify_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxydscreennotify_fuzzer/BUILD.gn index def6528ac6ad054fc08040e573f764457c287645..52adec80aacffc587daa2a3111f0c26d4b6c9f8a 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxydscreennotify_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxydscreennotify_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("ProxyDScreenNotifyFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyinitsource_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyinitsource_fuzzer/BUILD.gn index bcdc3058bf3d34fc0ffe3babe0611b0fbd7c20c8..89a05f3aad3d0d602d5dc6dfadfec1b7a8f8c0e1 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyinitsource_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyinitsource_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("ProxyInitSourceFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyregisterdistributedhardware_fuzzer/BUILD.gn index b9c08f228168912092e3ae440389fffcdedba30a..494b4a2df6cff68145d2b19f18f7c948c42b5d84 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyregisterdistributedhardware_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("ProxyRegisterDistributedHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyunregisterdistributedhardware_fuzzer/BUILD.gn b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyunregisterdistributedhardware_fuzzer/BUILD.gn index c5ada08ef3d0d7c0cf373e1a6b3ffab12e33dd54..54c4c18d5c5611ca8ff4434d0bc96c890892c932 100644 --- a/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyunregisterdistributedhardware_fuzzer/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/fuzztest/dscreen_source_proxy/proxyunregisterdistributedhardware_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("ProxyUnregisterDistributedHardwareFuzzTest") { external_deps = [ "c_utils:utils", + "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] diff --git a/screenhandler/BUILD.gn b/screenhandler/BUILD.gn index ab6d14e0499991f751171a93981673bfbb7c5f97..7784a76fc04d63db64b93cd513999870504c50a1 100644 --- a/screenhandler/BUILD.gn +++ b/screenhandler/BUILD.gn @@ -51,6 +51,7 @@ ohos_shared_library("distributed_screen_handler") { "c_utils:utils", "distributed_hardware_fwk:distributedhardwareutils", "graphic_surface:surface", + "hilog:libhilog", "ipc:ipc_core", "media_foundation:media_foundation", "window_manager:libdm", diff --git a/screenhandler/src/dscreen_handler.cpp b/screenhandler/src/dscreen_handler.cpp index e16db5ac421698bf5f987280c245de0c2e55860c..ae9fb810f125facf3f81b19e86109ee9ad227ddc 100644 --- a/screenhandler/src/dscreen_handler.cpp +++ b/screenhandler/src/dscreen_handler.cpp @@ -74,12 +74,12 @@ void ScreenListener::OnConnect(uint64_t screenId) { DHLOGI("on screen connect"); if (screenId != SCREEN_ID_DEFAULT) { - DHLOGI("screenId is invalid, screenId is: %" PRIu64, screenId); + DHLOGI("screenId is invalid, screenId is: %{public}" PRIu64, screenId); return; } sptr screen = Rosen::ScreenManager::GetInstance().GetScreenById(screenId); if (screen == nullptr) { - DHLOGE("screen not found, screenId is: %" PRIu64, screenId); + DHLOGE("screen not found, screenId is: %{public}" PRIu64, screenId); return; } if (!screen->IsReal()) { @@ -89,7 +89,7 @@ void ScreenListener::OnConnect(uint64_t screenId) std::string dhId = DSCREEN_PREFIX + SEPERATOR + std::to_string(screenId); uint32_t screenWidth = screen->GetWidth(); screenWidth = ByteCalculate(screenWidth); - DHLOGI("screenWidth is : %" PRIu32, screenWidth); + DHLOGI("screenWidth is : %{public}" PRIu32, screenWidth); uint32_t screenHeight = screen->GetHeight(); json attrJson; @@ -131,7 +131,7 @@ std::vector DScreenHandler::Query() std::vector dhItemVec; std::vector> screens; Rosen::ScreenManager::GetInstance().GetAllScreens(screens); - DHLOGI("screens size is: %" PRId32, screens.size()); + DHLOGI("screens size is: %{public}zu", screens.size()); for (const auto &screen : screens) { if (screen == nullptr) { DHLOGE("screen is nullptr."); @@ -149,7 +149,7 @@ std::vector DScreenHandler::Query() screenListener_ = new (std::nothrow) ScreenListener(); } screenWidth = screenListener_->ByteCalculate(screenWidth); - DHLOGI("screenWidth is : %" PRIu32, screenWidth); + DHLOGI("screenWidth is : %{public}" PRIu32, screenWidth); uint32_t screenHeight = screen->GetHeight(); json attrJson; @@ -159,11 +159,11 @@ std::vector DScreenHandler::Query() attrJson[KEY_CODECTYPE] = QueryCodecInfo(); std::string videoEncoders = HiStreamerQueryTool::GetInstance().QueryHiStreamerPluginInfo(HISTREAM_PLUGIN_TYPE::VIDEO_ENCODER); - DHLOGI("DScreen QueryVideoEncoderAbility info: %s", videoEncoders.c_str()); + DHLOGI("DScreen QueryVideoEncoderAbility info: %{public}s", videoEncoders.c_str()); attrJson[KEY_HISTREAMER_VIDEO_ENCODER] = videoEncoders; std::string videoDecoders = HiStreamerQueryTool::GetInstance().QueryHiStreamerPluginInfo(HISTREAM_PLUGIN_TYPE::VIDEO_DECODER); - DHLOGI("DScreen QueryVideoDecoderAbility info: %s", videoDecoders.c_str()); + DHLOGI("DScreen QueryVideoDecoderAbility info: %{public}s", videoDecoders.c_str()); attrJson[KEY_HISTREAMER_VIDEO_DECODER] = videoDecoders; DHItem dhItem; @@ -171,7 +171,7 @@ std::vector DScreenHandler::Query() dhItem.subtype = "screen"; dhItem.attrs = attrJson.dump(); dhItemVec.push_back(dhItem); - DHLOGD("query result: dhId: %s, attrs: %s", dhId.c_str(), attrJson.dump().c_str()); + DHLOGD("query result: dhId: %{public}s, attrs: %{public}s", dhId.c_str(), attrJson.dump().c_str()); } return dhItemVec; } diff --git a/screenhandler/test/fuzztest/pluginhardware_fuzzer/BUILD.gn b/screenhandler/test/fuzztest/pluginhardware_fuzzer/BUILD.gn index 5bb6acc5cb891c44af3d47b19dd69c83052a1600..82258b41891f6734ff8a5d680bbd0baefcd7552a 100644 --- a/screenhandler/test/fuzztest/pluginhardware_fuzzer/BUILD.gn +++ b/screenhandler/test/fuzztest/pluginhardware_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("PluginHardwareFuzzTest") { "c_utils:utils", "graphic_2d:libgraphic_utils", "graphic_surface:surface", + "hilog:libhilog", "ipc:ipc_core", "window_manager:libdm", ] diff --git a/screenhandler/test/fuzztest/registerpluginlistener_fuzzer/BUILD.gn b/screenhandler/test/fuzztest/registerpluginlistener_fuzzer/BUILD.gn index c7cc0f11a9ed01edb31aadd3d41939a7fee053f8..67fe3aded0f01b28215cc94f0345a9e328259ade 100644 --- a/screenhandler/test/fuzztest/registerpluginlistener_fuzzer/BUILD.gn +++ b/screenhandler/test/fuzztest/registerpluginlistener_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("RegisterPluginListenerFuzzTest") { "c_utils:utils", "graphic_2d:libgraphic_utils", "graphic_surface:surface", + "hilog:libhilog", "ipc:ipc_core", "window_manager:libdm", ] diff --git a/screenhandler/test/fuzztest/unpluginhardware_fuzzer/BUILD.gn b/screenhandler/test/fuzztest/unpluginhardware_fuzzer/BUILD.gn index d3de6184eaf7c967f800d3a783b2d63326d373fd..972dd2a95ba27574a6e022e32b53d4f32ac5c7c6 100644 --- a/screenhandler/test/fuzztest/unpluginhardware_fuzzer/BUILD.gn +++ b/screenhandler/test/fuzztest/unpluginhardware_fuzzer/BUILD.gn @@ -57,6 +57,7 @@ ohos_fuzztest("UnPluginHardwareFuzzTest") { "c_utils:utils", "graphic_2d:libgraphic_utils", "graphic_surface:surface", + "hilog:libhilog", "ipc:ipc_core", "window_manager:libdm", ] diff --git a/screenhandler/test/unittest/screenhandler/BUILD.gn b/screenhandler/test/unittest/screenhandler/BUILD.gn index 9fb6c7afc15455b4162c962078ad715f629ddc41..7035f6e303893b54b48b01da6a7a9ed3be63fcae 100644 --- a/screenhandler/test/unittest/screenhandler/BUILD.gn +++ b/screenhandler/test/unittest/screenhandler/BUILD.gn @@ -52,6 +52,7 @@ ohos_unittest("DscreenHandlerTest") { "c_utils:utils", "graphic_2d:libgraphic_utils", "graphic_surface:surface", + "hilog:libhilog", "ipc:ipc_core", "media_foundation:media_foundation", "window_manager:libdm", diff --git a/services/common/databuffer/include/data_buffer.h b/services/common/databuffer/include/data_buffer.h index 90d7d71f5f73af356ca75d6fa436cbf163df4cea..6ce71242d14f17069c10f47ec8b3c64cbcecb236 100644 --- a/services/common/databuffer/include/data_buffer.h +++ b/services/common/databuffer/include/data_buffer.h @@ -49,7 +49,7 @@ public: std::vector GetDirtyRectVec(); int32_t GetData(int32_t offset, int32_t datasize, uint8_t* &output); private: - static const constexpr char *LOG_TAG = "DataBuffer"; + static const constexpr char *DSCREEN_LOG_TAG = "DataBuffer"; std::vector dirtyRectVec_; size_t capacity_ = 0; uint8_t *data_ = nullptr; diff --git a/services/common/databuffer/src/data_buffer.cpp b/services/common/databuffer/src/data_buffer.cpp index d35d1eb7a905f7a457920cff72d2338b4803250a..36a5ea413fa7269d96e7e1f1ea3a4d55d70cf9ea 100644 --- a/services/common/databuffer/src/data_buffer.cpp +++ b/services/common/databuffer/src/data_buffer.cpp @@ -82,7 +82,7 @@ size_t DataBuffer::DataNumber() void DataBuffer::ResetCapcity(size_t capacity) { - DHLOGI("%s: ResetCapcity.", LOG_TAG); + DHLOGI("%{public}s: ResetCapcity.", DSCREEN_LOG_TAG); if (capacity < capacity_) { return; } @@ -102,7 +102,7 @@ void DataBuffer::AddData(size_t dataSize, unsigned char* &inputData) } int32_t ret = memcpy_s(data_ + capacity_, dataSize, inputData, dataSize); if (ret != EOK) { - DHLOGE("%s: in AddData memcpy data failed, ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: in AddData memcpy data failed, ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return; } capacity_ += dataSize; @@ -126,7 +126,7 @@ int32_t DataBuffer::GetData(int32_t offset, int32_t datasize, uint8_t* &output) } int32_t ret = memcpy_s(output, datasize, data_ + offset, datasize); if (ret != EOK) { - DHLOGE("GetData memcpy data failed, ret: %." PRId32, ret); + DHLOGE("GetData memcpy data failed, ret: %{public}" PRId32, ret); return ret; } return DH_SUCCESS; diff --git a/services/common/decision_center/include/screen_decision_center.h b/services/common/decision_center/include/screen_decision_center.h index 745f9304a8f03647c8e62c899e9eeceaa7616352..82a400c2db82f4cdd765b5a011bff5c0bc47da57 100644 --- a/services/common/decision_center/include/screen_decision_center.h +++ b/services/common/decision_center/include/screen_decision_center.h @@ -41,7 +41,7 @@ private: static const constexpr int32_t DIRTY_REGION_ARE_THRESHOLD = 260000; static const constexpr int32_t FORCE_FULL_IMAGE_TIME_INTERAL = 10; //10 seconds static const constexpr int32_t MIN_SURPPORT_FRAME_COUNT = 10; //10 frames - static const constexpr char *LOG_TAG = "ScreenDecisionCenter"; + static const constexpr char *DSCREEN_LOG_TAG = "ScreenDecisionCenter"; std::shared_ptr imageJpeg_ = nullptr; std::shared_ptr imageProcessor_ = nullptr; VideoParam configParam_; diff --git a/services/common/decision_center/src/screen_decision_center.cpp b/services/common/decision_center/src/screen_decision_center.cpp index 72b5341f475eca2d5f06c6cc1f6540a4e38a5464..2eae20c6730bf75c0aaeb2e9a55f11e55d655f3b 100644 --- a/services/common/decision_center/src/screen_decision_center.cpp +++ b/services/common/decision_center/src/screen_decision_center.cpp @@ -23,9 +23,9 @@ namespace OHOS { namespace DistributedHardware { bool ScreenDecisionCenter::IsDirtyRectValid(const std::vector &damages) { - DHLOGI("%s: IsDirtyRectValid.", LOG_TAG); + DHLOGI("%{public}s: IsDirtyRectValid.", DSCREEN_LOG_TAG); if (damages.empty()) { - DHLOGE("%s: damages size is empty.", LOG_TAG); + DHLOGE("%{public}s: damages size is empty.", DSCREEN_LOG_TAG); return false; } int32_t screenWidth = static_cast(configParam_.GetScreenWidth()); @@ -33,15 +33,16 @@ bool ScreenDecisionCenter::IsDirtyRectValid(const std::vector &damag for (const auto &damage : damages) { if (damage.x < 0 || damage.x > screenWidth || damage.y < 0 || damage.y > screenHeight || damage.x % TWO == 1 || damage.w % TWO == 1) { - DHLOGE("%s: dirty x:%" PRId32 ", y:%" PRId32 ", w:%" PRId32 ", h:%" PRId32, - LOG_TAG, damage.x, damage.y, damage.w, damage.h); + DHLOGE("%{public}s: dirty x:%{public}" PRId32 ", y:%{public}" PRId32 ", w:%{public}" PRId32 + ", h:%{public}" PRId32, DSCREEN_LOG_TAG, damage.x, damage.y, damage.w, damage.h); return false; } int32_t width = screenWidth - damage.x; int32_t height = screenHeight - damage.y; if (damage.w < 0 || damage.w > width || damage.h < 0 || damage.h > height) { - DHLOGE("%s: dirty x:%" PRId32 ", y:%" PRId32 ", w:%" PRId32 ", h:%" PRId32, - LOG_TAG, damage.x, damage.y, damage.w, damage.h); + DHLOGE("%{public}s: dirty x:%{public}" PRId32 ", y:%{public}" PRId32 ", w:%{public}" PRId32 + ", h:%{public}" PRId32, + DSCREEN_LOG_TAG, damage.x, damage.y, damage.w, damage.h); return false; } } @@ -50,12 +51,12 @@ bool ScreenDecisionCenter::IsDirtyRectValid(const std::vector &damag bool ScreenDecisionCenter::JudgeDirtyThreshold(const std::vector &damages) { - DHLOGI("%s: JudgeDirtyThreshold.", LOG_TAG); + DHLOGI("%{public}s: JudgeDirtyThreshold.", DSCREEN_LOG_TAG); int32_t allDirtyArea = 0; for (const auto &damage : damages) { allDirtyArea += damage.w * damage.h; if (allDirtyArea > DIRTY_REGION_ARE_THRESHOLD) { - DHLOGE("%s: dirtyArea is %." PRId32, LOG_TAG, allDirtyArea); + DHLOGE("%{public}s: dirtyArea is %{public}" PRId32, DSCREEN_LOG_TAG, allDirtyArea); return false; } } @@ -70,26 +71,26 @@ bool ScreenDecisionCenter::LimitTime(uint32_t timethreshold) int32_t ScreenDecisionCenter::InputBufferImage(sptr &surfaceBuffer, const std::vector &damages) { - DHLOGI("%s: InputBufferImage.", LOG_TAG); + DHLOGI("%{public}s: InputBufferImage.", DSCREEN_LOG_TAG); if (surfaceBuffer == nullptr) { - DHLOGE("%s: surfaceBuffer is null.", LOG_TAG); + DHLOGE("%{public}s: surfaceBuffer is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_SURFACE_BUFFER_INVALIED; } if (damages.empty() || frameCount_ < MIN_SURPPORT_FRAME_COUNT || LimitTime(FORCE_FULL_IMAGE_TIME_INTERAL) || !IsDirtyRectValid(damages) || !JudgeDirtyThreshold(damages)) { - DHLOGI("%s: send full image data.", LOG_TAG); + DHLOGI("%{public}s: send full image data.", DSCREEN_LOG_TAG); sendFullTime_ = time(nullptr); int32_t ret = imageProcessor_->ProcessFullImage(surfaceBuffer); if (ret != DH_SUCCESS) { - DHLOGE("%s: send full data failed.", LOG_TAG); + DHLOGE("%{public}s: send full data failed.", DSCREEN_LOG_TAG); return ret; } } else { - DHLOGI("%s: send dirty data.", LOG_TAG); + DHLOGI("%{public}s: send dirty data.", DSCREEN_LOG_TAG); int32_t ret = imageJpeg_->ProcessDamageSurface(surfaceBuffer, damages); if (ret != DH_SUCCESS) { - DHLOGE("%s: send dirty data failed.", LOG_TAG); + DHLOGE("%{public}s: send dirty data failed.", DSCREEN_LOG_TAG); return ret; } } @@ -100,9 +101,9 @@ int32_t ScreenDecisionCenter::InputBufferImage(sptr &surfaceBuffe int32_t ScreenDecisionCenter::ConfigureDecisionCenter(std::shared_ptr &listener, std::shared_ptr &imageProcessor) { - DHLOGI("%s: ConfigureDecisionCenter.", LOG_TAG); + DHLOGI("%{public}s: ConfigureDecisionCenter.", DSCREEN_LOG_TAG); if (listener == nullptr || imageProcessor == nullptr) { - DHLOGE("%s: Image source process is null.", LOG_TAG); + DHLOGE("%{public}s: Image source process is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } imageJpeg_ = std::make_shared(configParam_); @@ -113,9 +114,9 @@ int32_t ScreenDecisionCenter::ConfigureDecisionCenter(std::shared_ptr &surface) { - DHLOGI("%s: SetJpegSurface.", LOG_TAG); + DHLOGI("%{public}s: SetJpegSurface.", DSCREEN_LOG_TAG); if (surface ==nullptr) { - DHLOGE("%s: Jpeg source is null.", LOG_TAG); + DHLOGE("%{public}s: Jpeg source is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } return imageJpeg_->SetOutputSurface(surface); diff --git a/services/common/imageJpeg/include/jpeg_image_processor.h b/services/common/imageJpeg/include/jpeg_image_processor.h index 00f218759cd9549795498d3c2a90633d3ff173b7..aa6c3badf3e6b6a54d8a03c2d979cf58e47d6042 100644 --- a/services/common/imageJpeg/include/jpeg_image_processor.h +++ b/services/common/imageJpeg/include/jpeg_image_processor.h @@ -45,7 +45,7 @@ private: uint32_t inputDataSize, std::shared_ptr &data); void DecompressJpegToNV12(size_t jpegSize, uint8_t *inputData, uint8_t *outputData); - static const constexpr char *LOG_TAG = "JpegImageProcessor"; + static const constexpr char *DSCREEN_LOG_TAG = "JpegImageProcessor"; sptr imageSurface_; VideoParam configParam_; std::weak_ptr imageProcessorListener_; diff --git a/services/common/imageJpeg/src/jpeg_image_processor.cpp b/services/common/imageJpeg/src/jpeg_image_processor.cpp index a49cd1103a5504ea4c7685f2762cc2da415d0f97..bf3080365c62dc9046a9a54880ecaef682361cb9 100644 --- a/services/common/imageJpeg/src/jpeg_image_processor.cpp +++ b/services/common/imageJpeg/src/jpeg_image_processor.cpp @@ -29,9 +29,9 @@ namespace OHOS { namespace DistributedHardware { int32_t JpegImageProcessor::SetOutputSurface(sptr surface) { - DHLOGI("%s: SetOutputSurface.", LOG_TAG); + DHLOGI("%{public}s: SetOutputSurface.", DSCREEN_LOG_TAG); if (surface == nullptr) { - DHLOGE("%s: SetOutputSurface surface is nullptr.", LOG_TAG); + DHLOGE("%{public}s: SetOutputSurface surface is nullptr.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } imageSurface_ = surface; @@ -40,15 +40,15 @@ int32_t JpegImageProcessor::SetOutputSurface(sptr surface) int32_t JpegImageProcessor::FillDirtyImages2Surface(const std::shared_ptr &data, uint8_t *lastFrame) { - DHLOGI("%s: FillDirtyImages2Surface.", LOG_TAG); + DHLOGI("%{public}s: FillDirtyImages2Surface.", DSCREEN_LOG_TAG); if (imageSurface_ == nullptr) { - DHLOGE("%s: imageSurface_ is nullptr.", LOG_TAG); + DHLOGE("%{public}s: imageSurface_ is nullptr.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_SURFACE_INVALIED; } uint32_t lastFrameSize = configParam_.GetScreenWidth() * configParam_.GetScreenHeight() * RGB_CHROMA / TWO; int32_t ret = DecodeDamageData(data, lastFrame); if (ret != DH_SUCCESS) { - DHLOGE("%s: Merge dirty failed, ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Merge dirty failed, ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } sptr windowSurfaceBuffer = nullptr; @@ -62,7 +62,8 @@ int32_t JpegImageProcessor::FillDirtyImages2Surface(const std::shared_ptrRequestBuffer(windowSurfaceBuffer, releaseFence, requestConfig); if (surfaceErr != SURFACE_ERROR_OK || windowSurfaceBuffer == nullptr) { - DHLOGE("%s: imageSurface request buffer failed, surfaceErr: %." PRId32, LOG_TAG, surfaceErr); + DHLOGE("%{public}s: imageSurface request buffer failed, surfaceErr: %{public}" PRId32, + DSCREEN_LOG_TAG, surfaceErr); imageSurface_->CancelBuffer(windowSurfaceBuffer); return surfaceErr; } @@ -70,25 +71,26 @@ int32_t JpegImageProcessor::FillDirtyImages2Surface(const std::shared_ptr(windowSurfaceBuffer->GetVirAddr()); ret = memcpy_s(windowSurfaceAddr, surfaceBuffeSize, lastFrame, lastFrameSize); if (ret != DH_SUCCESS) { - DHLOGE("%s: memcpy lastFrame failed,ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: memcpy lastFrame failed,ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); imageSurface_->CancelBuffer(windowSurfaceBuffer); return ret; } BufferFlushConfig flushConfig = { {0, 0, windowSurfaceBuffer->GetWidth(), windowSurfaceBuffer-> GetHeight()}, 0}; surfaceErr = imageSurface_->FlushBuffer(windowSurfaceBuffer, -1, flushConfig); if (surfaceErr != SURFACE_ERROR_OK) { - DHLOGE("%s: imageSurface flush buffer failed, surfaceErr: %." PRId32, LOG_TAG, surfaceErr); + DHLOGE("%{public}s: imageSurface flush buffer failed, surfaceErr: %{public}" PRId32, + DSCREEN_LOG_TAG, surfaceErr); imageSurface_->CancelBuffer(windowSurfaceBuffer); return surfaceErr; } - DHLOGI("%s: FillDirtyImages2Surface success.", LOG_TAG); + DHLOGI("%{public}s: FillDirtyImages2Surface success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t JpegImageProcessor::ProcessDamageSurface(sptr &surfaceBuffer, const std::vector &damages) { - DHLOGI("%s: ProcessDamageSurface.", LOG_TAG); + DHLOGI("%{public}s: ProcessDamageSurface.", DSCREEN_LOG_TAG); std::shared_ptr dataBuf = std::make_shared(configParam_.GetScreenWidth() * configParam_.GetScreenHeight() * RGBA_CHROMA); dataBuf->SetSize(0); @@ -97,7 +99,7 @@ int32_t JpegImageProcessor::ProcessDamageSurface(sptr &surfaceBuf } std::shared_ptr listener = imageProcessorListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Processor listener is null.", LOG_TAG); + DHLOGE("%{public}s: Processor listener is null.", DSCREEN_LOG_TAG); imageSurface_->ReleaseBuffer(surfaceBuffer, -1); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } @@ -108,7 +110,7 @@ int32_t JpegImageProcessor::ProcessDamageSurface(sptr &surfaceBuf int32_t JpegImageProcessor::SetImageProcessListener(std::shared_ptr &listener) { - DHLOGI("%s: SetImageProcessorListener.", LOG_TAG); + DHLOGI("%{public}s: SetImageProcessorListener.", DSCREEN_LOG_TAG); imageProcessorListener_ = listener; return DH_SUCCESS; } @@ -116,7 +118,7 @@ int32_t JpegImageProcessor::SetImageProcessListener(std::shared_ptr &surfaceBuffer, const OHOS::Rect &damage, std::shared_ptr &data) { - DHLOGI("%s: EncodeDamageData.", LOG_TAG); + DHLOGI("%{public}s: EncodeDamageData.", DSCREEN_LOG_TAG); uint32_t partialSize = damage.w * damage.h * RGBA_CHROMA; unsigned char *partialBuffer = new unsigned char[partialSize]; unsigned char *partialBufferIdx = partialBuffer; @@ -125,7 +127,7 @@ void JpegImageProcessor::EncodeDamageData(sptr &surfaceBuffer, for (int32_t row = 0 ; row < damage.h ; row++) { int32_t ret = memcpy_s(partialBufferIdx, damage.w * RGBA_CHROMA, surfaceAddrIdx, damage.w * RGBA_CHROMA); if (ret != DH_SUCCESS) { - DHLOGE("%s: get partail data failed.", LOG_TAG); + DHLOGE("%{public}s: get partail data failed.", DSCREEN_LOG_TAG); imageSurface_->ReleaseBuffer(surfaceBuffer, -1); delete [] partialBuffer; return; @@ -134,13 +136,13 @@ void JpegImageProcessor::EncodeDamageData(sptr &surfaceBuffer, surfaceAddrIdx += configParam_.GetScreenWidth() * RGBA_CHROMA; } uint32_t jpegSize = CompressRgbaToJpeg(damage, partialBuffer, partialSize, data); - DHLOGI("CompressRgbaToJpeg end, jpegSize %." PRId32, jpegSize); + DHLOGI("CompressRgbaToJpeg end, jpegSize %{public}" PRId32, jpegSize); delete [] partialBuffer; } int32_t JpegImageProcessor::DecodeDamageData(const std::shared_ptr &data, uint8_t *lastFrame) { - DHLOGI("%s: DecodeDamageData.", LOG_TAG); + DHLOGI("%{public}s: DecodeDamageData.", DSCREEN_LOG_TAG); std::vector dirtyRectVec = data->GetDirtyRectVec(); int32_t offset = 0; int32_t screenWidth = static_cast(configParam_.GetScreenWidth()); @@ -148,7 +150,7 @@ int32_t JpegImageProcessor::DecodeDamageData(const std::shared_ptr & for (auto item : dirtyRectVec) { if (item.xPos > screenWidth || item.yPos > screenHeight || item.width > screenWidth - item.xPos || item.height > screenHeight - item.yPos) { - DHLOGE("%s: Dirty rect invalid.", LOG_TAG); + DHLOGE("%{public}s: Dirty rect invalid.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_INPUT_PARAM_INVALID; } uint8_t *jpegData = new uint8_t[item.dirtySize] {0}; @@ -159,12 +161,12 @@ int32_t JpegImageProcessor::DecodeDamageData(const std::shared_ptr & } offset += item.dirtySize; uint8_t *dirtyImageData = new uint8_t[item.width * item.height * RGB_CHROMA] {0}; - DHLOGI("%s: DecompressJpegToNV12.", LOG_TAG); + DHLOGI("%{public}s: DecompressJpegToNV12.", DSCREEN_LOG_TAG); DecompressJpegToNV12(item.dirtySize, jpegData, dirtyImageData); - DHLOGI("%s: DecompressJpegToNV12 success.", LOG_TAG); + DHLOGI("%{public}s: DecompressJpegToNV12 success.", DSCREEN_LOG_TAG); ret = ReplaceDamage2LastFrame(lastFrame, dirtyImageData, item); if (ret != DH_SUCCESS) { - DHLOGE("ReplaceDamage2LastFrame failed, ret: %." PRId32, ret); + DHLOGE("ReplaceDamage2LastFrame failed, ret: %{public}" PRId32, ret); delete [] jpegData; delete [] dirtyImageData; return ret; @@ -172,13 +174,13 @@ int32_t JpegImageProcessor::DecodeDamageData(const std::shared_ptr & delete [] jpegData; delete [] dirtyImageData; } - DHLOGI("%s: DecodeDamageData success.", LOG_TAG); + DHLOGI("%{public}s: DecodeDamageData success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t JpegImageProcessor::ReplaceDamage2LastFrame(uint8_t *lastFrame, uint8_t *dirtyImageData, const DirtyRect rect) { - DHLOGI("%s: ReplaceDamage2LastFrame.", LOG_TAG); + DHLOGI("%{public}s: ReplaceDamage2LastFrame.", DSCREEN_LOG_TAG); uint8_t *lastFrameIdx = lastFrame; uint8_t *yData = lastFrameIdx + static_cast(configParam_.GetScreenWidth() * rect.yPos + rect.xPos); uint8_t *uData = lastFrameIdx + configParam_.GetScreenWidth() * configParam_.GetScreenHeight() + @@ -191,7 +193,7 @@ int32_t JpegImageProcessor::ReplaceDamage2LastFrame(uint8_t *lastFrame, uint8_t yTempData = yData + static_cast(i) * configParam_.GetScreenWidth(); int32_t ret = memcpy_s(yTempData, rect.width, yDirtyData, rect.width); if (ret != EOK) { - DHLOGE("%s: memcpy yData failed.", LOG_TAG); + DHLOGE("%{public}s: memcpy yData failed.", DSCREEN_LOG_TAG); return ret; } yDirtyData += static_cast(rect.width); @@ -199,20 +201,20 @@ int32_t JpegImageProcessor::ReplaceDamage2LastFrame(uint8_t *lastFrame, uint8_t uTempData = uData + configParam_.GetScreenWidth() * (static_cast(i) / TWO); ret = memcpy_s(uTempData, rect.width, uDirtyData, rect.width); if (ret != EOK) { - DHLOGE("%s: memcpy uData failed.", LOG_TAG); + DHLOGE("%{public}s: memcpy uData failed.", DSCREEN_LOG_TAG); return ret; } uDirtyData += static_cast(rect.width); } } - DHLOGI("%s: ReplaceDamage2LastFrame success.", LOG_TAG); + DHLOGI("%{public}s: ReplaceDamage2LastFrame success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } uint32_t JpegImageProcessor::CompressRgbaToJpeg(const OHOS::Rect &damage, uint8_t *inputData, uint32_t inputDataSize, std::shared_ptr &data) { - DHLOGI("%s: CompressRgbaToJpeg.", LOG_TAG); + DHLOGI("%{public}s: CompressRgbaToJpeg.", DSCREEN_LOG_TAG); if (inputDataSize != damage.w * damage.h * RGBA_CHROMA) { return ERR_DH_SCREEN_CODEC_PARTAIL_DATA_ERROR; } diff --git a/services/common/utils/include/dscreen_hidumper.h b/services/common/utils/include/dscreen_hidumper.h index f519f5e44c714b638f86688cf0266247660c409a..ac65c24fa52cfa7b105fcba54bcd9e9876658bbe 100644 --- a/services/common/utils/include/dscreen_hidumper.h +++ b/services/common/utils/include/dscreen_hidumper.h @@ -68,6 +68,7 @@ private: int32_t ReDumpScreenData(std::string &result); private: + static const constexpr char *DSCREEN_LOG_TAG = "DscreenHidumper"; bool hidumperFlag_ = false; bool fileFullFlag_ = false; bool reDumpFlag_ = false; diff --git a/services/common/utils/src/dscreen_hidumper.cpp b/services/common/utils/src/dscreen_hidumper.cpp index aa34dea74117db68f45925af41e398d59ef68e27..edf368b840c4d6e848adfe19b9424ab95e8a1df0 100644 --- a/services/common/utils/src/dscreen_hidumper.cpp +++ b/services/common/utils/src/dscreen_hidumper.cpp @@ -19,9 +19,6 @@ #include "dscreen_log.h" #include "dscreen_util.h" -#undef DH_LOG_TAG -#define DH_LOG_TAG "DscreenHidumper" - namespace OHOS { namespace DistributedHardware { IMPLEMENT_SINGLE_INSTANCE(DscreenHidumper); @@ -52,11 +49,11 @@ DscreenHidumper::~DscreenHidumper() bool DscreenHidumper::Dump(const std::vector &args, std::string &result) { - DHLOGI("Distributed screen hidumper dump args.size():%d.", args.size()); + DHLOGI("Distributed screen hidumper dump args.size():%{public}zu.", args.size()); result.clear(); int32_t argsSize = static_cast(args.size()); for (int32_t i = 0; i < argsSize; i++) { - DHLOGI("Distributed screen hidumper dump args[%d]: %s.", i, args.at(i).c_str()); + DHLOGI("Distributed screen hidumper dump args[%{public}d]: %{public}s.", i, args.at(i).c_str()); } if (args.empty()) { @@ -110,7 +107,7 @@ int32_t DscreenHidumper::DumpScreenData(std::string &result) if (access(DUMP_FILE_PATH.c_str(), 0) < 0) { if (mkdir(DUMP_FILE_PATH.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) { DHLOGI("Create dir err."); - DHLOGI("dir path : %s", DUMP_FILE_PATH.c_str()); + DHLOGI("dir path : %{public}s", DUMP_FILE_PATH.c_str()); return DSCREEN_BAD_VALUE; } } @@ -131,7 +128,7 @@ int32_t DscreenHidumper::ReDumpScreenData(std::string &result) if (access(DUMP_FILE_PATH.c_str(), 0) < 0) { if (mkdir(DUMP_FILE_PATH.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) { DHLOGI("Create dir err."); - DHLOGI("dir path : %s", DUMP_FILE_PATH.c_str()); + DHLOGI("dir path : %{public}s", DUMP_FILE_PATH.c_str()); return DSCREEN_BAD_VALUE; } } @@ -225,7 +222,7 @@ void DscreenHidumper::SaveFile(std::string file, const VideoData &video) DHLOGE("Saving File."); std::string fileName = DUMP_FILE_PATH + "/" + file + std::to_string(video.width) + ")_height(" + std::to_string(video.height) + ")_" + video.format + ".jpg"; - DHLOGE("fileName = %s", fileName.c_str()); + DHLOGE("fileName = %{public}s", fileName.c_str()); if (GetReDumpFlag() == true) { std::remove(fileName.c_str()); SetReDumpFlagFalse(); diff --git a/services/screenclient/BUILD.gn b/services/screenclient/BUILD.gn index 5efb473f86cf32e24d3e36ba12aad8bfb38f5b62..bf4554c4abc5e636b9a056c79fbb44c158ff98a5 100644 --- a/services/screenclient/BUILD.gn +++ b/services/screenclient/BUILD.gn @@ -54,6 +54,7 @@ ohos_shared_library("distributed_screen_client") { "graphic_2d:libgraphic_utils", "graphic_2d:librender_service_client", "graphic_surface:surface", + "hilog:libhilog", "input:libmmi-client", "window_manager:libwm", ] diff --git a/services/screenclient/src/screen_client.cpp b/services/screenclient/src/screen_client.cpp index 768c5c5c1343ec3d498399860fbe369c0407d7fe..5b3fbb539ea4faa05ed8e618dcfb4d0e7bdee2e2 100644 --- a/services/screenclient/src/screen_client.cpp +++ b/services/screenclient/src/screen_client.cpp @@ -38,7 +38,7 @@ int32_t ScreenClient::AddWindow(std::shared_ptr &windowProperty) std::lock_guard dataLock(surfaceMapMutex_); surfaceMap_.emplace(windowId, surface); } - DHLOGI("Add window ID = %" PRId32 " success.", windowId); + DHLOGI("Add window ID = %{public}" PRId32 " success.", windowId); return windowId; } @@ -48,16 +48,16 @@ int32_t ScreenClient::ShowWindow(int32_t windowId) std::lock_guard dataLock(surfaceMapMutex_); auto iter = surfaceMap_.find(windowId); if (iter == surfaceMap_.end()) { - DHLOGE("windowId ID = %" PRId32 " is non-existent.", windowId); + DHLOGE("windowId ID = %{public}" PRId32 " is non-existent.", windowId); return ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR; } } int32_t ret = ScreenClientWindowAdapter::GetInstance().ShowWindow(windowId); if (ret != DH_SUCCESS) { - DHLOGE("Show window ID = %" PRId32 " failed.", windowId); + DHLOGE("Show window ID = %{public}" PRId32 " failed.", windowId); return ret; } - DHLOGI("Show window ID = %" PRId32 " success.", windowId); + DHLOGI("Show window ID = %{public}" PRId32 " success.", windowId); return ret; } @@ -67,16 +67,16 @@ int32_t ScreenClient::HideWindow(int32_t windowId) std::lock_guard dataLock(surfaceMapMutex_); auto iter = surfaceMap_.find(windowId); if (iter == surfaceMap_.end()) { - DHLOGE("windowId ID = %" PRId32 " is non-existent.", windowId); + DHLOGE("windowId ID = %{public}" PRId32 " is non-existent.", windowId); return ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR; } } int32_t ret = ScreenClientWindowAdapter::GetInstance().HideWindow(windowId); if (ret != DH_SUCCESS) { - DHLOGE("Hide window ID = %" PRId32 " failed.", windowId); + DHLOGE("Hide window ID = %{public}" PRId32 " failed.", windowId); return ret; } - DHLOGI("Hide window ID = %" PRId32 " success.", windowId); + DHLOGI("Hide window ID = %{public}" PRId32 " success.", windowId); return ret; } @@ -86,16 +86,16 @@ int32_t ScreenClient::MoveWindow(int32_t windowId, int32_t startX, int32_t start std::lock_guard dataLock(surfaceMapMutex_); auto iter = surfaceMap_.find(windowId); if (iter == surfaceMap_.end()) { - DHLOGE("windowId ID = %" PRId32 " is non-existent.", windowId); + DHLOGE("windowId ID = %{public}" PRId32 " is non-existent.", windowId); return ERR_DH_SCREEN_SCREENCLIENT_MOVE_WINDOW_ERROR; } } int32_t ret = ScreenClientWindowAdapter::GetInstance().MoveWindow(windowId, startX, startY); if (ret != DH_SUCCESS) { - DHLOGE("Move window ID = %" PRId32 " failed.", windowId); + DHLOGE("Move window ID = %{public}" PRId32 " failed.", windowId); return ret; } - DHLOGD("Move window ID = %" PRId32 " success.", windowId); + DHLOGD("Move window ID = %{public}" PRId32 " success.", windowId); return ret; } @@ -106,12 +106,12 @@ sptr ScreenClient::GetSurface(int32_t windowId) std::lock_guard dataLock(surfaceMapMutex_); auto iter = surfaceMap_.find(windowId); if (iter == surfaceMap_.end()) { - DHLOGE("windowId ID = %" PRId32 " is non-existent.", windowId); + DHLOGE("windowId ID = %{public}" PRId32 " is non-existent.", windowId); return nullptr; } surface = iter->second; } - DHLOGD("Get surface ID = %" PRId32 " success.", windowId); + DHLOGD("Get surface ID = %{public}" PRId32 " success.", windowId); return surface; } @@ -121,17 +121,17 @@ int32_t ScreenClient::RemoveWindow(int32_t windowId) std::lock_guard dataLock(surfaceMapMutex_); auto iter = surfaceMap_.find(windowId); if (iter == surfaceMap_.end()) { - DHLOGE("windowId ID = %" PRId32 " is non-existent.", windowId); + DHLOGE("windowId ID = %{public}" PRId32 " is non-existent.", windowId); return ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR; } surfaceMap_.erase(windowId); } int32_t ret = ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); if (ret != DH_SUCCESS) { - DHLOGE("windowId ID = %" PRId32 " remove failed.", windowId); + DHLOGE("windowId ID = %{public}" PRId32 " remove failed.", windowId); return ret; } - DHLOGD("windowId ID = %" PRId32 " remove success.", windowId); + DHLOGD("windowId ID = %{public}" PRId32 " remove success.", windowId); return ret; } diff --git a/services/screenclient/src/screen_client_window_adapter.cpp b/services/screenclient/src/screen_client_window_adapter.cpp index 0529cf9aea9c36eb0dd7edb801d756f0226a5ba0..39e4666d36080caabcf5bdc27f26895c46ea0969 100644 --- a/services/screenclient/src/screen_client_window_adapter.cpp +++ b/services/screenclient/src/screen_client_window_adapter.cpp @@ -59,7 +59,7 @@ sptr ScreenClientWindowAdapter::CreateWindow(std::shared_ptr listener = std::make_shared(ScreenClientInputEventListener()); window->SetInputEventConsumer(listener); - DHLOGD("Create window name is %s.", windowName.c_str()); + DHLOGD("Create window name is %{public}s.", windowName.c_str()); if (window->Resize(windowProperty->width, windowProperty->height) != OHOS::Rosen::WMError::WM_OK) { window->Destroy(); DHLOGE("Window resize failed."); @@ -74,7 +74,7 @@ sptr ScreenClientWindowAdapter::CreateWindow(std::shared_ptr dataLock(windowIdMapMutex_); windowIdMap_.emplace(windowId, window); } - DHLOGD("Get surface windowId = %" PRId32 " success.", windowId); + DHLOGD("Get surface windowId = %{public}" PRId32 " success.", windowId); return surface; } @@ -85,7 +85,7 @@ int32_t ScreenClientWindowAdapter::ShowWindow(int32_t windowId) std::lock_guard dataLock(windowIdMapMutex_); auto iter = windowIdMap_.find(windowId); if (iter == windowIdMap_.end()) { - DHLOGE("Invalid windowId windowId = %" PRId32, windowId); + DHLOGE("Invalid windowId windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR; } window = iter->second; @@ -98,7 +98,7 @@ int32_t ScreenClientWindowAdapter::ShowWindow(int32_t windowId) DHLOGE("Show window failed."); return ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR; } - DHLOGD("Show window windowId = %" PRId32 " success.", windowId); + DHLOGD("Show window windowId = %{public}" PRId32 " success.", windowId); return DH_SUCCESS; } @@ -109,7 +109,7 @@ int32_t ScreenClientWindowAdapter::HideWindow(int32_t windowId) std::lock_guard dataLock(windowIdMapMutex_); auto iter = windowIdMap_.find(windowId); if (iter == windowIdMap_.end()) { - DHLOGE("Invalid windowId windowId = %" PRId32, windowId); + DHLOGE("Invalid windowId windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR; } window = iter->second; @@ -122,7 +122,7 @@ int32_t ScreenClientWindowAdapter::HideWindow(int32_t windowId) DHLOGE("Hide window failed."); return ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR; } - DHLOGD("Hide window windowId = %" PRId32 " success.", windowId); + DHLOGD("Hide window windowId = %{public}" PRId32 " success.", windowId); return DH_SUCCESS; } @@ -133,20 +133,20 @@ int32_t ScreenClientWindowAdapter::MoveWindow(int32_t windowId, int32_t startX, std::lock_guard dataLock(windowIdMapMutex_); auto iter = windowIdMap_.find(windowId); if (iter == windowIdMap_.end()) { - DHLOGE("Invalid windowId windowId = %" PRId32, windowId); + DHLOGE("Invalid windowId windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_MOVE_WINDOW_ERROR; } window = iter->second; } if (window == nullptr) { - DHLOGE("Current window is null windowId = %" PRId32, windowId); + DHLOGE("Current window is null windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_MOVE_WINDOW_ERROR; } if (window->MoveTo(startX, startY) != OHOS::Rosen::WMError::WM_OK) { - DHLOGE("Move window failed windowId = %" PRId32, windowId); + DHLOGE("Move window failed windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_MOVE_WINDOW_ERROR; } - DHLOGD("MoveTo window windowId = %" PRId32 " success.", windowId); + DHLOGD("MoveTo window windowId = %{public}" PRId32 " success.", windowId); return DH_SUCCESS; } @@ -157,25 +157,25 @@ int32_t ScreenClientWindowAdapter::RemoveWindow(int32_t windowId) std::lock_guard dataLock(windowIdMapMutex_); auto iter = windowIdMap_.find(windowId); if (iter == windowIdMap_.end()) { - DHLOGE("Invalid windowId windowId = %" PRId32, windowId); + DHLOGE("Invalid windowId windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR; } window = iter->second; windowIdMap_.erase(windowId); } if (window == nullptr) { - DHLOGE("Current window is null windowId = %" PRId32, windowId); + DHLOGE("Current window is null windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR; } if (window->Hide() != OHOS::Rosen::WMError::WM_OK) { - DHLOGE("Remove window window failed windowId = %" PRId32, windowId); + DHLOGE("Remove window window failed windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR; } if (window->Destroy() != OHOS::Rosen::WMError::WM_OK) { - DHLOGE("Remove window window failed windowId = %" PRId32, windowId); + DHLOGE("Remove window window failed windowId = %{public}" PRId32, windowId); return ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR; } - DHLOGD("Remove window success windowId = %" PRId32, windowId); + DHLOGD("Remove window success windowId = %{public}" PRId32, windowId); return DH_SUCCESS; } @@ -186,11 +186,11 @@ int32_t ScreenClientWindowAdapter::DestroyAllWindow() for (const auto &item : windowIdMap_) { auto window = item.second; if (window == nullptr) { - DHLOGE("window is nullptr. windowId = %" PRId32, item.first); + DHLOGE("window is nullptr. windowId = %{public}" PRId32, item.first); continue; } if (OHOS::Rosen::WMError::WM_OK != window->Destroy()) { - DHLOGE("Destroy window failed. windowId = %" PRId32, item.first); + DHLOGE("Destroy window failed. windowId = %{public}" PRId32, item.first); continue; } } diff --git a/services/screendemo/decoder_demo.cpp b/services/screendemo/decoder_demo.cpp index 91229b665a34943c6e58136104f1942c77e6bff0..49eb418ac1735e6f0488a973e823533bfb898adc 100644 --- a/services/screendemo/decoder_demo.cpp +++ b/services/screendemo/decoder_demo.cpp @@ -200,7 +200,7 @@ void VDecDemo::CheckCodecType() MediaAVCodec::AVCodecCategory::AVCODEC_HARDWARE); std::string mimeType = capData->mimeType; localCodecArray.push_back(mimeType); -} + } if (std::find(localCodecArray.begin(), localCodecArray.end(), CODEC_NAME_H264) != localCodecArray.end()) { diff --git a/services/screenservice/sinkservice/BUILD.gn b/services/screenservice/sinkservice/BUILD.gn index dfc590bcb9eadcf706e22fa701821c4713e93eca..11e3891ecd1c9bdca086bd9e691141497d8c8441 100644 --- a/services/screenservice/sinkservice/BUILD.gn +++ b/services/screenservice/sinkservice/BUILD.gn @@ -90,6 +90,7 @@ ohos_shared_library("distributed_screen_sink") { "graphic_2d:libgraphic_utils", "graphic_2d:librender_service_client", "graphic_surface:surface", + "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_core", diff --git a/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_service.cpp b/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_service.cpp index a82cc4e0b85c0bb3b8170a5a6536262c595d5cab..058d2e31c9d3112e225a1f8baa344f854c338927 100644 --- a/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_service.cpp +++ b/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_service.cpp @@ -69,10 +69,10 @@ bool DScreenSinkService::Init() int32_t DScreenSinkService::InitSink(const std::string ¶ms) { - DHLOGI("Init sink dscreen region manager, params: %s", params.c_str()); + DHLOGI("Init sink dscreen region manager, params: %{public}s", params.c_str()); int32_t ret = V2_0::ScreenRegionManager::GetInstance().Initialize(); if (ret != DH_SUCCESS) { - DHLOGE("Initialize V2_0::ScreenRegionManage failed. err: %d", ret); + DHLOGE("Initialize V2_0::ScreenRegionManage failed. err: %{public}d", ret); } return DH_SUCCESS; } @@ -91,7 +91,7 @@ int32_t DScreenSinkService::ReleaseSink() } int32_t ret = systemAbilityMgr->UnloadSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID); if (ret != DH_SUCCESS) { - DHLOGE("sink systemAbilityMgr UnLoadSystemAbility failed, ret: %" PRId32, ret); + DHLOGE("sink systemAbilityMgr UnLoadSystemAbility failed, ret: %{public}" PRId32, ret); return DSCREEN_BAD_VALUE; } DHLOGI("sink systemAbilityMgr UnLoadSystemAbility success"); @@ -115,8 +115,8 @@ int32_t DScreenSinkService::UnsubscribeLocalHardware(const std::string &dhId) void DScreenSinkService::DScreenNotify(const std::string &devId, int32_t eventCode, const std::string &eventContent) { - DHLOGI("DScreenNotify, devId:%s, eventCode: %" PRId32 ", eventContent:%s", GetAnonyString(devId).c_str(), - eventCode, eventContent.c_str()); + DHLOGI("DScreenNotify, devId:%{public}s, eventCode: %{public}" PRId32 ", eventContent:%{public}s", + GetAnonyString(devId).c_str(), eventCode, eventContent.c_str()); V1_0::ScreenRegionManager::GetInstance().HandleDScreenNotify(devId, eventCode, eventContent); } diff --git a/services/screenservice/sinkservice/screenregionmgr/1.0/src/screenregion.cpp b/services/screenservice/sinkservice/screenregionmgr/1.0/src/screenregion.cpp index a0e496de0d43a312a6c807dda864d4852f9fc927..3624f72208b3579ff36229f2ec4adfc019515ff9 100644 --- a/services/screenservice/sinkservice/screenregionmgr/1.0/src/screenregion.cpp +++ b/services/screenservice/sinkservice/screenregionmgr/1.0/src/screenregion.cpp @@ -46,7 +46,7 @@ ScreenRegion::~ScreenRegion() void ScreenRegion::OnTransError(int32_t err, const std::string &content) { - DHLOGW("OnTransError, err: %" PRId32, err); + DHLOGW("OnTransError, err: %{public}" PRId32, err); Stop(); } @@ -132,7 +132,7 @@ int32_t ScreenRegion::SetUpWindow() int32_t ScreenRegion::SetUp(const std::string &version) { - DHLOGI("ScreenRegion::SetUp, remoteDevId: %s", GetAnonyString(remoteDevId_).c_str()); + DHLOGI("ScreenRegion::SetUp, remoteDevId: %{public}s", GetAnonyString(remoteDevId_).c_str()); int32_t ret = SetUpWindow(); if (ret != DH_SUCCESS) { DHLOGE("SetUpWindow failed."); @@ -156,7 +156,7 @@ int32_t ScreenRegion::SetUp(const std::string &version) int32_t ScreenRegion::Start() { - DHLOGI("ScreenRegion::Start remoteDevId: %s", GetAnonyString(remoteDevId_).c_str()); + DHLOGI("ScreenRegion::Start remoteDevId: %{public}s", GetAnonyString(remoteDevId_).c_str()); if (sinkTrans_ == nullptr) { DHLOGE("sink trans not init."); return ERR_DH_SCREEN_SA_SINKTRANS_NOT_INIT; @@ -173,7 +173,7 @@ int32_t ScreenRegion::Start() int32_t ScreenRegion::Stop() { - DHLOGI("ScreenRegion::Stop remoteDevId: %s", GetAnonyString(remoteDevId_).c_str()); + DHLOGI("ScreenRegion::Stop remoteDevId: %{public}s", GetAnonyString(remoteDevId_).c_str()); if (!isRunning) { DHLOGI("ScreenRegion not running, no need stop"); return DH_SUCCESS; diff --git a/services/screenservice/sinkservice/screenregionmgr/1.0/src/screenregionmgr.cpp b/services/screenservice/sinkservice/screenregionmgr/1.0/src/screenregionmgr.cpp index 3d9626438fb3eb55839fba0bb1a28aa4460cb889..b05d3f635bac398039b45b7f82ea24c0326d83e7 100644 --- a/services/screenservice/sinkservice/screenregionmgr/1.0/src/screenregionmgr.cpp +++ b/services/screenservice/sinkservice/screenregionmgr/1.0/src/screenregionmgr.cpp @@ -58,7 +58,7 @@ int32_t ScreenRegionManager::ReleaseAllRegions() } int32_t ret = screenRegion->Stop(); if (ret != DH_SUCCESS) { - DHLOGE("Release region failed, remoteDevId: %s, err: %" PRId32, + DHLOGE("Release region failed, remoteDevId: %{public}s, err: %{public}" PRId32, GetAnonyString(screenRegion->GetRemoteDevId()).c_str(), ret); } } @@ -69,7 +69,8 @@ int32_t ScreenRegionManager::ReleaseAllRegions() void ScreenRegionManager::HandleDScreenNotify(const std::string &remoteDevId, int32_t eventCode, const std::string &eventContent) { - DHLOGI("HandleDScreenNotify, remoteDevId: %s, eventCode: %" PRId32, GetAnonyString(remoteDevId).c_str(), eventCode); + DHLOGI("HandleDScreenNotify, remoteDevId: %{public}s, eventCode: %{public}" PRId32, + GetAnonyString(remoteDevId).c_str(), eventCode); if (eventCode == NOTIFY_SINK_SETUP) { HandleNotifySetUp(remoteDevId, eventContent); return; @@ -130,7 +131,7 @@ bool ScreenRegionManager::CheckContentJson(json &eventContentJson) void ScreenRegionManager::HandleNotifySetUp(const std::string &remoteDevId, const std::string &eventContent) { - DHLOGI("HandleNotifySetUp, remoteDevId: %s", GetAnonyString(remoteDevId).c_str()); + DHLOGI("HandleNotifySetUp, remoteDevId: %{public}s", GetAnonyString(remoteDevId).c_str()); json eventContentJson = json::parse(eventContent, nullptr, false); if (eventContentJson.is_discarded()||!CheckContentJson(eventContentJson) || !eventContentJson.contains(KEY_VIDEO_PARAM) || !eventContentJson.contains(KEY_MAPRELATION)) { @@ -162,7 +163,7 @@ void ScreenRegionManager::HandleNotifySetUp(const std::string &remoteDevId, cons } if (ret != DH_SUCCESS) { - DHLOGE("screenRegion stop failed, remoteDevId: %s, err: %" PRId32, + DHLOGE("screenRegion stop failed, remoteDevId: %{public}s, err: %{public}" PRId32, GetAnonyString(screenRegions_[remoteDevId]->GetRemoteDevId()).c_str(), ret); NotifyRemoteSourceSetUpResult(remoteDevId, dhId, ERR_DH_SCREEN_SA_SCREENREGION_SETUP_FAIL, ""); return; @@ -189,7 +190,7 @@ void ScreenRegionManager::HandleNotifySetUp(const std::string &remoteDevId, cons void ScreenRegionManager::NotifyRemoteSourceSetUpResult(const std::string &remoteDevId, const std::string &dhId, int32_t errCode, const std::string &errContent) { - DHLOGI("NotifyRemoteSourceSetUpResult, sourceDevId: %s, dhId: %s, errCode: %" PRId32, + DHLOGI("NotifyRemoteSourceSetUpResult, sourceDevId: %{public}s, dhId: %{public}s, errCode: %{public}" PRId32, GetAnonyString(remoteDevId).c_str(), GetAnonyString(dhId).c_str(), errCode); int32_t eventCode = NOTIFY_SOURCE_SETUP_RESULT; @@ -206,7 +207,7 @@ void ScreenRegionManager::NotifyRemoteSourceSetUpResult(const std::string &remot int32_t ScreenRegionManager::NotifyRemoteScreenService(const std::string &remoteDevId, const std::string &dhId, int32_t eventCode, const std::string &eventContent) { - DHLOGI("Notify remote source screen service, remote devId: %s, eventCode: %" PRId32, + DHLOGI("Notify remote source screen service, remote devId: %{public}s, eventCode: %{public}" PRId32, GetAnonyString(remoteDevId).c_str(), eventCode); sptr remoteSourceSA = GetDScreenSourceSA(remoteDevId); if (remoteSourceSA == nullptr) { @@ -226,7 +227,7 @@ int32_t ScreenRegionManager::NotifyRemoteScreenService(const std::string &remote sptr ScreenRegionManager::GetDScreenSourceSA(const std::string &devId) { - DHLOGI("GetDScreenSourceSA, devId: %s", GetAnonyString(devId).c_str()); + DHLOGI("GetDScreenSourceSA, devId: %{public}s", GetAnonyString(devId).c_str()); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (samgr == nullptr) { diff --git a/services/screenservice/sinkservice/screenregionmgr/2.0/src/av_receiver_engine_adapter.cpp b/services/screenservice/sinkservice/screenregionmgr/2.0/src/av_receiver_engine_adapter.cpp index 9a61a513c5f52c6b4f7c9e9b73db75788344871d..1fd7f141f5260770c6491850d9946eb8d42ab7cc 100644 --- a/services/screenservice/sinkservice/screenregionmgr/2.0/src/av_receiver_engine_adapter.cpp +++ b/services/screenservice/sinkservice/screenregionmgr/2.0/src/av_receiver_engine_adapter.cpp @@ -96,7 +96,7 @@ int32_t AVTransReceiverAdapter::Stop() } int32_t ret = receiverEngine_->Stop(); if (ret != DH_AVT_SUCCESS) { - DHLOGE("stop av transport receiver engine failed, ret:%" PRId32, ret); + DHLOGE("stop av transport receiver engine failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_STOP_FAILED; } DHLOGI("Stop Success"); @@ -112,7 +112,7 @@ int32_t AVTransReceiverAdapter::SetParameter(const AVTransTag &tag, const std::s } int32_t ret = receiverEngine_->SetParameter(tag, param); if (ret != DH_AVT_SUCCESS) { - DHLOGE("set av transport receiver parameter failed, ret:%" PRId32, ret); + DHLOGE("set av transport receiver parameter failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_SETUP_FAILED; } return DH_SUCCESS; @@ -127,7 +127,7 @@ int32_t AVTransReceiverAdapter::SendMessageToRemote(const std::shared_ptrSendMessage(message); if (ret != DH_AVT_SUCCESS) { - DHLOGE("send meassage to remote sender engine failed, ret:%" PRId32, ret); + DHLOGE("send meassage to remote sender engine failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_SEND_MSG_FAILED; } return DH_SUCCESS; @@ -144,7 +144,7 @@ int32_t AVTransReceiverAdapter::RegisterAdapterCallback(const std::shared_ptr &messag return; } - DHLOGI("On source device engine message received, message type =%d.", message->type_); + DHLOGI("On source device engine message received, message type =%{public}d.", message->type_); if (message->type_ == DScreenMsgType::START_MIRROR) { int32_t ret = StartReceiverEngine(message->content_); DScreenMsgType msgType = (ret == DH_SUCCESS) ? DScreenMsgType::START_MIRROR_SUCCESS : @@ -289,7 +289,7 @@ void ScreenRegion::GetWSBuffer(sptr &wsBuffer, const std::s int32_t ret = memcpy_s(wsBufAddr + dstOffset, chromaOffset - dstOffset, bufferAddr + srcOffset, videoParam_->GetVideoWidth()); if (ret != EOK) { - DHLOGE("memcpy video buffer y data failed,ret: %d.", ret); + DHLOGE("memcpy video buffer y data failed,ret: %{public}d.", ret); windowSurface_->CancelBuffer(wsBuffer); return; } @@ -304,7 +304,7 @@ void ScreenRegion::GetWSBuffer(sptr &wsBuffer, const std::s int32_t ret = memcpy_s(wsBufAddr + dstOffset, wsBufSize - dstOffset, bufferAddr + srcOffset, videoParam_->GetVideoWidth()); if (ret != EOK) { - DHLOGE("memcpy video buffer uv data failed,ret: %d.", ret); + DHLOGE("memcpy video buffer uv data failed,ret: %{public}d.", ret); windowSurface_->CancelBuffer(wsBuffer); return; } @@ -336,7 +336,7 @@ void ScreenRegion::OnEngineDataDone(const std::shared_ptr &buffer }; SurfaceError surfaceErr = windowSurface_->RequestBuffer(wsBuffer, releaseFence, requestConfig); if (surfaceErr != SURFACE_ERROR_OK || wsBuffer == nullptr) { - DHLOGE("surface request buffer failed, surfaceErr: %d.", surfaceErr); + DHLOGE("surface request buffer failed, surfaceErr: %{public}d.", surfaceErr); windowSurface_->CancelBuffer(wsBuffer); return; } @@ -356,11 +356,11 @@ void ScreenRegion::OnEngineDataDone(const std::shared_ptr &buffer surfaceErr = windowSurface_->FlushBuffer(wsBuffer, -1, flushConfig); FinishTrace(DSCREEN_HITRACE_LABEL); if (surfaceErr != SURFACE_ERROR_OK) { - DHLOGE("surface flush buffer failed, surfaceErr: %d.", surfaceErr); + DHLOGE("surface flush buffer failed, surfaceErr: %{public}d.", surfaceErr); windowSurface_->CancelBuffer(wsBuffer); return; } - DHLOGI("Fill video buffer data to window surface success. frameNumber: %zu", frameNumber_.load()); + DHLOGI("Fill video buffer data to window surface success. frameNumber: %{public}" PRIu32, frameNumber_.load()); } uint64_t ScreenRegion::GetScreenId() diff --git a/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregionmgr.cpp b/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregionmgr.cpp index e607f2fcb9295ccf404cf4329df1d69bc9422f75..c0322839d67b155a86e3b42d1dfde54d297a32dd 100644 --- a/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregionmgr.cpp +++ b/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregionmgr.cpp @@ -85,7 +85,7 @@ int32_t ScreenRegionManager::Release() } int32_t ret = screenRegion->Release(); if (ret != DH_SUCCESS) { - DHLOGE("Release region failed, remoteDevId: %s, err: %" PRId32, + DHLOGE("Release region failed, remoteDevId: %{public}s, err: %{public}" PRId32, GetAnonyString(screenRegion->GetRemoteDevId()).c_str(), ret); } } @@ -96,7 +96,7 @@ int32_t ScreenRegionManager::Release() int32_t ScreenRegionManager::CreateDScreenRegion(const std::string &peerDevId) { - DHLOGI("CreateDScreenRegion for peerDevId: %s", GetAnonyString(peerDevId).c_str()); + DHLOGI("CreateDScreenRegion for peerDevId: %{public}s", GetAnonyString(peerDevId).c_str()); auto screenRegion = std::make_shared(peerDevId); screenRegion->InitReceiverEngine(providerPtr_); screenRegions_.push_back(screenRegion); @@ -105,7 +105,7 @@ int32_t ScreenRegionManager::CreateDScreenRegion(const std::string &peerDevId) int32_t ScreenRegionManager::DestoryDScreenRegion(const std::string &peerDevId) { - DHLOGI("DestoryDScreenRegion for peerDevId: %s", GetAnonyString(peerDevId).c_str()); + DHLOGI("DestoryDScreenRegion for peerDevId: %{public}s", GetAnonyString(peerDevId).c_str()); std::lock_guard lock(screenRegionsMtx_); for (const auto ®ion : screenRegions_) { if (region != nullptr) { @@ -169,12 +169,12 @@ int32_t ScreenRegionManager::LoadAVReceiverEngineProvider() } void *pHandler = dlopen(path, RTLD_LAZY | RTLD_NODELETE); if (pHandler == nullptr) { - DHLOGE("%s handler load failed, failed reason : %s", path, dlerror()); + DHLOGE("%{public}s handler load failed, failed reason : %{public}s", path, dlerror()); return ERR_DH_AV_TRANS_NULL_VALUE; } AVTransProviderClass getEngineFactoryFunc = (AVTransProviderClass)dlsym(pHandler, GET_PROVIDER_FUNC.c_str()); if (getEngineFactoryFunc == nullptr) { - DHLOGE("av transport engine factory function handler is null, failed reason : %s", dlerror()); + DHLOGE("av transport engine factory function handler is null, failed reason : %{public}s", dlerror()); dlclose(pHandler); pHandler = nullptr; return ERR_DH_AV_TRANS_NULL_VALUE; @@ -202,7 +202,7 @@ int32_t ScreenRegionManager::UnloadAVReceiverEngineProvider() int32_t EngineProviderListener::OnProviderEvent(const AVTransEvent& event) { - DHLOGI("OnProviderEvent enter. event type:%" PRId32, event.type); + DHLOGI("OnProviderEvent enter. event type:%{public}" PRId32, event.type); if (event.type == EventType::EVENT_CHANNEL_OPENED) { ScreenRegionManager::GetInstance().CreateDScreenRegion(event.peerDevId); } else if (event.type == EventType::EVENT_CHANNEL_CLOSED) { diff --git a/services/screenservice/sourceservice/BUILD.gn b/services/screenservice/sourceservice/BUILD.gn index f9578d86ccea07b960dceba643313f24d27785c7..0882306c206bb78e6b978659e62eaf26ca5cfb9c 100644 --- a/services/screenservice/sourceservice/BUILD.gn +++ b/services/screenservice/sourceservice/BUILD.gn @@ -98,6 +98,7 @@ ohos_shared_library("distributed_screen_source") { "graphic_2d:librender_service_client", "graphic_surface:surface", "hicollie:libhicollie", + "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_core", diff --git a/services/screenservice/sourceservice/dscreenmgr/1.0/src/dscreen.cpp b/services/screenservice/sourceservice/dscreenmgr/1.0/src/dscreen.cpp index c2537fafcdcc621e0766a2c6b5ced17974264935..1d60a7891319dfaa0549540fdb8ea60432ca6e4c 100644 --- a/services/screenservice/sourceservice/dscreenmgr/1.0/src/dscreen.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/1.0/src/dscreen.cpp @@ -35,7 +35,7 @@ constexpr const char* TASK_THREAD = "TaskThread"; DScreen::DScreen(const std::string &devId, const std::string &dhId, std::shared_ptr dscreenCallback) { - DHLOGD("DScreen construct, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), + DHLOGD("DScreen construct, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); devId_ = devId; dhId_ = dhId; @@ -47,7 +47,7 @@ DScreen::DScreen(const std::string &devId, const std::string &dhId, DScreen::~DScreen() { - DHLOGD("DScreen deconstruct, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGD("DScreen deconstruct, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); taskThreadRunning_ = false; taskQueueCond_.notify_all(); @@ -59,7 +59,7 @@ DScreen::~DScreen() ret = sourceTrans_->Release(); } if (ret != DH_SUCCESS) { - DHLOGE("source trans release failed. ret: %" PRId32, ret); + DHLOGE("source trans release failed. ret: %{public}" PRId32, ret); } if (screenId_ != SCREEN_ID_INVALID) { @@ -76,7 +76,7 @@ DScreen::~DScreen() void DScreen::OnTransError(int32_t err, const std::string &content) { - DHLOGW("OnTransError, err: %" PRId32, err); + DHLOGW("OnTransError, err: %{public}" PRId32, err); AddTask(std::make_shared(TaskType::TASK_DISCONNECT, "")); ScreenMgrAdapter::GetInstance().RemoveScreenFromGroup(screenId_); } @@ -129,13 +129,13 @@ std::string DScreen::GetDevId() const int32_t DScreen::AddTask(const std::shared_ptr &task) { - DHLOGI("DScreen::AddTask, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGI("DScreen::AddTask, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); if (task == nullptr) { DHLOGE("AddTask, task is invalid."); return ERR_DH_SCREEN_SA_DSCREEN_TASK_NOT_VALID; } - DHLOGI("AddTask, task type: %" PRId32, task->GetTaskType()); + DHLOGI("AddTask, task type: %{public}" PRId32, task->GetTaskType()); { std::lock_guard lock(taskQueueMtx_); taskQueue_.push(task); @@ -146,11 +146,11 @@ int32_t DScreen::AddTask(const std::shared_ptr &task) void DScreen::TaskThreadLoop() { - DHLOGI("DScreen taskThread start. devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGI("DScreen taskThread start. devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); int32_t ret = pthread_setname_np(pthread_self(), TASK_THREAD); if (ret != DH_SUCCESS) { - DHLOGE("Dscreen set thread name failed, ret %" PRId32, ret); + DHLOGE("Dscreen set thread name failed, ret %{public}" PRId32, ret); } while (taskThreadRunning_) { std::shared_ptr task; @@ -170,7 +170,7 @@ void DScreen::TaskThreadLoop() continue; } - DHLOGD("run task, task queue size: %zu", taskQueue_.size()); + DHLOGD("run task, task queue size: %{public}zu", taskQueue_.size()); HandleTask(task); } } @@ -178,7 +178,8 @@ void DScreen::TaskThreadLoop() void DScreen::HandleTask(const std::shared_ptr &task) { int32_t taskType = task->GetTaskType(); - DHLOGI("HandleTask, devId: %s, dhId: %s, task type: %" PRId32, GetAnonyString(devId_).c_str(), + DHLOGI("HandleTask, devId: %{public}s, dhId: %{public}s, task type: %{public}" PRId32, + GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(), taskType); switch (taskType) { case TaskType::TASK_ENABLE: @@ -209,7 +210,8 @@ void DScreen::HandleEnable(const std::string ¶m, const std::string &taskId) DHLOGE("DScreen::HandleEnable, dscreenCallback_ is nullptr"); return; } - DHLOGI("HandleEnable, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("HandleEnable, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); if (curState_ == ENABLED || curState_ == ENABLING || curState_ == CONNECTING || curState_ == CONNECTED) { dscreenCallback_->OnRegResult(shared_from_this(), taskId, DH_SUCCESS, "dscreen enable success."); return; @@ -326,7 +328,8 @@ void DScreen::HandleDisable(const std::string &taskId) DHLOGE("DScreen::HandleDisable, dscreenCallback_ is nullptr"); return; } - DHLOGI("HandleDisable, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("HandleDisable, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); SetState(DISABLING); int32_t ret = ScreenMgrAdapter::GetInstance().RemoveVirtualScreen(screenId_); if (ret != DH_SUCCESS) { @@ -345,7 +348,7 @@ void DScreen::HandleDisable(const std::string &taskId) void DScreen::HandleConnect() { - DHLOGI("HandleConnect, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGI("HandleConnect, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); int32_t ret = SetUp(); @@ -370,7 +373,7 @@ void DScreen::HandleConnect() void DScreen::HandleDisconnect() { - DHLOGD("HandleDisconnect, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGD("HandleDisconnect, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); if (curState_ != CONNECTED) { DHLOGE("dscreen is not connected, cannot disconnect"); @@ -391,7 +394,7 @@ void DScreen::HandleDisconnect() int32_t DScreen::SetUp() { - DHLOGD("SetUp, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGD("SetUp, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); if (sourceTrans_ == nullptr) { @@ -410,7 +413,7 @@ int32_t DScreen::SetUp() int32_t DScreen::Start() { - DHLOGD("Start, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGD("Start, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); if (sourceTrans_ == nullptr) { DHLOGE("source trans not init."); @@ -432,7 +435,7 @@ int32_t DScreen::Start() int32_t DScreen::Stop() { - DHLOGD("Stop, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGD("Stop, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); if (sourceTrans_ == nullptr) { DHLOGE("source trans not init."); diff --git a/services/screenservice/sourceservice/dscreenmgr/1.0/src/dscreen_manager.cpp b/services/screenservice/sourceservice/dscreenmgr/1.0/src/dscreen_manager.cpp index 0e5772e3f07a140328688ec345e903c1b891725b..f0db730c5ac9231147764d7fb39df58f4a1af5b8 100644 --- a/services/screenservice/sourceservice/dscreenmgr/1.0/src/dscreen_manager.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/1.0/src/dscreen_manager.cpp @@ -82,11 +82,11 @@ int32_t DScreenManager::UnInit() void DScreenGroupListener::OnChange(const std::vector &screenIds, Rosen::ScreenGroupChangeEvent event) { - DHLOGI("On Screen change, screenIds size: %" PRId32, screenIds.size()); + DHLOGI("On Screen change, screenIds size: %{public}zu", screenIds.size()); for (uint64_t screenId : screenIds) { std::shared_ptr changedScreen = DScreenManager::GetInstance().FindDScreenByScreenId(screenId); if (changedScreen == nullptr) { - DHLOGD("screen change not about remote screen, screenId: %" PRIu64, screenId); + DHLOGD("screen change not about remote screen, screenId: %{public}" PRIu64, screenId); continue; } DScreenManager::GetInstance().HandleScreenChange(changedScreen, event); @@ -102,7 +102,8 @@ void DScreenManager::HandleScreenChange(const std::shared_ptr &changedS } uint64_t screenId = changedScreen->GetScreenId(); - DHLOGI("DScreenManager::HandleScreenChange, screenId: %" PRIu64", changeEvent: %" PRIu64, screenId, event); + DHLOGI("DScreenManager::HandleScreenChange, screenId: %{public}" PRIu64 ", changeEvent: %{public}" PRIu32, + screenId, event); if (event == Rosen::ScreenGroupChangeEvent::ADD_TO_GROUP) { if (AddToGroup(changedScreen, screenId) != DH_SUCCESS) { DHLOGE("AddToGroup failed."); @@ -124,7 +125,7 @@ void DScreenManager::HandleScreenChange(const std::shared_ptr &changedS int32_t DScreenManager::AddToGroup(const std::shared_ptr &changedScreen, uint64_t screenId) { - DHLOGI("DScreenManager::ADDToGroup, screenId: %" PRIu64, screenId); + DHLOGI("DScreenManager::ADDToGroup, screenId: %{public}" PRIu64, screenId); if (changedScreen == nullptr) { DHLOGE("DScreenManager::ADDToGroup, dScreen is null."); return ERR_DH_SCREEN_SA_VALUE_NOT_INIT; @@ -136,7 +137,7 @@ int32_t DScreenManager::AddToGroup(const std::shared_ptr &changedScreen } std::shared_ptr mapRelation = ScreenMgrAdapter::GetInstance().GetMapRelation(screenId); if (mapRelation == nullptr) { - DHLOGE("mapRelation construct failed. screenId: %" PRIu64, screenId); + DHLOGE("mapRelation construct failed. screenId: %{public}" PRIu64, screenId); return ERR_DH_SCREEN_SA_VALUE_NOT_INIT; } @@ -159,7 +160,7 @@ int32_t DScreenManager::AddToGroup(const std::shared_ptr &changedScreen int32_t DScreenManager::RemoveFromGroup(const std::shared_ptr &changedScreen, uint64_t screenId) { - DHLOGI("DScreenManager::RemoveFromGroup, screenId: %" PRIu64, screenId); + DHLOGI("DScreenManager::RemoveFromGroup, screenId: %{public}" PRIu64, screenId); if (changedScreen == nullptr) { DHLOGE("DScreenManager::RemoveFromGroup, dScreen is null."); return ERR_DH_SCREEN_SA_VALUE_NOT_INIT; @@ -185,7 +186,7 @@ void DScreenCallback::OnRegResult(const std::shared_ptr &dScreen, DHLOGE("DScreenCallback::OnRegResult, dScreen id nullptr"); return; } - DHLOGI("DScreenCallback::OnRegResult, devId: %s, dhId: %s, reqId: %s", + DHLOGI("DScreenCallback::OnRegResult, devId: %{public}s, dhId: %{public}s, reqId: %{public}s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), GetAnonyString(reqId).c_str()); DScreenManager::GetInstance().OnRegResult(dScreen, reqId, status, data); @@ -198,7 +199,7 @@ void DScreenCallback::OnUnregResult(const std::shared_ptr &dScreen, DHLOGE("DScreenCallback::OnUnregResult, dScreen id nullptr"); return; } - DHLOGI("DScreenCallback::OnUnregResult, devId: %s, dhId: %s, reqId: %s", + DHLOGI("DScreenCallback::OnUnregResult, devId: %{public}s, dhId: %{public}s, reqId: %{public}s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), GetAnonyString(reqId).c_str()); DScreenManager::GetInstance().OnUnregResult(dScreen, reqId, status, data); @@ -207,7 +208,7 @@ void DScreenCallback::OnUnregResult(const std::shared_ptr &dScreen, void DScreenManager::OnRegResult(const std::shared_ptr &dScreen, const std::string &reqId, const int32_t status, const std::string &data) { - DHLOGI("DScreenManager::OnRegResult, devId: %s, dhId: %s, reqId: %s", + DHLOGI("DScreenManager::OnRegResult, devId: %{public}s, dhId: %{public}s, reqId: %{public}s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), GetAnonyString(reqId).c_str()); if (dScreenSourceCallbackProxy_ == nullptr) { @@ -220,7 +221,7 @@ void DScreenManager::OnRegResult(const std::shared_ptr &dScreen, void DScreenManager::OnUnregResult(const std::shared_ptr &dScreen, const std::string &reqId, const int32_t status, const std::string &data) { - DHLOGI("DScreenManager::OnUnregResult, devId: %s, dhId: %s, reqId: %s", + DHLOGI("DScreenManager::OnUnregResult, devId: %{public}s, dhId: %{public}s, reqId: %{public}s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), GetAnonyString(reqId).c_str()); if (dScreenSourceCallbackProxy_ == nullptr) { @@ -233,7 +234,7 @@ void DScreenManager::OnUnregResult(const std::shared_ptr &dScreen, int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const std::string &dhId, const EnableParam ¶m, const std::string &reqId) { - DHLOGI("EnableDistributedScreen1.0, devId: %s, dhId:%s", + DHLOGI("EnableDistributedScreen1.0, devId: %{public}s, dhId:%{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); if (devId.empty() || dhId.empty() || param.sinkVersion.empty() || param.sinkAttrs.empty() || reqId.empty()) { DHLOGE("EnableDistributedScreen1.0 CheckRegParams is inlvalid."); @@ -243,7 +244,7 @@ int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const dScreenGroupListener_ = new (std::nothrow) DScreenGroupListener(); int32_t ret = ScreenMgrAdapter::GetInstance().RegisterScreenGroupListener(dScreenGroupListener_); if (ret != DH_SUCCESS) { - DHLOGE("DScreenManager1.0 EnableDistributedScreen failed, err: %" PRId32, ret); + DHLOGE("DScreenManager1.0 EnableDistributedScreen failed, err: %{public}" PRId32, ret); dScreenGroupListener_ = nullptr; return ERR_DH_SCREEN_SA_ENABLE_FAILED; } @@ -267,7 +268,7 @@ int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const dScreens_[dScreenIdx] = dScreen; int32_t ret = dScreen->AddTask(std::make_shared(TaskType::TASK_ENABLE, reqId, param.sinkAttrs)); if (ret != DH_SUCCESS) { - DHLOGE("EnableDistributedScreen, add task failed. devId: %s, dhId:%s", + DHLOGE("EnableDistributedScreen, add task failed. devId: %{public}s, dhId:%{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); } @@ -277,13 +278,13 @@ int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const int32_t DScreenManager::DisableDistributedScreen(const std::string &devId, const std::string &dhId, const std::string &reqId) { - DHLOGI("DisableDistributedScreen, devId: %s, dhId:%s", + DHLOGI("DisableDistributedScreen, devId: %{public}s, dhId:%{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); std::string dScreenIdx = devId + SEPERATOR + dhId; std::lock_guard lock(dScreenMapMtx_); if (dScreens_.count(dScreenIdx) == 0) { - DHLOGE("dscreen has already disabled, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), + DHLOGE("dscreen has already disabled, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); return DH_SUCCESS; } @@ -326,7 +327,7 @@ void DScreenManager::RegisterDScreenCallback(const sptr std::shared_ptr DScreenManager::FindDScreenByScreenId(uint64_t screenId) { - DHLOGD("FindDScreenByScreenId, screenId: %" PRIu64, screenId); + DHLOGD("FindDScreenByScreenId, screenId: %{public}" PRIu64, screenId); std::lock_guard lock(dScreenMapMtx_); for (const auto &iter : dScreens_) { std::shared_ptr dScreen = iter.second; @@ -338,7 +339,7 @@ std::shared_ptr DScreenManager::FindDScreenByScreenId(uint64_t screenId return dScreen; } } - DHLOGD("DScreen not found, screenId: %" PRIu64, screenId); + DHLOGD("DScreen not found, screenId: %{public}" PRIu64, screenId); return nullptr; } @@ -385,19 +386,20 @@ void DScreenManager::GetScreenDumpInfo(std::string &result) void DScreenManager::HandleDScreenNotify(const std::string &devId, int32_t eventCode, const std::string &eventContent) { - DHLOGI("HandleDScreenNotify, devId: %s, eventCode: %" PRId32, GetAnonyString(devId).c_str(), eventCode); + DHLOGI("HandleDScreenNotify, devId: %{public}s, eventCode: %{public}" PRId32, GetAnonyString(devId).c_str(), + eventCode); if (eventCode == NOTIFY_SOURCE_SETUP_RESULT) { HandleNotifySetUpResult(devId, eventContent); return; } - DHLOGE("invalid eventCode, eventCode: %" PRId32, eventCode); + DHLOGE("invalid eventCode, eventCode: %{public}" PRId32, eventCode); } int32_t DScreenManager::NotifyRemoteScreenService(const std::string &devId, int32_t eventCode, const std::string &eventContent) { - DHLOGI("Notify remote sink screen service, remote devId: %s, eventCode: %" PRId32, + DHLOGI("Notify remote sink screen service, remote devId: %{public}s, eventCode: %{public}" PRId32, GetAnonyString(devId).c_str(), eventCode); sptr remoteSinkSA = GetDScreenSinkSA(devId); if (remoteSinkSA == nullptr) { @@ -417,7 +419,7 @@ int32_t DScreenManager::NotifyRemoteScreenService(const std::string &devId, int3 sptr DScreenManager::GetDScreenSinkSA(const std::string &devId) { - DHLOGI("GetDScreenSinkSA, devId: %s", GetAnonyString(devId).c_str()); + DHLOGI("GetDScreenSinkSA, devId: %{public}s", GetAnonyString(devId).c_str()); sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (samgr == nullptr) { @@ -477,21 +479,21 @@ void DScreenManager::NotifyRemoteSinkSetUp(const std::shared_ptr &dScre eventContentJson[KEY_SCREEN_ID] = dScreen->GetScreenId(); eventContentJson[KEY_DH_ID] = dScreen->GetDHId(); if (dScreen->GetVideoParam() == nullptr) { - DHLOGE("videoParam is null, back to enabled state screedId: %u", dScreen->GetScreenId()); + DHLOGE("videoParam is null, back to enabled state screedId: %{public}" PRIu64, dScreen->GetScreenId()); dScreen->SetState(ENABLED); return; } eventContentJson[KEY_VIDEO_PARAM] = *(dScreen->GetVideoParam()); eventContentJson[KEY_VERSION] = dScreen->GetScreenVersion(); if (mapRelations_.count(dScreen->GetScreenId()) == 0) { - DHLOGE("mapRelation not found, back to enabled state screedId: %u", dScreen->GetScreenId()); + DHLOGE("mapRelation not found, back to enabled state screedId: %{public}" PRIu64, dScreen->GetScreenId()); dScreen->SetState(ENABLED); return; } eventContentJson[KEY_MAPRELATION] = *(mapRelations_[dScreen->GetScreenId()]); std::string eventContent = eventContentJson.dump(); - DHLOGD("start notify remote screen, eventContent: %s", eventContent.c_str()); + DHLOGD("start notify remote screen, eventContent: %{public}s", eventContent.c_str()); NotifyRemoteScreenService(devId, eventCode, eventContent); } @@ -511,7 +513,7 @@ bool DScreenManager::CheckContent(json &eventContent) void DScreenManager::HandleNotifySetUpResult(const std::string &remoteDevId, const std::string &eventContent) { - DHLOGI("HandleNotifySetUpResult, remoteDevId:%s", GetAnonyString(remoteDevId).c_str()); + DHLOGI("HandleNotifySetUpResult, remoteDevId:%{public}s", GetAnonyString(remoteDevId).c_str()); json eventContentJson = json::parse(eventContent, nullptr, false); if (eventContentJson.is_discarded()) { DHLOGE("HandleNotifySetUpResult, eventContent is invalid"); @@ -530,13 +532,14 @@ void DScreenManager::HandleNotifySetUpResult(const std::string &remoteDevId, con std::string dScreenIdx = remoteDevId + SEPERATOR + dhId; std::lock_guard lock(dScreenMapMtx_); if (dScreens_.count(dScreenIdx) == 0) { - DHLOGE("dScreen not found, remoteDevId:%s, dhId:%s", + DHLOGE("dScreen not found, remoteDevId:%{public}s, dhId:%{public}s", GetAnonyString(remoteDevId).c_str(), GetAnonyString(dhId).c_str()); return; } if (errCode != DH_SUCCESS) { - DHLOGE("remote sink set up failed, errCode: %" PRId32", reason: %s", errCode, errContent.c_str()); + DHLOGE("remote sink set up failed, errCode: %{public}" PRId32 ", reason: %{public}s", errCode, + errContent.c_str()); if (dScreens_[dScreenIdx] == nullptr) { DHLOGE("dScreen is nullptr."); return; diff --git a/services/screenservice/sourceservice/dscreenmgr/2.0/include/dscreen.h b/services/screenservice/sourceservice/dscreenmgr/2.0/include/dscreen.h index 1cb9ae327af1db93026a3c164195eb7d2d199dba..93feea2fa611488f65f0723f30b5d1b34ccba0b7 100644 --- a/services/screenservice/sourceservice/dscreenmgr/2.0/include/dscreen.h +++ b/services/screenservice/sourceservice/dscreenmgr/2.0/include/dscreen.h @@ -81,7 +81,7 @@ public: ~ConsumBufferListener() = default; void OnBufferAvailable() override; private: - static const constexpr char *LOG_TAG = "ConsumBufferListener"; + static const constexpr char *DSCREEN_LOG_TAG = "ConsumBufferListener"; std::shared_ptr dScreen_; }; diff --git a/services/screenservice/sourceservice/dscreenmgr/2.0/src/av_sender_engine_adapter.cpp b/services/screenservice/sourceservice/dscreenmgr/2.0/src/av_sender_engine_adapter.cpp index 1b0d09936bd0cfd46a5c94cd0a37e3687ef9f246..f2cbbe24d00944c01c612f2013865916bb5bcf02 100644 --- a/services/screenservice/sourceservice/dscreenmgr/2.0/src/av_sender_engine_adapter.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/2.0/src/av_sender_engine_adapter.cpp @@ -77,7 +77,7 @@ int32_t AVTransSenderAdapter::Start() } int32_t ret = senderEngine_->Start(); if (ret != DH_AVT_SUCCESS) { - DHLOGE("start av transport sender engine failed, ret:%" PRId32, ret); + DHLOGE("start av transport sender engine failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_START_FAILED; } DHLOGI("Start Success"); @@ -93,7 +93,7 @@ int32_t AVTransSenderAdapter::Stop() } int32_t ret = senderEngine_->Stop(); if (ret != DH_AVT_SUCCESS) { - DHLOGE("stop av transport sender engine failed, ret:%" PRId32, ret); + DHLOGE("stop av transport sender engine failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_STOP_FAILED; } DHLOGI("Stop Success"); @@ -103,7 +103,7 @@ int32_t AVTransSenderAdapter::Stop() int32_t AVTransSenderAdapter::CreateControlChannel(const std::string& peerDevId) { - DHLOGI("CreateControlChannel enter, peerDevId:%s", GetAnonyString(peerDevId).c_str()); + DHLOGI("CreateControlChannel enter, peerDevId:%{public}s", GetAnonyString(peerDevId).c_str()); if (chnCreateSuccess_.load()) { DHLOGI("av transport sender channel already created"); return DH_SUCCESS; @@ -117,15 +117,15 @@ int32_t AVTransSenderAdapter::CreateControlChannel(const std::string& peerDevId) int32_t ret = senderEngine_->CreateControlChannel(dstDevIds, ChannelAttribute{TransStrategy::LOW_LATANCY_STRATEGY}); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_AVT_SUCCESS) { - DHLOGE("create av transport sender channel failed, ret:%" PRId32, ret); + DHLOGE("create av transport sender channel failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_CREATE_CHANNEL_FAILED; } ret = WaitForChannelCreated(); if (ret != DH_SUCCESS) { - DHLOGE("wait for create av transport sender channel failed, ret:%" PRId32, ret); + DHLOGE("wait for create av transport sender channel failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_CREATE_CHANNEL_FAILED; } - DHLOGI("CreateControlChannel Success, peerDevId:%s", GetAnonyString(peerDevId).c_str()); + DHLOGI("CreateControlChannel Success, peerDevId:%{public}s", GetAnonyString(peerDevId).c_str()); return DH_SUCCESS; } @@ -138,7 +138,7 @@ int32_t AVTransSenderAdapter::SetParameter(const AVTransTag &tag, const std::str } int32_t ret = senderEngine_->SetParameter(tag, param); if (ret != DH_AVT_SUCCESS) { - DHLOGE("set av transport sender parameter failed, ret:%" PRId32, ret); + DHLOGE("set av transport sender parameter failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_SETUP_FAILED; } return DH_SUCCESS; @@ -173,7 +173,7 @@ int32_t AVTransSenderAdapter::PushData(const VideoData &video) int32_t ret = senderEngine_->PushData(transBuffer); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_AVT_SUCCESS) { - DHLOGE("feed data to av transport sender failed, ret:%" PRId32, ret); + DHLOGE("feed data to av transport sender failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_FEED_DATA_FAILED; } return DH_SUCCESS; @@ -188,7 +188,7 @@ int32_t AVTransSenderAdapter::SendMessageToRemote(const std::shared_ptrSendMessage(message); if (ret != DH_AVT_SUCCESS) { - DHLOGE("send meassage to remote receiver engine failed, ret:%" PRId32, ret); + DHLOGE("send meassage to remote receiver engine failed, ret:%{public}" PRId32, ret); return ERR_DH_AV_TRANS_SEND_MSG_FAILED; } return DH_SUCCESS; @@ -237,7 +237,7 @@ int32_t AVTransSenderAdapter::WaitForAVTransStarted() int32_t AVTransSenderAdapter::OnSenderEvent(const AVTransEvent& event) { - DHLOGI("OnSenderEvent enter. event type:%" PRId32, event.type); + DHLOGI("OnSenderEvent enter. event type:%{public}" PRId32, event.type); switch (event.type) { case EventType::EVENT_CHANNEL_OPEN_FAIL: case EventType::EVENT_CHANNEL_OPENED: { diff --git a/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen.cpp b/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen.cpp index d4702fed89713dbd7661289e20e5c3b1710e54c9..63af917fc2d8639392455cd5ce63d15103c1faf9 100644 --- a/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen.cpp @@ -46,7 +46,7 @@ static const std::map, std::string> CODECS_M DScreen::DScreen(const std::string &devId, const std::string &dhId, std::shared_ptr dscreenCallback) { - DHLOGD("DScreen construct, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), + DHLOGD("DScreen construct, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); devId_ = devId; dhId_ = dhId; @@ -69,7 +69,7 @@ DScreen::DScreen(const std::string &devId, const std::string &dhId, DScreen::~DScreen() { - DHLOGD("DScreen deconstruct, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGD("DScreen deconstruct, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); taskThreadRunning_ = false; taskQueueCond_.notify_all(); @@ -86,12 +86,13 @@ DScreen::~DScreen() int32_t DScreen::AddTask(const std::shared_ptr &task) { - DHLOGI("DScreen::AddTask, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("DScreen::AddTask, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); if (task == nullptr) { DHLOGE("AddTask, task is invalid."); return ERR_DH_SCREEN_SA_DSCREEN_TASK_NOT_VALID; } - DHLOGI("AddTask, task type: %" PRId32, task->GetTaskType()); + DHLOGI("AddTask, task type: %{public}" PRId32, task->GetTaskType()); { std::lock_guard lock(taskQueueMtx_); taskQueue_.push(task); @@ -103,8 +104,8 @@ int32_t DScreen::AddTask(const std::shared_ptr &task) void DScreen::HandleTask(const std::shared_ptr &task) { int32_t taskType = task->GetTaskType(); - DHLOGI("HandleTask, devId: %s, dhId: %s, task type: %" PRId32, GetAnonyString(devId_).c_str(), - GetAnonyString(dhId_).c_str(), taskType); + DHLOGI("HandleTask, devId: %{public}s, dhId: %{public}s, task type: %{public}" PRId32, + GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str(), taskType); switch (taskType) { case TaskType::TASK_ENABLE: HandleEnable(task->GetTaskParam(), task->GetTaskId()); @@ -125,7 +126,8 @@ void DScreen::HandleTask(const std::shared_ptr &task) void DScreen::HandleEnable(const std::string ¶m, const std::string &taskId) { - DHLOGI("HandleEnable, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("HandleEnable, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); if (dscreenCallback_ == nullptr) { DHLOGE("DScreen::HandleEnable, dscreenCallback_ is nullptr"); return; @@ -189,7 +191,8 @@ void DScreen::ParseInputScreenParam(const std::string ¶m, const std::string void DScreen::HandleDisable(const std::string &taskId) { - DHLOGI("HandleDisable, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("HandleDisable, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); if (dscreenCallback_ == nullptr) { DHLOGE("DScreen::HandleDisable, dscreenCallback_ is nullptr"); return; @@ -212,7 +215,8 @@ void DScreen::HandleDisable(const std::string &taskId) void DScreen::HandleConnect() { - DHLOGI("HandleConnect, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("HandleConnect, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); if (GetState() != ENABLED) { DHLOGE("GetState is not ENABLED, HandleConnect failed."); return; @@ -239,7 +243,8 @@ void DScreen::HandleConnect() void DScreen::HandleDisconnect() { - DHLOGD("HandleDisconnect, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGD("HandleDisconnect, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); if (curState_ != CONNECTED) { DHLOGE("dscreen is not connected, cannot disconnect"); return; @@ -260,7 +265,8 @@ void DScreen::HandleDisconnect() int32_t DScreen::ConfigSurface() { - DHLOGD("ConfigSurface, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGD("ConfigSurface, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); consumerSurface_ = Surface::CreateSurfaceAsConsumer(); if (consumerSurface_ == nullptr) { DHLOGE("Create consumer surface failed."); @@ -329,13 +335,13 @@ void DScreen::ConsumeSurface() OHOS::Rect damage = {0, 0, 0, 0}; SurfaceError surfaceErr = consumerSurface_->AcquireBuffer(surfaceBuffer, syncFence_, timestamp, damage); if (surfaceErr != SURFACE_ERROR_OK) { - DHLOGE("consumerSurface_ acquire buffer failed, errcode: %d", surfaceErr); + DHLOGE("consumerSurface_ acquire buffer failed, errcode: %{public}d", surfaceErr); consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); return; } int32_t retcode = syncFence_->Wait(SURFACE_SYNC_FENCE_TIMEOUT); if (retcode == -ETIME) { - DHLOGE("Sync fence wait timeout, retcode is %" PRId32, retcode); + DHLOGE("Sync fence wait timeout, retcode is %{public}" PRId32, retcode); consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); return; } @@ -355,7 +361,7 @@ void DScreen::ConsumeSurface() DHLOGE("feed buffer to av transport sender failed."); } consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); - DHLOGI("ConsumeSurface success. timestamp=%lld", (long long)timestamp); + DHLOGI("ConsumeSurface success. timestamp=%{public}" PRId64, timestamp); } int32_t DScreen::InitSenderEngine(IAVEngineProvider *providerPtr, const std::string &peerDevId) @@ -374,7 +380,8 @@ int32_t DScreen::InitSenderEngine(IAVEngineProvider *providerPtr, const std::str int32_t DScreen::StartSenderEngine() { - DHLOGI("StartSenderEngine, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("StartSenderEngine, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); if (senderAdapter_ == nullptr) { DHLOGE("av transport sender adapter is null."); return ERR_DH_AV_TRANS_NULL_VALUE; @@ -399,7 +406,8 @@ int32_t DScreen::StartSenderEngine() int32_t DScreen::StopSenderEngine() { - DHLOGI("StopSenderEngine, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("StopSenderEngine, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), + GetAnonyString(dhId_).c_str()); if (senderAdapter_ == nullptr) { DHLOGE("av transport sender adapter is null."); return ERR_DH_AV_TRANS_NULL_VALUE; @@ -453,7 +461,7 @@ void DScreen::ChooseParameter(std::string &codecType, std::string &pixelFormat) int32_t DScreen::SetUp() { - DHLOGI("SetUp, devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); + DHLOGI("SetUp, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); if (senderAdapter_ == nullptr) { DHLOGE("av transport sender adapter is null."); return ERR_DH_AV_TRANS_NULL_VALUE; @@ -514,7 +522,7 @@ int32_t DScreen::WaitForSinkStarted() int32_t DScreen::NegotiateCodecType(const std::string &rmtDecoderStr) { - DHLOGI("Start NegotiateCodecType, remote decoder: %s", rmtDecoderStr.c_str()); + DHLOGI("Start NegotiateCodecType, remote decoder: %{public}s", rmtDecoderStr.c_str()); json rmtDecoderJson = json::parse(rmtDecoderStr, nullptr, false); if (rmtDecoderJson.is_discarded()) { DHLOGE("remote Decoder Json is invalid."); @@ -535,7 +543,7 @@ int32_t DScreen::NegotiateCodecType(const std::string &rmtDecoderStr) DHLOGE("Query local Codec info failed"); return ERR_DH_SCREEN_SA_DSCREEN_NEGOTIATE_CODEC_FAIL; } - DHLOGI("DScreen Negotiate QueryVideoEncoderAbility info: %s", localVideoEncodersJsonStr.c_str()); + DHLOGI("DScreen Negotiate QueryVideoEncoderAbility info: %{public}s", localVideoEncodersJsonStr.c_str()); json localVideoEncodersJson = json::parse(localVideoEncodersJsonStr, nullptr, false); if (localVideoEncodersJson.is_discarded()) { @@ -558,7 +566,7 @@ int32_t DScreen::ChooseCodecType(const std::vector &localVideoEnco std::pair comb = {locEnc.name, rmtDec.name}; if (CODECS_MAP.find(comb) != CODECS_MAP.end()) { std::string codec = CODECS_MAP.at(comb); - DHLOGI("Find match comb, local encoder: %s, remote decoder: %s, codec: %s", + DHLOGI("Find match comb, local encoder: %{public}s, remote decoder: %{public}s, codec: %{public}s", locEnc.name.c_str(), rmtDec.name.c_str(), codec.c_str()); codecTypeCandidates.push_back(codec); } @@ -581,7 +589,7 @@ int32_t DScreen::ChooseCodecType(const std::vector &localVideoEnco void DScreen::TaskThreadLoop() { - DHLOGI("DScreen taskThread start. devId: %s, dhId: %s", GetAnonyString(devId_).c_str(), + DHLOGI("DScreen taskThread start. devId: %{public}s, dhId: %{public}s", GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str()); while (taskThreadRunning_) { watchdogFlag_ = true; @@ -600,7 +608,7 @@ void DScreen::TaskThreadLoop() DHLOGD("task is null."); continue; } - DHLOGD("run task, task queue size: %zu", taskQueue_.size()); + DHLOGD("run task, task queue size: %{public}zu", taskQueue_.size()); HandleTask(task); } } @@ -635,7 +643,7 @@ void DScreen::OnEngineMessage(const std::shared_ptr &message) DHLOGE("received engine message is null."); return; } - DHLOGI("On sink device engine message received, message type =%d.", message->type_); + DHLOGI("On sink device engine message received, message type =%{public}d.", message->type_); if ((message->type_ == DScreenMsgType::START_MIRROR_SUCCESS) || (message->type_ == DScreenMsgType::START_MIRROR_FAIL)) { sinkStartSuccess_ = (message->type_ == DScreenMsgType::START_MIRROR_SUCCESS); diff --git a/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen_manager.cpp b/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen_manager.cpp index 03e6018f7cab44a30780a06634e97e6faa4882a1..f97a3afa33cfdf7aadc4418d99a0f0435f2e89b4 100644 --- a/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen_manager.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen_manager.cpp @@ -97,11 +97,11 @@ int32_t DScreenManager::Release() void DScreenGroupListener::OnChange(const std::vector &screenIds, Rosen::ScreenGroupChangeEvent event) { - DHLOGI("On Screen change, screenIds size: %" PRId32, screenIds.size()); + DHLOGI("On Screen change, screenIds size: %{public}zu", screenIds.size()); for (uint64_t screenId : screenIds) { std::shared_ptr changedScreen = DScreenManager::GetInstance().FindDScreenById(screenId); if (changedScreen == nullptr) { - DHLOGD("screen change not about remote screen, screenId: %" PRIu64, screenId); + DHLOGD("screen change not about remote screen, screenId: %{public}" PRIu64, screenId); continue; } DScreenManager::GetInstance().HandleScreenChange(changedScreen, event); @@ -115,7 +115,7 @@ void DScreenManager::HandleScreenChange(const std::shared_ptr &changedS DHLOGE("DScreenManager::HandleScreenChange, dScreen is null."); return; } - DHLOGI("DScreenManager::HandleScreenChange, screenId: %" PRIu64" changeEvent: %" PRIu64, + DHLOGI("DScreenManager::HandleScreenChange, screenId: %{public}" PRIu64 " changeEvent: %{public}" PRIu32, changedScreen->GetScreenId(), event); if (event == Rosen::ScreenGroupChangeEvent::ADD_TO_GROUP) { if (StartDScreenMirror(changedScreen) != DH_SUCCESS) { @@ -142,7 +142,7 @@ int32_t DScreenManager::StartDScreenMirror(const std::shared_ptr &dScre return ERR_DH_SCREEN_SA_VALUE_NOT_INIT; } uint64_t screenId = dScreen->GetScreenId(); - DHLOGI("DScreenManager::StartDScreenMirror, screenId: %" PRIu64, screenId); + DHLOGI("DScreenManager::StartDScreenMirror, screenId: %{public}" PRIu64, screenId); if (dScreen->GetState() == CONNECTING) { DHLOGD("screen is connecting, no need handle change"); return DH_SUCCESS; @@ -153,7 +153,7 @@ int32_t DScreenManager::StartDScreenMirror(const std::shared_ptr &dScre return ret; } dScreen->AddTask(std::make_shared(TaskType::TASK_CONNECT, "")); - DHLOGI("StartDScreenMirror success, screenId:%", PRIu64" peerDeviceId:%s", screenId, + DHLOGI("StartDScreenMirror success, screenId:%{public}" PRIu64 ", peerDeviceId:%{public}s", screenId, GetAnonyString(dScreen->GetDevId()).c_str()); return DH_SUCCESS; } @@ -164,7 +164,7 @@ int32_t DScreenManager::StopDScreenMirror(const std::shared_ptr &dScree DHLOGE("DScreenManager::StopDScreenMirror, dScreen is null."); return ERR_DH_SCREEN_SA_VALUE_NOT_INIT; } - DHLOGI("DScreenManager::StopDScreenMirror, screenId: %" PRIu64, dScreen->GetScreenId()); + DHLOGI("DScreenManager::StopDScreenMirror, screenId: %{public}" PRIu64, dScreen->GetScreenId()); if (dScreen->GetState() == DISCONNECTING) { DHLOGD("screen is disconnecting, no need handle change"); return DH_SUCCESS; @@ -180,7 +180,7 @@ void DScreenCallback::OnRegResult(const std::shared_ptr &dScreen, DHLOGE("DScreenCallback::OnRegResult, dScreen id nullptr"); return; } - DHLOGI("DScreenCallback::OnRegResult, devId: %s, dhId: %s, reqId: %s", + DHLOGI("DScreenCallback::OnRegResult, devId: %{public}s, dhId: %{public}s, reqId: %{public}s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), GetAnonyString(reqId).c_str()); DScreenManager::GetInstance().OnRegResult(dScreen, reqId, status, data); @@ -193,7 +193,7 @@ void DScreenCallback::OnUnregResult(const std::shared_ptr &dScreen, DHLOGE("DScreenCallback::OnUnregResult, dScreen id nullptr"); return; } - DHLOGI("DScreenCallback::OnUnregResult, devId: %s, dhId: %s, reqId: %s", + DHLOGI("DScreenCallback::OnUnregResult, devId: %{public}s, dhId: %{public}s, reqId: %{public}s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), GetAnonyString(reqId).c_str()); DScreenManager::GetInstance().OnUnregResult(dScreen, reqId, status, data); @@ -202,7 +202,7 @@ void DScreenCallback::OnUnregResult(const std::shared_ptr &dScreen, void DScreenManager::OnRegResult(const std::shared_ptr &dScreen, const std::string &reqId, int32_t status, const std::string &data) { - DHLOGI("DScreenManager::OnRegResult, devId: %s, dhId: %s, reqId: %s", + DHLOGI("DScreenManager::OnRegResult, devId: %{public}s, dhId: %{public}s, reqId: %{public}s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), GetAnonyString(reqId).c_str()); if (dScreenSourceCallbackProxy_ == nullptr) { @@ -215,7 +215,7 @@ void DScreenManager::OnRegResult(const std::shared_ptr &dScreen, void DScreenManager::OnUnregResult(const std::shared_ptr &dScreen, const std::string &reqId, int32_t status, const std::string &data) { - DHLOGI("DScreenManager::OnUnregResult, devId: %s, dhId: %s, reqId: %s", + DHLOGI("DScreenManager::OnUnregResult, devId: %{public}s, dhId: %{public}s, reqId: %{public}s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), GetAnonyString(reqId).c_str()); if (dScreenSourceCallbackProxy_ == nullptr) { @@ -228,7 +228,7 @@ void DScreenManager::OnUnregResult(const std::shared_ptr &dScreen, int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const std::string &dhId, const EnableParam ¶m, const std::string &reqId) { - DHLOGI("EnableDistributedScreen2.0, devId: %s, dhId:%s", GetAnonyString(devId).c_str(), + DHLOGI("EnableDistributedScreen2.0, devId: %{public}s, dhId:%{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); if (devId.empty() || dhId.empty() || param.sinkVersion.empty() || param.sinkAttrs.empty() || reqId.empty()) { DHLOGE("EnableDistributedScreen2.0 CheckRegParams is inlvalid."); @@ -238,7 +238,7 @@ int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const dScreenGroupListener_ = new (std::nothrow) DScreenGroupListener(); int32_t ret = ScreenMgrAdapter::GetInstance().RegisterScreenGroupListener(dScreenGroupListener_); if (ret != DH_SUCCESS) { - DHLOGE("DScreenManager2.0 EnableDistributedScreen failed, err: %" PRId32, ret); + DHLOGE("DScreenManager2.0 EnableDistributedScreen failed, err: %{public}" PRId32, ret); dScreenGroupListener_ = nullptr; return ERR_DH_SCREEN_SA_ENABLE_FAILED; } @@ -260,7 +260,7 @@ int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const dScreens_[dScreenIdx] = dScreen; int32_t ret = dScreen->AddTask(std::make_shared(TaskType::TASK_ENABLE, reqId, param.sinkAttrs)); if (ret != DH_SUCCESS) { - DHLOGE("EnableDistributedScreen, add task failed. devId: %s, dhId:%s", + DHLOGE("EnableDistributedScreen, add task failed. devId: %{public}s, dhId:%{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); } return ret; @@ -269,11 +269,12 @@ int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const int32_t DScreenManager::DisableDistributedScreen(const std::string &devId, const std::string &dhId, const std::string &reqId) { - DHLOGI("DisableDistributedScreen, devId: %s, dhId:%s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); + DHLOGI("DisableDistributedScreen, devId: %{public}s, dhId:%{public}s", GetAnonyString(devId).c_str(), + GetAnonyString(dhId).c_str()); std::string dScreenIdx = devId + SEPERATOR + dhId; std::lock_guard lock(dScreenMapMtx_); if (dScreens_.count(dScreenIdx) == 0) { - DHLOGE("dscreen has already disabled, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), + DHLOGE("dscreen has already disabled, devId: %{public}s, dhId: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); return DH_SUCCESS; } @@ -312,7 +313,7 @@ void DScreenManager::RegisterDScreenCallback(const sptr std::shared_ptr DScreenManager::FindDScreenById(uint64_t screenId) { - DHLOGD("FindDScreenById, screenId: %" PRIu64, screenId); + DHLOGD("FindDScreenById, screenId: %{public}" PRIu64, screenId); std::lock_guard lock(dScreenMapMtx_); for (const auto &iter : dScreens_) { std::shared_ptr dScreen = iter.second; @@ -323,7 +324,7 @@ std::shared_ptr DScreenManager::FindDScreenById(uint64_t screenId) return dScreen; } } - DHLOGD("DScreen not found, screenId: %" PRIu64, screenId); + DHLOGD("DScreen not found, screenId: %{public}" PRIu64, screenId); return nullptr; } @@ -405,12 +406,12 @@ int32_t DScreenManager::LoadAVSenderEngineProvider() } void *pHandler = dlopen(path, RTLD_LAZY | RTLD_NODELETE); if (pHandler == nullptr) { - DHLOGE("%s handler load failed, failed reason : %s", path, dlerror()); + DHLOGE("%{public}s handler load failed, failed reason : %{public}s", path, dlerror()); return ERR_DH_AV_TRANS_NULL_VALUE; } AVTransProviderClass getEngineFactoryFunc = (AVTransProviderClass)dlsym(pHandler, GET_PROVIDER_FUNC.c_str()); if (getEngineFactoryFunc == nullptr) { - DHLOGE("av transport engine factory function handler is null, failed reason : %s", dlerror()); + DHLOGE("av transport engine factory function handler is null, failed reason : %{public}s", dlerror()); dlclose(pHandler); pHandler = nullptr; return ERR_DH_AV_TRANS_NULL_VALUE; diff --git a/services/screenservice/sourceservice/dscreenmgr/common/src/screen_manager_adapter.cpp b/services/screenservice/sourceservice/dscreenmgr/common/src/screen_manager_adapter.cpp index bc01feb7ead9fbef64dacbd3631c2edca95fcd16..1a9d8cac27a41a09596240a3c16dbe2c8e079a40 100644 --- a/services/screenservice/sourceservice/dscreenmgr/common/src/screen_manager_adapter.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/common/src/screen_manager_adapter.cpp @@ -52,7 +52,7 @@ uint64_t ScreenMgrAdapter::CreateVirtualScreen(const std::string &devId, const s DHLOGE("ScreenMgrAdapter::CreateVirtualScreen, videoParam is nullptr"); return SCREEN_ID_INVALID; } - DHLOGI("CreateVirtualScreen, width: %u, height: %u", videoParam->GetScreenWidth(), + DHLOGI("CreateVirtualScreen, width: %{public}u, height: %{public}" PRIu32, videoParam->GetScreenWidth(), videoParam->GetScreenHeight()); std::string screenName = DSCREEN_PREFIX + SEPERATOR + GetInterruptString(devId) + SEPERATOR + GetInterruptString(dhId); @@ -61,14 +61,14 @@ uint64_t ScreenMgrAdapter::CreateVirtualScreen(const std::string &devId, const s DHLOGI("remove an exist virtual screen."); Rosen::DMError err = Rosen::ScreenManager::GetInstance().DestroyVirtualScreen(iter->second); if (err != Rosen::DMError::DM_OK) { - DHLOGE("remove virtual screen failed, screenId:%", PRIu64, iter->second); + DHLOGE("remove virtual screen failed, screenId:%{public}" PRIu64, iter->second); return SCREEN_ID_INVALID; } screenIdMap_.erase(screenName); } uint32_t width = videoParam->GetScreenWidth(); width = ByteCalculate(width); - DHLOGI("screenWidth is : %" PRIu32, width); + DHLOGI("screenWidth is : %{public}" PRIu32, width); Rosen::VirtualScreenOption option = { screenName, width, @@ -80,7 +80,7 @@ uint64_t ScreenMgrAdapter::CreateVirtualScreen(const std::string &devId, const s }; uint64_t screenId = Rosen::ScreenManager::GetInstance().CreateVirtualScreen(option); - DHLOGI("virtualScreen id is: %" PRIu64, screenId); + DHLOGI("virtualScreen id is: %{public}" PRIu64, screenId); screenIdMap_.emplace(screenName, screenId); return screenId; } @@ -127,7 +127,7 @@ int32_t ScreenMgrAdapter::UnregisterScreenGroupListener(sptr screenIds; screenIds.push_back(screenId); Rosen::ScreenManager::GetInstance().RemoveVirtualScreenFromGroup(screenIds); @@ -135,10 +135,10 @@ void ScreenMgrAdapter::RemoveScreenFromGroup(uint64_t screenId) int32_t ScreenMgrAdapter::RemoveVirtualScreen(uint64_t screenId) { - DHLOGI("remove virtual screen, screenId: %" PRIu64, screenId); + DHLOGI("remove virtual screen, screenId: %{public}" PRIu64, screenId); Rosen::DMError err = Rosen::ScreenManager::GetInstance().DestroyVirtualScreen(screenId); if (err != Rosen::DMError::DM_OK) { - DHLOGE("remove virtual screen failed, screenId:%" PRIu64, screenId); + DHLOGE("remove virtual screen failed, screenId:%{public}" PRIu64, screenId); return ERR_DH_SCREEN_SA_REMOVE_VIRTUALSCREEN_FAIL; } return DH_SUCCESS; @@ -150,7 +150,7 @@ int32_t ScreenMgrAdapter::SetImageSurface(uint64_t screenId, sptr DHLOGE("ScreenMgrAdapter::SetImageSurface, surface is nullptr"); return ERR_DH_SCREEN_SA_SET_IMAGESURFACE_FAIL; } - DHLOGI("SetImageSurface for virtualscreen, screenId: %" PRIu64, screenId); + DHLOGI("SetImageSurface for virtualscreen, screenId: %{public}" PRIu64, screenId); Rosen::RSInterfaces::GetInstance().SetVirtualScreenUsingStatus(true); Rosen::ScreenManager::GetInstance().SetVirtualScreenSurface(screenId, surface); return DH_SUCCESS; @@ -158,7 +158,7 @@ int32_t ScreenMgrAdapter::SetImageSurface(uint64_t screenId, sptr std::shared_ptr ScreenMgrAdapter::GetMapRelation(uint64_t screenId) { - DHLOGI("GetMapRelation screenId: %" PRIu64, screenId); + DHLOGI("GetMapRelation screenId: %{public}" PRIu64, screenId); std::shared_ptr mapRelation = std::make_shared(); sptr screen = Rosen::ScreenManager::GetInstance().GetScreenById(screenId); if (screen == nullptr) { @@ -175,7 +175,7 @@ std::shared_ptr ScreenMgrAdapter::GetMapRelation(uint64_t sc uint32_t width = screen->GetWidth(); width = ByteCalculate(width); - DHLOGI("screenWidth is : %" PRIu32, width); + DHLOGI("screenWidth is : %{public}" PRIu32, width); ScreenRect screenRect = {0, 0, width, screen->GetHeight()}; DisplayRect displayRect = {0, 0, width, display->GetHeight()}; mapRelation->SetDisplayRect(displayRect); diff --git a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp index 5092f96b37e197beefdda583758d780cbf9fc801..7444b6be049481de6a1c7dfbfb3f9b7a849c10c5 100644 --- a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp +++ b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp @@ -49,19 +49,19 @@ void DScreenSourceService::DeleteExistDScreens() { std::vector> screens; Rosen::ScreenManager::GetInstance().GetAllScreens(screens); - DHLOGI("screens size is: %" PRId32, screens.size()); + DHLOGI("screens size is: %{public}zu", screens.size()); for (const auto &screen : screens) { if (screen == nullptr) { DHLOGE("screen is nullptr."); continue; } std::string screenName = screen->GetName(); - DHLOGI("DeleteExistDScreens, screenName:%s", screenName.c_str()); + DHLOGI("DeleteExistDScreens, screenName:%{public}s", screenName.c_str()); if (screenName.find(DSCREEN_PREFIX) != std::string::npos) { DHLOGI("DestroyVirtualScreen"); Rosen::DMError err = Rosen::ScreenManager::GetInstance().DestroyVirtualScreen(screen->GetId()); if (err != Rosen::DMError::DM_OK) { - DHLOGE("remove virtual screen failed, screenId:%" PRIu64, screen->GetId()); + DHLOGE("remove virtual screen failed, screenId:%{public}" PRIu64, screen->GetId()); } } } @@ -72,11 +72,11 @@ void DScreenSourceService::OnStop() DHLOGI("dscreen source service stop."); int32_t ret = V2_0::DScreenManager::GetInstance().Release(); if (ret != DH_SUCCESS) { - DHLOGE("Release V2_0::DScreenManager failed. err: %" PRId32, ret); + DHLOGE("Release V2_0::DScreenManager failed. err: %{public}" PRId32, ret); } ret = V1_0::DScreenManager::GetInstance().UnInit(); if (ret != DH_SUCCESS) { - DHLOGE("UnInit V1_0::DScreenManager failed. err: %" PRId32, ret); + DHLOGE("UnInit V1_0::DScreenManager failed. err: %{public}" PRId32, ret); } registerToService_ = false; } @@ -98,7 +98,7 @@ bool DScreenSourceService::Init() int32_t DScreenSourceService::InitSource(const std::string ¶ms, const sptr &callback) { - DHLOGI("Init source dscreen manager, params: %s", params.c_str()); + DHLOGI("Init source dscreen manager, params: %{public}s", params.c_str()); if (callback == nullptr) { DHLOGE("DScreenSourceService::InitSource, callback is nullptr."); return ERR_DH_SCREEN_SA_INIT_SOURCE_FAIL; @@ -106,13 +106,13 @@ int32_t DScreenSourceService::InitSource(const std::string ¶ms, const sptrUnloadSystemAbility(DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID); if (ret != DH_SUCCESS) { - DHLOGE("source systemAbilityMgr UnLoadSystemAbility failed, ret: %" PRId32, ret); + DHLOGE("source systemAbilityMgr UnLoadSystemAbility failed, ret: %{public}" PRId32, ret); return DSCREEN_BAD_VALUE; } DHLOGI("source systemAbilityMgr UnLoadSystemAbility success"); @@ -148,7 +148,7 @@ int32_t DScreenSourceService::ReleaseSource() int32_t DScreenSourceService::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const EnableParam ¶m, const std::string &reqId) { - DHLOGI("Register source distributed screen, peer dscreen version: %s", param.sinkVersion.c_str()); + DHLOGI("Register source distributed screen, peer dscreen version: %{public}s", param.sinkVersion.c_str()); int32_t ret = DH_SUCCESS; if (IsSupportAVTransEngine(param.sinkVersion)) { ret = V2_0::DScreenManager::GetInstance().EnableDistributedScreen(devId, dhId, param, reqId); @@ -156,9 +156,9 @@ int32_t DScreenSourceService::RegisterDistributedHardware(const std::string &dev ret = V1_0::DScreenManager::GetInstance().EnableDistributedScreen(devId, dhId, param, reqId); } if (ret != DH_SUCCESS) { - DHLOGE("enable distributedScreen failed. devId: %s, dhId: %s, reqId: %s, param attrs: %s", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), GetAnonyString(reqId).c_str(), - param.sinkAttrs.c_str()); + DHLOGE("enable distributedScreen failed. devId: %{public}s, dhId: %{public}s, reqId: %{public}s, " + "param attrs: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), + GetAnonyString(reqId).c_str(), param.sinkAttrs.c_str()); ReportRegisterFail(DSCREEN_REGISTER_FAIL, ret, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), "enable distributedScreen failed."); return ERR_DH_SCREEN_SA_ENABLE_FAILED; @@ -171,8 +171,9 @@ int32_t DScreenSourceService::UnregisterDistributedHardware(const std::string &d { int ret = V1_0::DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); if (ret != DH_SUCCESS) { - DHLOGE("V1_0::DScreenManager disable distributedScreen failed. devId: %s, dhId: %s, reqId: %s", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), GetAnonyString(reqId).c_str()); + DHLOGE("V1_0::DScreenManager disable distributedScreen failed. devId: %{public}s, dhId: %{public}s, " + "reqId: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), + GetAnonyString(reqId).c_str()); ReportUnRegisterFail(DSCREEN_REGISTER_FAIL, ret, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), "disable distributedScreen failed."); return ERR_DH_SCREEN_SA_DISABLE_FAILED; @@ -180,8 +181,9 @@ int32_t DScreenSourceService::UnregisterDistributedHardware(const std::string &d ret = V2_0::DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); if (ret != DH_SUCCESS) { - DHLOGE("V2_0::DScreenManager disable distributedScreen failed. devId: %s, dhId: %s, reqId: %s", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), GetAnonyString(reqId).c_str()); + DHLOGE("V2_0::DScreenManager disable distributedScreen failed. devId: %{public}s, dhId: %{public}s, " + "reqId: %{public}s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), + GetAnonyString(reqId).c_str()); ReportUnRegisterFail(DSCREEN_REGISTER_FAIL, ret, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), "disable distributedScreen failed."); return ERR_DH_SCREEN_SA_DISABLE_FAILED; @@ -202,7 +204,7 @@ int32_t DScreenSourceService::ConfigDistributedHardware(const std::string &devId void DScreenSourceService::DScreenNotify(const std::string &devId, const int32_t eventCode, const std::string &eventContent) { - DHLOGI("DScreenNotify, devId: %s, eventCode: %" PRId32, GetAnonyString(devId).c_str(), eventCode); + DHLOGI("DScreenNotify, devId: %{public}s, eventCode: %{public}" PRId32, GetAnonyString(devId).c_str(), eventCode); V1_0::DScreenManager::GetInstance().HandleDScreenNotify(devId, eventCode, eventContent); } diff --git a/services/screenservice/test/fuzztest/sourceservice/dscreenmgr/onchange_fuzzer/BUILD.gn b/services/screenservice/test/fuzztest/sourceservice/dscreenmgr/onchange_fuzzer/BUILD.gn index 2f7f730e88c8203014db0b1a015cf489c81772ef..52370464916ffe713f94c4877b23b1624137a943 100644 --- a/services/screenservice/test/fuzztest/sourceservice/dscreenmgr/onchange_fuzzer/BUILD.gn +++ b/services/screenservice/test/fuzztest/sourceservice/dscreenmgr/onchange_fuzzer/BUILD.gn @@ -64,6 +64,7 @@ ohos_fuzztest("OnChangeFuzzTest") { "distributed_hardware_fwk:distributed_av_sender", "graphic_2d:librender_service_client", "graphic_surface:surface", + "hilog:libhilog", "window_manager:libdm", ] } diff --git a/services/screentransport/screendatachannel/include/screen_data_channel_impl.h b/services/screentransport/screendatachannel/include/screen_data_channel_impl.h index 4b39e38cc3edf9579115c8f0fb11a4e7b986b2aa..23a3bc10aa335dcce84f8310425d3993a6e91738 100644 --- a/services/screentransport/screendatachannel/include/screen_data_channel_impl.h +++ b/services/screentransport/screendatachannel/include/screen_data_channel_impl.h @@ -50,7 +50,7 @@ public: void DirtyVecToJson(nlohmann::json &rectJson, const std::shared_ptr &screenData); void JsonToDirtyJson(nlohmann::json &rectJson, std::shared_ptr &screenData); private: - static const constexpr char *LOG_TAG = "ScreenDataChannel"; + static const constexpr char *DSCREEN_LOG_TAG = "ScreenDataChannel"; bool jpegSessionFlag_ = false; const std::string peerDevId_; int32_t sessionId_ = 0; diff --git a/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp b/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp index 1bda064a43f9117ea90a7dc3bf48b4171820800c..535eb8df25ec9ec9d5b7dedfe2faa00e21f4ab55 100644 --- a/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp +++ b/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp @@ -28,39 +28,39 @@ namespace OHOS { namespace DistributedHardware { int32_t ScreenDataChannelImpl::CreateSession(const std::shared_ptr &listener) { - DHLOGI("%s: CreateSession, peerDevId(%s)", LOG_TAG, GetAnonyString(peerDevId_).c_str()); + DHLOGI("%{public}s: CreateSession, peerDevId(%{public}s)", DSCREEN_LOG_TAG, GetAnonyString(peerDevId_).c_str()); if (listener == nullptr) { - DHLOGE("%s: Channel listener is null", LOG_TAG); + DHLOGE("%{public}s: Channel listener is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = SoftbusAdapter::GetInstance().CreateSoftbusSessionServer(PKG_NAME, DATA_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Create data session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Create data session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } std::shared_ptr softbusListener = shared_from_this(); ret = SoftbusAdapter::GetInstance().RegisterSoftbusListener(softbusListener, DATA_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Register data adapter listener failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Register data adapter listener failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } if (jpegSessionFlag_ == true) { ret = SoftbusAdapter::GetInstance().CreateSoftbusSessionServer(PKG_NAME, JPEG_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Create jpeg session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Create jpeg session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } ret = SoftbusAdapter::GetInstance().RegisterSoftbusListener(softbusListener, JPEG_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Register jpeg adapter listener failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Register jpeg adapter listener failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } } channelListener_ = listener; - DHLOGI("%s: Create session success", LOG_TAG); + DHLOGI("%{public}s: Create session success", DSCREEN_LOG_TAG); return DH_SUCCESS; } @@ -71,53 +71,53 @@ void ScreenDataChannelImpl::SetJpegSessionFlag(bool flag) int32_t ScreenDataChannelImpl::ReleaseSession() { - DHLOGI("%s: ReleaseSession, peerDevId(%s)", LOG_TAG, GetAnonyString(peerDevId_).c_str()); + DHLOGI("%{public}s: ReleaseSession, peerDevId(%{public}s)", DSCREEN_LOG_TAG, GetAnonyString(peerDevId_).c_str()); int32_t ret = SoftbusAdapter::GetInstance().RemoveSoftbusSessionServer(PKG_NAME, DATA_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Release data session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Release data session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } ret = SoftbusAdapter::GetInstance().UnRegisterSoftbusListener(DATA_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: UnRegister data adapter listener failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: UnRegister data adapter listener failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } if (jpegSessionFlag_ == true) { ret = SoftbusAdapter::GetInstance().RemoveSoftbusSessionServer(PKG_NAME, JPEG_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Release jpeg session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Release jpeg session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } ret = SoftbusAdapter::GetInstance().UnRegisterSoftbusListener(JPEG_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: UnRegister jpeg adapter listener failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: UnRegister jpeg adapter listener failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } jpegSessionFlag_ = false; } - DHLOGI("%s: Release session success", LOG_TAG); + DHLOGI("%{public}s: Release session success", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenDataChannelImpl::OpenSession(const std::shared_ptr &listener) { - DHLOGI("%s: OpenSession, peerDevId(%s)", LOG_TAG, GetAnonyString(peerDevId_).c_str()); + DHLOGI("%{public}s: OpenSession, peerDevId(%{public}s)", DSCREEN_LOG_TAG, GetAnonyString(peerDevId_).c_str()); if (listener == nullptr) { - DHLOGE("%s: Channel listener is null", LOG_TAG); + DHLOGE("%{public}s: Channel listener is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } channelListener_ = listener; std::shared_ptr softbusListener = shared_from_this(); int32_t ret = SoftbusAdapter::GetInstance().RegisterSoftbusListener(softbusListener, DATA_SESSION_NAME, peerDevId_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Register data adapter listener failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Register data adapter listener failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } int32_t sessionId = SoftbusAdapter::GetInstance().OpenSoftbusSession(DATA_SESSION_NAME, DATA_SESSION_NAME, peerDevId_); if (sessionId < 0) { - DHLOGE("%s: Open data session failed, ret: %" PRId32, LOG_TAG, sessionId); + DHLOGE("%{public}s: Open data session failed, ret: %{public}" PRId32, DSCREEN_LOG_TAG, sessionId); ReportOptFail(DSCREEN_OPT_FAIL, sessionId, "Open data session failed"); return ERR_DH_SCREEN_TRANS_ERROR; } @@ -126,65 +126,65 @@ int32_t ScreenDataChannelImpl::OpenSession(const std::shared_ptr &screenData) { - DHLOGI("%s: SendData.", LOG_TAG); + DHLOGI("%{public}s: SendData.", DSCREEN_LOG_TAG); if (screenData == nullptr || screenData->Data() == nullptr) { - DHLOGE("%s: Screen data is null", LOG_TAG); + DHLOGE("%{public}s: Screen data is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } uint8_t dataType = screenData->DataType(); if (dataType == VIDEO_PART_SCREEN_DATA) { int32_t ret = SendDirtyData(screenData); if (ret != DH_SUCCESS) { - DHLOGE("%s: send dirty data failed, ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: send dirty data failed, ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } } else if (dataType == VIDEO_FULL_SCREEN_DATA) { int32_t ret = SendFullData(screenData); if (ret != DH_SUCCESS) { - DHLOGE("%s: send full data failed, ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: send full data failed, ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } } @@ -193,9 +193,9 @@ int32_t ScreenDataChannelImpl::SendData(const std::shared_ptr &scree int32_t ScreenDataChannelImpl::SendFullData(const std::shared_ptr &screenData) { - DHLOGI("%s: SendFullData sessionId: %." PRId32, LOG_TAG, sessionId_); + DHLOGI("%{public}s: SendFullData sessionId: %{public}" PRId32, DSCREEN_LOG_TAG, sessionId_); if (screenData == nullptr) { - DHLOGE("%s: Screen data is null", LOG_TAG); + DHLOGE("%{public}s: Screen data is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } StreamData data = {reinterpret_cast(screenData->Data()), screenData->Capacity()}; @@ -203,18 +203,18 @@ int32_t ScreenDataChannelImpl::SendFullData(const std::shared_ptr &s StreamFrameInfo frameInfo = {0}; int32_t ret = SoftbusAdapter::GetInstance().SendSoftbusStream(sessionId_, &data, &ext, &frameInfo); if (ret != DH_SUCCESS) { - DHLOGE("%s: Send full data failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Send full data failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } - DHLOGI("%s: SendFullData success.", LOG_TAG); + DHLOGI("%{public}s: SendFullData success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenDataChannelImpl::SendDirtyData(const std::shared_ptr &screenData) { - DHLOGI("%s: SendDirtyData sessionId: %." PRId32, LOG_TAG, jpegSessionId_); + DHLOGI("%{public}s: SendDirtyData sessionId: %{public}" PRId32, DSCREEN_LOG_TAG, jpegSessionId_); if (screenData == nullptr) { - DHLOGE("%s: Screen data is null", LOG_TAG); + DHLOGE("%{public}s: Screen data is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } nlohmann::json rectJson; @@ -232,12 +232,12 @@ int32_t ScreenDataChannelImpl::SendDirtyData(const std::shared_ptr & StreamFrameInfo frameInfo = {0}; ret = SoftbusAdapter::GetInstance().SendSoftbusStream(jpegSessionId_, &data, &ext, &frameInfo); if (ret != DH_SUCCESS) { - DHLOGE("%s: Send dirty data failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Send dirty data failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); delete [] dirtyInfo; return ret; } delete [] dirtyInfo; - DHLOGI("%s: SendDirtyData success.", LOG_TAG); + DHLOGI("%{public}s: SendDirtyData success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } @@ -245,7 +245,7 @@ int32_t ScreenDataChannelImpl::SendDirtyData(const std::shared_ptr & void ScreenDataChannelImpl::OnSessionOpened(int32_t sessionId, PeerSocketInfo info) { (void)info; - DHLOGI("%s: OnScreenSessionOpened, sessionId: %" PRId32, LOG_TAG, sessionId); + DHLOGI("%{public}s: OnScreenSessionOpened, sessionId: %{public}" PRId32, DSCREEN_LOG_TAG, sessionId); if (jpegSessionFlag_ == false) { dataSessionOpened = true; sessionId_ = sessionId; @@ -260,7 +260,7 @@ void ScreenDataChannelImpl::OnSessionOpened(int32_t sessionId, PeerSocketInfo in } std::shared_ptr listener = channelListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Channel listener is null", LOG_TAG); + DHLOGE("%{public}s: Channel listener is null", DSCREEN_LOG_TAG); return; } listener->OnSessionOpened(); @@ -269,10 +269,10 @@ void ScreenDataChannelImpl::OnSessionOpened(int32_t sessionId, PeerSocketInfo in void ScreenDataChannelImpl::OnSessionClosed(int32_t sessionId, ShutdownReason reason) { (void)reason; - DHLOGI("%s: OnScreenSessionClosed, sessionId %" PRId32, LOG_TAG, sessionId); + DHLOGI("%{public}s: OnScreenSessionClosed, sessionId %{public}" PRId32, DSCREEN_LOG_TAG, sessionId); std::shared_ptr listener = channelListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Channel listener is null", LOG_TAG); + DHLOGE("%{public}s: Channel listener is null", DSCREEN_LOG_TAG); return; } listener->OnSessionClosed(); @@ -284,15 +284,15 @@ void ScreenDataChannelImpl::OnBytesReceived(int32_t sessionId, const void *data, (void) data; (void) dataLen; - DHLOGD("%s: OnScreenBytesReceived data channel not support yet", LOG_TAG); + DHLOGD("%{public}s: OnScreenBytesReceived data channel not support yet", DSCREEN_LOG_TAG); } void ScreenDataChannelImpl::OnStreamReceived(int32_t sessionId, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param) { - DHLOGI("%s: OnStreamReceived, receiv data from softbus.", LOG_TAG); + DHLOGI("%{public}s: OnStreamReceived, receiv data from softbus.", DSCREEN_LOG_TAG); if (data == nullptr) { - DHLOGE("%s: Stream data is null", LOG_TAG); + DHLOGE("%{public}s: Stream data is null", DSCREEN_LOG_TAG); return; } auto dataBuffer = std::make_shared(data->bufLen); @@ -308,16 +308,16 @@ void ScreenDataChannelImpl::OnStreamReceived(int32_t sessionId, const StreamData void ScreenDataChannelImpl::ProcessDullData(const StreamData *data, std::shared_ptr dataBuffer) { - DHLOGI("%s: ProcessDullData.", LOG_TAG); + DHLOGI("%{public}s: ProcessDullData.", DSCREEN_LOG_TAG); std::shared_ptr listener = channelListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Channel listener is null.", LOG_TAG); + DHLOGE("%{public}s: Channel listener is null.", DSCREEN_LOG_TAG); return; } int32_t ret = memcpy_s(dataBuffer->Data(), dataBuffer->Capacity(), reinterpret_cast(data->buf), data->bufLen); if (ret != EOK) { - DHLOGE("%s: Full data memcpy failed.", LOG_TAG); + DHLOGE("%{public}s: Full data memcpy failed.", DSCREEN_LOG_TAG); return; } dataBuffer->SetDataType(VIDEO_FULL_SCREEN_DATA); @@ -327,21 +327,21 @@ void ScreenDataChannelImpl::ProcessDullData(const StreamData *data, std::shared_ void ScreenDataChannelImpl::ProcessDirtyData(const StreamData *data, std::shared_ptr dataBuffer, const StreamData *ext) { - DHLOGI("%s: ProcessDirtyData.", LOG_TAG); + DHLOGI("%{public}s: ProcessDirtyData.", DSCREEN_LOG_TAG); std::shared_ptr listener = channelListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Channel listener is null.", LOG_TAG); + DHLOGE("%{public}s: Channel listener is null.", DSCREEN_LOG_TAG); return; } int32_t ret = memcpy_s(dataBuffer->Data(), dataBuffer->Capacity(), reinterpret_cast(data->buf), data->bufLen); if (ret != EOK) { - DHLOGE("%s: Dirty data memcpy_s failed.", LOG_TAG); + DHLOGE("%{public}s: Dirty data memcpy_s failed.", DSCREEN_LOG_TAG); return; } nlohmann::json rectJson = nlohmann::json::parse(ext->buf, nullptr, false); if (rectJson.is_discarded()) { - DHLOGE("%s: OnStreamReceived rectJson invalid", LOG_TAG); + DHLOGE("%{public}s: OnStreamReceived rectJson invalid", DSCREEN_LOG_TAG); return; } JsonToDirtyJson(rectJson, dataBuffer); @@ -386,7 +386,7 @@ void ScreenDataChannelImpl::JsonToDirtyJson(nlohmann::json &rectJson, std::share if (!IsInt32(rectJson[item], KEY_POINT_DIRTY_X) || !IsInt32(rectJson[item], KEY_POINT_DIRTY_Y) || !IsInt32(rectJson[item], KEY_POINT_DIRTY_W) || !IsInt32(rectJson[item], KEY_POINT_DIRTY_H) || !IsInt32(rectJson[item], KEY_POINT_DIRTY_SIZE)) { - DHLOGE("%s: JsonToDirtyJson rectJson not contain int32", LOG_TAG); + DHLOGE("%{public}s: JsonToDirtyJson rectJson not contain int32", DSCREEN_LOG_TAG); return; } int32_t X = rectJson[item][KEY_POINT_DIRTY_X].get(); diff --git a/services/screentransport/screensinkprocessor/decoder/include/image_decoder_callback.h b/services/screentransport/screensinkprocessor/decoder/include/image_decoder_callback.h index ca5e3e62411f450ab68523d3c1851d882849b165..c231b5ddbe28baa1eb9a0dae414c2688bde9d548 100644 --- a/services/screentransport/screensinkprocessor/decoder/include/image_decoder_callback.h +++ b/services/screentransport/screensinkprocessor/decoder/include/image_decoder_callback.h @@ -38,7 +38,7 @@ public: void OnOutputFormatChanged(const Media::Format &format) override; private: - static const constexpr char *LOG_TAG = "ImageDecoderCallback"; + static const constexpr char *DSCREEN_LOG_TAG = "ImageDecoderCallback"; std::weak_ptr videoDecoder_; }; diff --git a/services/screentransport/screensinkprocessor/decoder/include/image_sink_decoder.h b/services/screentransport/screensinkprocessor/decoder/include/image_sink_decoder.h index 4ce549e2113db0fe48296b396440a8751f102caf..4b1b671d6fbb44092ea0ce9b7615d4a3bfe58c91 100644 --- a/services/screentransport/screensinkprocessor/decoder/include/image_sink_decoder.h +++ b/services/screentransport/screensinkprocessor/decoder/include/image_sink_decoder.h @@ -43,7 +43,7 @@ public: ~ConsumBufferListener() = default; void OnBufferAvailable() override; private: - static const constexpr char *LOG_TAG = "ConsumBufferListener"; + static const constexpr char *DSCREEN_LOG_TAG = "ConsumBufferListener"; std::shared_ptr decoder_; }; class ImageSinkDecoder : public std::enable_shared_from_this { @@ -79,7 +79,7 @@ private: int32_t ProcessData(const std::shared_ptr &screenData, const int32_t bufferIndex); private: - static const constexpr char *LOG_TAG = "ImageSinkDecoder"; + static const constexpr char *DSCREEN_LOG_TAG = "ImageSinkDecoder"; VideoParam configParam_; std::mutex dataMutex_; std::mutex decodeMutex_; diff --git a/services/screentransport/screensinkprocessor/decoder/src/image_decoder_callback.cpp b/services/screentransport/screensinkprocessor/decoder/src/image_decoder_callback.cpp index 3e7a6858613787a1270534f7a3117ece1c17e478..f71a2923a07f9e6c475600b7ed0c8d2d60cf7bf1 100644 --- a/services/screentransport/screensinkprocessor/decoder/src/image_decoder_callback.cpp +++ b/services/screentransport/screensinkprocessor/decoder/src/image_decoder_callback.cpp @@ -22,7 +22,7 @@ namespace OHOS { namespace DistributedHardware { void ImageDecoderCallback::OnError(MediaAVCodec::AVCodecErrorType errorType, int32_t errorCode) { - DHLOGD("%s: OnError.", LOG_TAG); + DHLOGD("%{public}s: OnError.", DSCREEN_LOG_TAG); std::shared_ptr decoder = videoDecoder_.lock(); if (decoder == nullptr) { DHLOGE("decoder is nullptr."); @@ -34,7 +34,7 @@ void ImageDecoderCallback::OnError(MediaAVCodec::AVCodecErrorType errorType, int void ImageDecoderCallback::OnOutputBufferAvailable(uint32_t index, MediaAVCodec::AVCodecBufferInfo info, MediaAVCodec::AVCodecBufferFlag flag, std::shared_ptr buffer) { - DHLOGD("%s: OnOutputBufferAvailable.", LOG_TAG); + DHLOGD("%{public}s: OnOutputBufferAvailable.", DSCREEN_LOG_TAG); std::shared_ptr decoder = videoDecoder_.lock(); if (decoder == nullptr) { DHLOGE("decoder is nullptr."); @@ -45,7 +45,7 @@ void ImageDecoderCallback::OnOutputBufferAvailable(uint32_t index, MediaAVCodec: void ImageDecoderCallback::OnInputBufferAvailable(uint32_t index, std::shared_ptr buffer) { - DHLOGD("%s: OnInputBufferAvailable.", LOG_TAG); + DHLOGD("%{public}s: OnInputBufferAvailable.", DSCREEN_LOG_TAG); std::shared_ptr decoder = videoDecoder_.lock(); if (decoder == nullptr) { DHLOGE("decoder is nullptr."); @@ -56,7 +56,7 @@ void ImageDecoderCallback::OnInputBufferAvailable(uint32_t index, std::shared_pt void ImageDecoderCallback::OnOutputFormatChanged(const Media::Format &format) { - DHLOGD("%s: OnOutputFormatChanged.", LOG_TAG); + DHLOGD("%{public}s: OnOutputFormatChanged.", DSCREEN_LOG_TAG); std::shared_ptr decoder = videoDecoder_.lock(); if (decoder == nullptr) { DHLOGE("decoder is nullptr."); diff --git a/services/screentransport/screensinkprocessor/decoder/src/image_sink_decoder.cpp b/services/screentransport/screensinkprocessor/decoder/src/image_sink_decoder.cpp index 425c3cf96a69a5d8089198db03622ac22f191bbe..196725857bc70ccc0076e0575e923dfc9d35f609 100644 --- a/services/screentransport/screensinkprocessor/decoder/src/image_sink_decoder.cpp +++ b/services/screentransport/screensinkprocessor/decoder/src/image_sink_decoder.cpp @@ -29,22 +29,22 @@ namespace DistributedHardware { constexpr const char* DECODE_THREAD = "DecodeThread"; int32_t ImageSinkDecoder::ConfigureDecoder(const VideoParam &configParam) { - DHLOGI("%s: ConfigureDecoder.", LOG_TAG); + DHLOGI("%{public}s: ConfigureDecoder.", DSCREEN_LOG_TAG); int32_t ret = InitVideoDecoder(configParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: InitVideoDecoder failed.", LOG_TAG); + DHLOGE("%{public}s: InitVideoDecoder failed.", DSCREEN_LOG_TAG); return ret; } ret = SetDecoderFormat(configParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: SetDecoderFormat failed.", LOG_TAG); + DHLOGE("%{public}s: SetDecoderFormat failed.", DSCREEN_LOG_TAG); return ret; } configParam_ = configParam; ret = AddSurface(); if (ret != DH_SUCCESS) { - DHLOGE("%s: Add surface failed ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Add surface failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); consumerSurface_ = nullptr; producerSurface_ = nullptr; return ret; @@ -58,10 +58,10 @@ int32_t ImageSinkDecoder::ConfigureDecoder(const VideoParam &configParam) int32_t ImageSinkDecoder::AddSurface() { - DHLOGI("%s: AddSurface.", LOG_TAG); + DHLOGI("%{public}s: AddSurface.", DSCREEN_LOG_TAG); consumerSurface_ = IConsumerSurface::Create(); if (consumerSurface_ == nullptr) { - DHLOGE("%s: Create consumer surface failed.", LOG_TAG); + DHLOGE("%{public}s: Create consumer surface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } @@ -69,13 +69,13 @@ int32_t ImageSinkDecoder::AddSurface() sptr producer = consumerSurface_->GetProducer(); if (producer == nullptr) { - DHLOGE("%s: Get preducer surface failed.", LOG_TAG); + DHLOGE("%{public}s: Get preducer surface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } producerSurface_ = Surface::CreateSurfaceAsProducer(producer); if (producerSurface_ == nullptr) { - DHLOGE("%s: Create preducer surface failed.", LOG_TAG); + DHLOGE("%{public}s: Create preducer surface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } @@ -96,7 +96,7 @@ uint8_t *ImageSinkDecoder::GetLastFrame() sptr ImageSinkDecoder::GetWinSurfaceBuffer() { - DHLOGI("%s: GetWinSurfaceBuffer.", LOG_TAG); + DHLOGI("%{public}s: GetWinSurfaceBuffer.", DSCREEN_LOG_TAG); sptr windowSurfaceBuffer = nullptr; int32_t releaseFence = -1; OHOS::BufferRequestConfig requestConfig = { @@ -108,7 +108,7 @@ sptr ImageSinkDecoder::GetWinSurfaceBuffer() }; SurfaceError surfaceErr = windowSurface_->RequestBuffer(windowSurfaceBuffer, releaseFence, requestConfig); if (surfaceErr != SURFACE_ERROR_OK || windowSurfaceBuffer == nullptr) { - DHLOGE("%s: windowSurface_ request buffer failed, buffer is nullptr.", LOG_TAG); + DHLOGE("%{public}s: windowSurface_ request buffer failed, buffer is nullptr.", DSCREEN_LOG_TAG); windowSurface_->CancelBuffer(windowSurfaceBuffer); } return windowSurfaceBuffer; @@ -116,21 +116,21 @@ sptr ImageSinkDecoder::GetWinSurfaceBuffer() void ImageSinkDecoder::NormalProcess(sptr surfaceBuffer, sptr windowSurfaceBuffer) { - DHLOGI("%s: NormalProcess.", LOG_TAG); + DHLOGI("%{public}s: NormalProcess.", DSCREEN_LOG_TAG); auto surfaceAddr = static_cast(surfaceBuffer->GetVirAddr()); auto windowSurfaceAddr = static_cast(windowSurfaceBuffer->GetVirAddr()); int32_t sizeData = lastFrameSize_; uint32_t size = windowSurfaceBuffer->GetSize(); int32_t ret = memcpy_s(windowSurfaceAddr, size, surfaceAddr, sizeData); if (ret != EOK) { - DHLOGE("%s: surfaceBuffer memcpy run failed.", LOG_TAG); + DHLOGE("%{public}s: surfaceBuffer memcpy run failed.", DSCREEN_LOG_TAG); windowSurface_->CancelBuffer(windowSurfaceBuffer); } } void ImageSinkDecoder::OffsetProcess(sptr surfaceBuffer, sptr windowSurfaceBuffer) { - DHLOGI("%s: OffsetProcess.", LOG_TAG); + DHLOGI("%{public}s: OffsetProcess.", DSCREEN_LOG_TAG); auto surfaceAddr = static_cast(surfaceBuffer->GetVirAddr()); auto windowSurfaceAddr = static_cast(windowSurfaceBuffer->GetVirAddr()); uint32_t size = windowSurfaceBuffer->GetSize(); @@ -142,7 +142,7 @@ void ImageSinkDecoder::OffsetProcess(sptr surfaceBuffer, sptrCancelBuffer(windowSurfaceBuffer); return; } @@ -155,7 +155,7 @@ void ImageSinkDecoder::OffsetProcess(sptr surfaceBuffer, sptrCancelBuffer(windowSurfaceBuffer); return; } @@ -166,10 +166,10 @@ void ImageSinkDecoder::OffsetProcess(sptr surfaceBuffer, sptr bufLock(decodeMutex_); if (consumerSurface_ == nullptr) { - DHLOGE("%s: consumerSurface_ is nullptr.", LOG_TAG); + DHLOGE("%{public}s: consumerSurface_ is nullptr.", DSCREEN_LOG_TAG); return; } sptr surfaceBuffer = nullptr; @@ -203,15 +203,15 @@ void ImageSinkDecoder::ConsumeSurface() BufferFlushConfig flushConfig = { {0, 0, windowSurfaceBuffer->GetWidth(), windowSurfaceBuffer->GetHeight()}, 0}; int32_t ret = memcpy_s(lastFrame_, lastFrameSize_, windowSurfaceAddr, lastFrameSize_); if (ret != EOK) { - DHLOGE("%s: surfaceBuffer memcpy_s run failed.", LOG_TAG); + DHLOGE("%{public}s: surfaceBuffer memcpy_s run failed.", DSCREEN_LOG_TAG); consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); windowSurface_->CancelBuffer(windowSurfaceBuffer); return; } - DHLOGI("%s: ConsumeSurface success, send NV12 to window.", LOG_TAG); + DHLOGI("%{public}s: ConsumeSurface success, send NV12 to window.", DSCREEN_LOG_TAG); surfaceErr = windowSurface_->FlushBuffer(windowSurfaceBuffer, -1, flushConfig); if (surfaceErr != SURFACE_ERROR_OK) { - DHLOGE("%s: windowSurface_ flush buffer failed.", LOG_TAG); + DHLOGE("%{public}s: windowSurface_ flush buffer failed.", DSCREEN_LOG_TAG); consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); windowSurface_->CancelBuffer(windowSurfaceBuffer); return; @@ -221,15 +221,15 @@ void ImageSinkDecoder::ConsumeSurface() void ConsumBufferListener::OnBufferAvailable() { - DHLOGI("%s: OnBufferAvailable, receive NV12 data from decoder.", LOG_TAG); + DHLOGI("%{public}s: OnBufferAvailable, receive NV12 data from decoder.", DSCREEN_LOG_TAG); decoder_->ConsumeSurface(); } int32_t ImageSinkDecoder::ReleaseDecoder() { - DHLOGI("%s: ReleaseDecoder.", LOG_TAG); + DHLOGI("%{public}s: ReleaseDecoder.", DSCREEN_LOG_TAG); if (videoDecoder_ == nullptr) { - DHLOGE("%s: Decoder is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } if (lastFrame_ != nullptr) { @@ -237,7 +237,7 @@ int32_t ImageSinkDecoder::ReleaseDecoder() } int32_t ret = videoDecoder_->Release(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: ReleaseDecoder failed.", LOG_TAG); + DHLOGE("%{public}s: ReleaseDecoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_RELEASE_FAILED; } decodeVideoCallback_ = nullptr; @@ -248,21 +248,21 @@ int32_t ImageSinkDecoder::ReleaseDecoder() int32_t ImageSinkDecoder::StartDecoder() { - DHLOGI("%s: StartDecoder.", LOG_TAG); + DHLOGI("%{public}s: StartDecoder.", DSCREEN_LOG_TAG); if (videoDecoder_ == nullptr) { - DHLOGE("%s: Decoder is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = videoDecoder_->Prepare(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Prepare decoder failed.", LOG_TAG); + DHLOGE("%{public}s: Prepare decoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_PREPARE_FAILED; } ret = videoDecoder_->Start(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Start decoder failed.", LOG_TAG); + DHLOGE("%{public}s: Start decoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_START_FAILED; } StartInputThread(); @@ -272,21 +272,21 @@ int32_t ImageSinkDecoder::StartDecoder() int32_t ImageSinkDecoder::StopDecoder() { - DHLOGI("%s: StopDecoder.", LOG_TAG); + DHLOGI("%{public}s: StopDecoder.", DSCREEN_LOG_TAG); if (videoDecoder_ == nullptr) { - DHLOGE("%s: Decoder is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = videoDecoder_->Flush(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Flush decoder failed.", LOG_TAG); + DHLOGE("%{public}s: Flush decoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_FLUSH_FAILED; } ret = videoDecoder_->Stop(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Stop decoder failed.", LOG_TAG); + DHLOGE("%{public}s: Stop decoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_STOP_FAILED; } StopInputThread(); @@ -296,7 +296,7 @@ int32_t ImageSinkDecoder::StopDecoder() int32_t ImageSinkDecoder::InitVideoDecoder(const VideoParam &configParam) { - DHLOGI("%s: InitVideoDecoder.", LOG_TAG); + DHLOGI("%{public}s: InitVideoDecoder.", DSCREEN_LOG_TAG); switch (configParam.GetCodecType()) { case VIDEO_CODEC_TYPE_VIDEO_H264: videoDecoder_ = MediaAVCodec::VideoDecoderFactory::CreateByMime( @@ -307,19 +307,19 @@ int32_t ImageSinkDecoder::InitVideoDecoder(const VideoParam &configParam) std::string(MediaAVCodec::CodecMimeType::VIDEO_HEVC)); break; default: - DHLOGE("%s: codecType is invalid!", LOG_TAG); + DHLOGE("%{public}s: codecType is invalid!", DSCREEN_LOG_TAG); videoDecoder_ = nullptr; } if (videoDecoder_ == nullptr) { - DHLOGE("%s: Create videoEncoder failed.", LOG_TAG); + DHLOGE("%{public}s: Create videoEncoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } decodeVideoCallback_ = std::make_shared(shared_from_this()); int32_t ret = videoDecoder_->SetCallback(decodeVideoCallback_); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Set decoder callback failed.", LOG_TAG); + DHLOGE("%{public}s: Set decoder callback failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SET_CALLBACK_FAILED; } @@ -328,9 +328,9 @@ int32_t ImageSinkDecoder::InitVideoDecoder(const VideoParam &configParam) int32_t ImageSinkDecoder::SetDecoderFormat(const VideoParam &configParam) { - DHLOGI("%s: SetDecoderFormat.", LOG_TAG); + DHLOGI("%{public}s: SetDecoderFormat.", DSCREEN_LOG_TAG); if (videoDecoder_ == nullptr) { - DHLOGE("%s: Decoder is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -354,7 +354,7 @@ int32_t ImageSinkDecoder::SetDecoderFormat(const VideoParam &configParam) int32_t ret = videoDecoder_->Configure(imageFormat_); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: configure decoder format param failed.", LOG_TAG); + DHLOGE("%{public}s: configure decoder format param failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_CONFIGURE_FAILED; } @@ -363,22 +363,22 @@ int32_t ImageSinkDecoder::SetDecoderFormat(const VideoParam &configParam) int32_t ImageSinkDecoder::SetOutputSurface(sptr &surface) { - DHLOGI("%s: SetOutputSurface.", LOG_TAG); + DHLOGI("%{public}s: SetOutputSurface.", DSCREEN_LOG_TAG); if (videoDecoder_ == nullptr || surface == nullptr) { - DHLOGE("%s: Decoder or surface is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder or surface is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } windowSurface_ = surface; if (consumerSurface_ == nullptr || producerSurface_ == nullptr || !configParam_.GetPartialRefreshFlag()) { int32_t ret = videoDecoder_->SetOutputSurface(surface); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: SetOutputSurface failed.", LOG_TAG); + DHLOGE("%{public}s: SetOutputSurface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } } else { int32_t ret = videoDecoder_->SetOutputSurface(producerSurface_); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: SetOutputSurface failed.", LOG_TAG); + DHLOGE("%{public}s: SetOutputSurface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } } @@ -388,13 +388,13 @@ int32_t ImageSinkDecoder::SetOutputSurface(sptr &surface) int32_t ImageSinkDecoder::InputScreenData(const std::shared_ptr &data) { if (data == nullptr) { - DHLOGE("%s: InputScreenData failed, data is nullptr.", LOG_TAG); + DHLOGE("%{public}s: InputScreenData failed, data is nullptr.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } - DHLOGD("%s: InputScreenData.", LOG_TAG); + DHLOGD("%{public}s: InputScreenData.", DSCREEN_LOG_TAG); std::lock_guard dataLock(dataMutex_); while (videoDataQueue_.size() >= DATA_QUEUE_MAX_SIZE) { - DHLOGE("%s: videoData queue overflow.", LOG_TAG); + DHLOGE("%{public}s: videoData queue overflow.", DSCREEN_LOG_TAG); videoDataQueue_.pop(); } videoDataQueue_.push(data); @@ -405,10 +405,11 @@ int32_t ImageSinkDecoder::InputScreenData(const std::shared_ptr &dat void ImageSinkDecoder::OnError(MediaAVCodec::AVCodecErrorType errorType, int32_t errorCode) { - DHLOGI("%s: OnImageDecodeError, errorType:%" PRId32", errorCode:%" PRId32, LOG_TAG, errorType, errorCode); + DHLOGI("%{public}s: OnImageDecodeError, errorType:%{public}" PRId32 ", errorCode:%{public}" PRId32, + DSCREEN_LOG_TAG, errorType, errorCode); std::shared_ptr listener = imageProcessorListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Listener is null.", LOG_TAG); + DHLOGE("%{public}s: Listener is null.", DSCREEN_LOG_TAG); return; } listener->OnProcessorStateNotify(errorCode); @@ -416,7 +417,7 @@ void ImageSinkDecoder::OnError(MediaAVCodec::AVCodecErrorType errorType, int32_t void ImageSinkDecoder::OnInputBufferAvailable(uint32_t index, std::shared_ptr buffer) { - DHLOGI("%s: OnDecodeInputBufferAvailable: %u.", LOG_TAG, index); + DHLOGI("%{public}s: OnDecodeInputBufferAvailable: %{public}" PRIu32, DSCREEN_LOG_TAG, index); std::lock_guard dataLock(dataMutex_); availableInputIndexsQueue_.push(index); availableInputBufferQueue_.push(buffer); @@ -425,16 +426,16 @@ void ImageSinkDecoder::OnInputBufferAvailable(uint32_t index, std::shared_ptr buffer) { - DHLOGI("%s: OnDecodeOutputBufferAvailable.", LOG_TAG); + DHLOGI("%{public}s: OnDecodeOutputBufferAvailable.", DSCREEN_LOG_TAG); if (videoDecoder_ == nullptr) { - DHLOGE("%s: Decoder is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder is null.", DSCREEN_LOG_TAG); return; } decoderBufferInfo_ = info; int32_t ret = videoDecoder_->ReleaseOutputBuffer(index, true); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGD("%s: ReleaseOutputBuffer failed.", LOG_TAG); + DHLOGD("%{public}s: ReleaseOutputBuffer failed.", DSCREEN_LOG_TAG); } } @@ -445,7 +446,7 @@ void ImageSinkDecoder::OnOutputFormatChanged(const Media::Format &format) int32_t ImageSinkDecoder::StartInputThread() { - DHLOGI("%s: StartInputThread.", LOG_TAG); + DHLOGI("%{public}s: StartInputThread.", DSCREEN_LOG_TAG); isDecoderReady_ = true; decodeThread_ = std::thread(&ImageSinkDecoder::DecodeScreenData, this); return DH_SUCCESS; @@ -453,7 +454,7 @@ int32_t ImageSinkDecoder::StartInputThread() int32_t ImageSinkDecoder::StopInputThread() { - DHLOGI("%s: StopInputThread.", LOG_TAG); + DHLOGI("%{public}s: StopInputThread.", DSCREEN_LOG_TAG); isDecoderReady_ = false; if (decodeThread_.joinable()) { decodeThread_.join(); @@ -468,10 +469,10 @@ int32_t ImageSinkDecoder::StopInputThread() void ImageSinkDecoder::DecodeScreenData() { - DHLOGI("%s: DecodeScreenData.", LOG_TAG); + DHLOGI("%{public}s: DecodeScreenData.", DSCREEN_LOG_TAG); int32_t ret = pthread_setname_np(pthread_self(), DECODE_THREAD); if (ret != DH_SUCCESS) { - DHLOGE("ImageSinkDecoder set thread name failed, ret %" PRId32, ret); + DHLOGE("ImageSinkDecoder set thread name failed, ret %{public}" PRId32, ret); } while (isDecoderReady_) { std::shared_ptr screenData; @@ -483,7 +484,7 @@ void ImageSinkDecoder::DecodeScreenData() && !availableInputBufferQueue_.empty()); }); if (videoDataQueue_.empty() || availableInputIndexsQueue_.empty() || availableInputBufferQueue_.empty()) { - DHLOGD("%s: Index queue or data queue or buffer queue is empty.", LOG_TAG); + DHLOGD("%{public}s: Index queue or data queue or buffer queue is empty.", DSCREEN_LOG_TAG); continue; } bufferIndex = availableInputIndexsQueue_.front(); @@ -503,37 +504,38 @@ void ImageSinkDecoder::DecodeScreenData() int32_t ImageSinkDecoder::ProcessData(const std::shared_ptr &screenData, const int32_t bufferIndex) { - DHLOGI("%s: ProcessData.", LOG_TAG); + DHLOGI("%{public}s: ProcessData.", DSCREEN_LOG_TAG); if (videoDecoder_ == nullptr || screenData == nullptr) { - DHLOGE("%s: Decoder or screenData is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder or screenData is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } if (availableInputBufferQueue_.empty()) { - DHLOGD("%s: input buffer queue is empty.", LOG_TAG); + DHLOGD("%{public}s: input buffer queue is empty.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } std::shared_ptr inputBuffer = availableInputBufferQueue_.front(); if (inputBuffer == nullptr) { - DHLOGE("%s: Failed to obtain the input shared memory corresponding to the [%d] index.", LOG_TAG, bufferIndex); + DHLOGE("%{public}s: Failed to obtain the input shared memory corresponding to the [%{public}d] index.", + DSCREEN_LOG_TAG, bufferIndex); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } int32_t ret = memcpy_s(inputBuffer->GetBase(), inputBuffer->GetSize(), screenData->Data(), screenData->Capacity()); if (ret != EOK) { - DHLOGE("%s: Copy data failed.", LOG_TAG); + DHLOGE("%{public}s: Copy data failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } - DHLOGD("%s: Decode screen data. send data to H264 decoder", LOG_TAG); + DHLOGD("%{public}s: Decode screen data. send data to H264 decoder", DSCREEN_LOG_TAG); MediaAVCodec::AVCodecBufferInfo bufferInfo; bufferInfo.presentationTimeUs = 0; bufferInfo.size = static_cast(screenData->Capacity()); bufferInfo.offset = 0; ret = videoDecoder_->QueueInputBuffer(bufferIndex, bufferInfo, MediaAVCodec::AVCODEC_BUFFER_FLAG_NONE); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: QueueInputBuffer failed.", LOG_TAG); + DHLOGE("%{public}s: QueueInputBuffer failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } availableInputBufferQueue_.pop(); diff --git a/services/screentransport/screensinkprocessor/include/image_sink_processor.h b/services/screentransport/screensinkprocessor/include/image_sink_processor.h index b73e5694192a65620f8848febfd8c648dd079944..cdd33199d23779ed199b465380d8e177ca1817c2 100644 --- a/services/screentransport/screensinkprocessor/include/image_sink_processor.h +++ b/services/screentransport/screensinkprocessor/include/image_sink_processor.h @@ -38,7 +38,7 @@ public: int32_t ProcessImage(const std::shared_ptr &data) override; private: - static const constexpr char *LOG_TAG = "ImageSinkProcessor"; + static const constexpr char *DSCREEN_LOG_TAG = "ImageSinkProcessor"; VideoParam localParam_; VideoParam remoteParam_; std::shared_ptr imageDecoder_ = nullptr; diff --git a/services/screentransport/screensinkprocessor/src/image_sink_processor.cpp b/services/screentransport/screensinkprocessor/src/image_sink_processor.cpp index f17ccbd17f3432c008b25d740dd1ac08ad2aa6f1..c6c0d74364f50dcca3091b02a1f3644f66193a89 100644 --- a/services/screentransport/screensinkprocessor/src/image_sink_processor.cpp +++ b/services/screentransport/screensinkprocessor/src/image_sink_processor.cpp @@ -26,7 +26,7 @@ int32_t ImageSinkProcessor::ConfigureImageProcessor( const VideoParam &localParam, const VideoParam &remoteParam, const std::shared_ptr &imageListener) { - DHLOGI("%s: ConfigureImageProcessor.", LOG_TAG); + DHLOGI("%{public}s: ConfigureImageProcessor.", DSCREEN_LOG_TAG); localParam_ = localParam; remoteParam_ = remoteParam; @@ -34,7 +34,7 @@ int32_t ImageSinkProcessor::ConfigureImageProcessor( imageJpeg_ = std::make_shared(remoteParam); int32_t ret = imageDecoder_->ConfigureDecoder(localParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: ConfigureDecoder failed ret:%" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: ConfigureDecoder failed ret:%{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } @@ -43,9 +43,9 @@ int32_t ImageSinkProcessor::ConfigureImageProcessor( int32_t ImageSinkProcessor::ReleaseImageProcessor() { - DHLOGI("%s: ReleaseImageProcessor.", LOG_TAG); + DHLOGI("%{public}s: ReleaseImageProcessor.", DSCREEN_LOG_TAG); if (imageDecoder_ == nullptr) { - DHLOGE("%s: Decoder is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder is null.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "ReleaseImageProcessor Decoder is null."); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -54,7 +54,7 @@ int32_t ImageSinkProcessor::ReleaseImageProcessor() int32_t ret = imageDecoder_->ReleaseDecoder(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGE("%s: ReleaseDecoder failed.", LOG_TAG); + DHLOGE("%{public}s: ReleaseDecoder failed.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ret, "ReleaseDecoder failed."); return ret; } @@ -64,9 +64,9 @@ int32_t ImageSinkProcessor::ReleaseImageProcessor() int32_t ImageSinkProcessor::StartImageProcessor() { - DHLOGI("%s: StartImageProcessor.", LOG_TAG); + DHLOGI("%{public}s: StartImageProcessor.", DSCREEN_LOG_TAG); if (imageDecoder_ == nullptr) { - DHLOGE("%s: Decoder is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder is null.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "StartImageProcessor Decoder is null."); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -75,7 +75,7 @@ int32_t ImageSinkProcessor::StartImageProcessor() int32_t ret = imageDecoder_->StartDecoder(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGE("%s: StartDecoder failed ret:%" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: StartDecoder failed ret:%{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "StartDecoder failed."); return ret; } @@ -85,9 +85,9 @@ int32_t ImageSinkProcessor::StartImageProcessor() int32_t ImageSinkProcessor::StopImageProcessor() { - DHLOGI("%s: StopImageProcessor.", LOG_TAG); + DHLOGI("%{public}s: StopImageProcessor.", DSCREEN_LOG_TAG); if (imageDecoder_ == nullptr) { - DHLOGE("%s: Decoder is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder is null.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "StopImageProcessor Decoder is null."); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -96,7 +96,7 @@ int32_t ImageSinkProcessor::StopImageProcessor() int32_t ret = imageDecoder_->StopDecoder(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGE("%s: StopDecoder failed ret:%" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: StopDecoder failed ret:%{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "StopDecoder failed."); return ret; } @@ -106,23 +106,23 @@ int32_t ImageSinkProcessor::StopImageProcessor() int32_t ImageSinkProcessor::SetImageSurface(sptr &surface) { - DHLOGI("%s: SetImageSurface.", LOG_TAG); + DHLOGI("%{public}s: SetImageSurface.", DSCREEN_LOG_TAG); if (imageDecoder_ == nullptr || surface == nullptr) { - DHLOGE("%s: Decoder or surface is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder or surface is null.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "SetImageSurface Decoder is null."); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = imageDecoder_->SetOutputSurface(surface); if (ret != DH_SUCCESS) { - DHLOGE("%s: SetOutputSurface failed ret:%" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: SetOutputSurface failed ret:%{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "SetOutputSurface failed."); return ret; } ret = imageJpeg_->SetOutputSurface(surface); if (ret != DH_SUCCESS) { - DHLOGE("%s: imageJpeg SetImageSurface failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: imageJpeg SetImageSurface failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "imageJpeg SetOutputSurface failed."); return ret; } @@ -131,9 +131,9 @@ int32_t ImageSinkProcessor::SetImageSurface(sptr &surface) int32_t ImageSinkProcessor::ProcessImage(const std::shared_ptr &data) { - DHLOGI("%s: ProcessImage.", LOG_TAG); + DHLOGI("%{public}s: ProcessImage.", DSCREEN_LOG_TAG); if (imageDecoder_ == nullptr || data == nullptr) { - DHLOGE("%s: Decoder or data is null.", LOG_TAG); + DHLOGE("%{public}s: Decoder or data is null.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "processImage Decoder is null."); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -141,19 +141,19 @@ int32_t ImageSinkProcessor::ProcessImage(const std::shared_ptr &data if (data->DataType() == VIDEO_FULL_SCREEN_DATA) { int32_t ret = imageDecoder_->InputScreenData(data); if (ret != DH_SUCCESS) { - DHLOGE("%s: InputScreenData failed ret:%" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: InputScreenData failed ret:%{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "InputScreenData failed."); return ret; } } else if (data->DataType() == VIDEO_PART_SCREEN_DATA) { int32_t ret = imageJpeg_->FillDirtyImages2Surface(data, imageDecoder_->GetLastFrame()); if (ret != DH_SUCCESS) { - DHLOGE("%s: FillDirtyImages2Surface failed ret:%" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: FillDirtyImages2Surface failed ret:%{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "FillDirtyImages2Surface failed."); return ret; } } else { - DHLOGE("%s: data type is invalid.", LOG_TAG); + DHLOGE("%{public}s: data type is invalid.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_DATA_TYPE_INVALID; } return DH_SUCCESS; diff --git a/services/screentransport/screensinktrans/include/screen_sink_trans.h b/services/screentransport/screensinktrans/include/screen_sink_trans.h index 823348901b0f52b24d997167a4cfc2ad46cfe63f..f9c69b6b53dea88e9ca53368f015798bb3ad57f8 100644 --- a/services/screentransport/screensinktrans/include/screen_sink_trans.h +++ b/services/screentransport/screensinktrans/include/screen_sink_trans.h @@ -56,7 +56,7 @@ private: const std::string &peerDevId); private: - static const constexpr char *LOG_TAG = "ScreenSinkTrans"; + static const constexpr char *DSCREEN_LOG_TAG = "ScreenSinkTrans"; std::string version_ = "1.0"; sptr decoderSurface_; diff --git a/services/screentransport/screensinktrans/src/screen_sink_trans.cpp b/services/screentransport/screensinktrans/src/screen_sink_trans.cpp index 06b2f16de44e1b2989ade9532490fc7f0f2d0ecc..e25957386231e696f4a6241929ddc1338ecaebaf 100644 --- a/services/screentransport/screensinktrans/src/screen_sink_trans.cpp +++ b/services/screentransport/screensinktrans/src/screen_sink_trans.cpp @@ -28,34 +28,34 @@ namespace DistributedHardware { int32_t ScreenSinkTrans::SetUp(const VideoParam &localParam, const VideoParam &remoteParam, const std::string &peerDevId) { - DHLOGI("%s: SetUp.", LOG_TAG); + DHLOGI("%{public}s: SetUp.", DSCREEN_LOG_TAG); int32_t ret = CheckTransParam(localParam, remoteParam, peerDevId); if (ret != DH_SUCCESS) { - DHLOGE("%s: SetUp failed param error ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: SetUp failed param error ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } ret = InitScreenTrans(localParam, remoteParam, peerDevId); if (ret != DH_SUCCESS) { - DHLOGE("%s: SetUp failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: SetUp failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } - DHLOGI("%s: SetUp success.", LOG_TAG); + DHLOGI("%{public}s: SetUp success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenSinkTrans::Release() { - DHLOGI("%s: Release.", LOG_TAG); + DHLOGI("%{public}s: Release.", DSCREEN_LOG_TAG); if (imageProcessor_ == nullptr || screenChannel_ == nullptr) { - DHLOGE("%s: Processor or channel is null, Setup first.", LOG_TAG); + DHLOGE("%{public}s: Processor or channel is null, Setup first.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = imageProcessor_->ReleaseImageProcessor(); if (ret != DH_SUCCESS) { - DHLOGD("%s: Release image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGD("%{public}s: Release image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } imageProcessor_ = nullptr; @@ -63,44 +63,44 @@ int32_t ScreenSinkTrans::Release() ret = screenChannel_->ReleaseSession(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGD("%s: Release channel session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGD("%{public}s: Release channel session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } screenChannel_ = nullptr; - DHLOGI("%s: Release success.", LOG_TAG); + DHLOGI("%{public}s: Release success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenSinkTrans::Start() { - DHLOGI("%s: Start.", LOG_TAG); + DHLOGI("%{public}s: Start.", DSCREEN_LOG_TAG); if (imageProcessor_ == nullptr) { - DHLOGE("%s: Processor is null, Setup first.", LOG_TAG); + DHLOGE("%{public}s: Processor is null, Setup first.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = imageProcessor_->StartImageProcessor(); if (ret != DH_SUCCESS) { - DHLOGE("%s: Start image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Start image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } - DHLOGI("%s: Start success.", LOG_TAG); + DHLOGI("%{public}s: Start success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenSinkTrans::Stop() { - DHLOGI("%s: Stop.", LOG_TAG); + DHLOGI("%{public}s: Stop.", DSCREEN_LOG_TAG); if (imageProcessor_ == nullptr || screenChannel_ == nullptr) { - DHLOGE("%s: Processor or channel is null, Setup first.", LOG_TAG); + DHLOGE("%{public}s: Processor or channel is null, Setup first.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } bool stopStatus = true; int32_t ret = imageProcessor_->StopImageProcessor(); if (ret != DH_SUCCESS) { - DHLOGD("%s: Stop image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGD("%{public}s: Stop image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); stopStatus = false; } @@ -108,24 +108,24 @@ int32_t ScreenSinkTrans::Stop() ret = screenChannel_->CloseSession(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS && ret != ERR_DH_SCREEN_TRANS_SESSION_NOT_OPEN) { - DHLOGD("%s: Close Session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGD("%{public}s: Close Session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); stopStatus = false; } if (!stopStatus) { - DHLOGE("%s: Stop sink trans failed.", LOG_TAG); + DHLOGE("%{public}s: Stop sink trans failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ERROR; } - DHLOGI("%s: Stop success.", LOG_TAG); + DHLOGI("%{public}s: Stop success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenSinkTrans::RegisterStateCallback(const std::shared_ptr &callback) { - DHLOGI("%s:RegisterStateCallback.", LOG_TAG); + DHLOGI("%{public}s:RegisterStateCallback.", DSCREEN_LOG_TAG); if (callback == nullptr) { - DHLOGE("%s: Trans callback is null.", LOG_TAG); + DHLOGE("%{public}s: Trans callback is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } transCallback_ = callback; @@ -136,7 +136,7 @@ int32_t ScreenSinkTrans::RegisterStateCallback(const std::shared_ptr &surface) { if (surface == nullptr) { - DHLOGE("%s: Image surface is null.", LOG_TAG); + DHLOGE("%{public}s: Image surface is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } decoderSurface_ = surface; @@ -149,7 +149,7 @@ int32_t ScreenSinkTrans::CheckVideoParam(const VideoParam ¶m) if ((param.GetCodecType() != VIDEO_CODEC_TYPE_VIDEO_H264) && (param.GetCodecType() != VIDEO_CODEC_TYPE_VIDEO_H265) && (param.GetCodecType() != VIDEO_CODEC_TYPE_VIDEO_MPEG4)) { - DHLOGE("%s: Invalid codec type.", LOG_TAG); + DHLOGE("%{public}s: Invalid codec type.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } @@ -157,19 +157,19 @@ int32_t ScreenSinkTrans::CheckVideoParam(const VideoParam ¶m) (param.GetVideoFormat() != VIDEO_DATA_FORMAT_NV12) && (param.GetVideoFormat() != VIDEO_DATA_FORMAT_NV21) && (param.GetVideoFormat() != VIDEO_DATA_FORMAT_RGBA8888)) { - DHLOGE("%s: Invalid video data format.", LOG_TAG); + DHLOGE("%{public}s: Invalid video data format.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } if ((param.GetVideoWidth() > DSCREEN_MAX_VIDEO_DATA_WIDTH) || (param.GetVideoHeight() > DSCREEN_MAX_VIDEO_DATA_HEIGHT)) { - DHLOGE("%s: Invalid video data size.", LOG_TAG); + DHLOGE("%{public}s: Invalid video data size.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } if ((param.GetScreenWidth() > DSCREEN_MAX_SCREEN_DATA_WIDTH) || (param.GetScreenHeight() > DSCREEN_MAX_SCREEN_DATA_HEIGHT)) { - DHLOGE("%s: Invalid screen data size.", LOG_TAG); + DHLOGE("%{public}s: Invalid screen data size.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } @@ -180,19 +180,19 @@ int32_t ScreenSinkTrans::CheckTransParam(const VideoParam &localParam, const Vid const std::string &peerDevId) { if (peerDevId.empty()) { - DHLOGE("%s: Remote device id is null.", LOG_TAG); + DHLOGE("%{public}s: Remote device id is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = CheckVideoParam(localParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: check localParam param failed.", LOG_TAG); + DHLOGE("%{public}s: check localParam param failed.", DSCREEN_LOG_TAG); return ret; } ret = CheckVideoParam(remoteParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: check remoteParam param failed.", LOG_TAG); + DHLOGE("%{public}s: check remoteParam param failed.", DSCREEN_LOG_TAG); return ret; } return DH_SUCCESS; @@ -207,7 +207,7 @@ int32_t ScreenSinkTrans::InitScreenTrans(const VideoParam &localParam, const Vid } int32_t ret = RegisterChannelListener(); if (ret != DH_SUCCESS) { - DHLOGE("%s: Register channel listener failed.", LOG_TAG); + DHLOGE("%{public}s: Register channel listener failed.", DSCREEN_LOG_TAG); screenChannel_ = nullptr; return ret; } @@ -216,7 +216,7 @@ int32_t ScreenSinkTrans::InitScreenTrans(const VideoParam &localParam, const Vid ret = RegisterProcessorListener(localParam, remoteParam, peerDevId); if (ret != DH_SUCCESS) { - DHLOGE("%s: Register processor listener failed.", LOG_TAG); + DHLOGE("%{public}s: Register processor listener failed.", DSCREEN_LOG_TAG); screenChannel_ = nullptr; imageProcessor_ = nullptr; return ret; @@ -227,16 +227,16 @@ int32_t ScreenSinkTrans::InitScreenTrans(const VideoParam &localParam, const Vid int32_t ScreenSinkTrans::RegisterChannelListener() { - DHLOGI("%s: RegisterChannelListener.", LOG_TAG); + DHLOGI("%{public}s: RegisterChannelListener.", DSCREEN_LOG_TAG); std::shared_ptr listener = shared_from_this(); if (listener == nullptr) { - DHLOGE("%s: Channel Listener is null.", LOG_TAG); + DHLOGE("%{public}s: Channel Listener is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = screenChannel_->CreateSession(listener); if (ret != DH_SUCCESS) { - DHLOGE("%s: Register channel listenner failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Register channel listenner failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "dscreen sink Create session failed."); return ret; } @@ -248,26 +248,26 @@ int32_t ScreenSinkTrans::RegisterProcessorListener(const VideoParam &localParam, const std::string &peerDevId) { if (imageProcessor_ == nullptr || decoderSurface_ == nullptr) { - DHLOGE("%s: imageProcessor_ or decoderSurface_ is nullptr.", LOG_TAG); + DHLOGE("%{public}s: imageProcessor_ or decoderSurface_ is nullptr.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } - DHLOGI("%s: RegisterProcessorListener.", LOG_TAG); + DHLOGI("%{public}s: RegisterProcessorListener.", DSCREEN_LOG_TAG); std::shared_ptr listener = shared_from_this(); if (listener == nullptr) { - DHLOGE("%s: Channel listener to null.", LOG_TAG); + DHLOGE("%{public}s: Channel listener to null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = imageProcessor_->ConfigureImageProcessor(localParam, remoteParam, listener); if (ret != DH_SUCCESS) { - DHLOGE("%s: Config image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Config image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "Config image processor failed."); return ret; } ret = imageProcessor_->SetImageSurface(decoderSurface_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Set image surface failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Set image surface failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } return DH_SUCCESS; @@ -275,30 +275,30 @@ int32_t ScreenSinkTrans::RegisterProcessorListener(const VideoParam &localParam, void ScreenSinkTrans::OnSessionOpened() { - DHLOGI("%s: OnChannelSessionOpened and start enable low latency", LOG_TAG); + DHLOGI("%{public}s: OnChannelSessionOpened and start enable low latency", DSCREEN_LOG_TAG); std::shared_ptr dhFwkKit = DScreenFwkKit::GetInstance().GetDHFwkKit(); if (dhFwkKit != nullptr) { int32_t ret = dhFwkKit->PublishMessage(DHTopic::TOPIC_LOW_LATENCY, ENABLE_LOW_LATENCY.dump()); if (ret != DH_FWK_SUCCESS) { - DHLOGE("%s: Sink start enable low latency failed ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Sink start enable low latency failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } } } void ScreenSinkTrans::OnSessionClosed() { - DHLOGI("%s: OnChannelSessionClosed and stop enable low latency", LOG_TAG); + DHLOGI("%{public}s: OnChannelSessionClosed and stop enable low latency", DSCREEN_LOG_TAG); std::shared_ptr dhFwkKit = DScreenFwkKit::GetInstance().GetDHFwkKit(); if (dhFwkKit != nullptr) { int32_t ret = dhFwkKit->PublishMessage(DHTopic::TOPIC_LOW_LATENCY, DISABLE_LOW_LATENCY.dump()); if (ret != DH_FWK_SUCCESS) { - DHLOGE("%s: Sink stop enable low latency failed ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Sink stop enable low latency failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } } std::shared_ptr callback = transCallback_.lock(); if (callback == nullptr) { - DHLOGE("%s: Trans callback is null.", LOG_TAG); + DHLOGE("%{public}s: Trans callback is null.", DSCREEN_LOG_TAG); return; } callback->OnError(ERR_DH_SCREEN_TRANS_SESSION_CLOSED, "OnChannelSessionClosed"); @@ -307,13 +307,13 @@ void ScreenSinkTrans::OnSessionClosed() void ScreenSinkTrans::OnDataReceived(const std::shared_ptr &data) { if (imageProcessor_ == nullptr || data == nullptr) { - DHLOGE("%s: imageProcessor_ or data is nullptr.", LOG_TAG); + DHLOGE("%{public}s: imageProcessor_ or data is nullptr.", DSCREEN_LOG_TAG); return; } - DHLOGD("%s: OnChannelDataReceived.", LOG_TAG); + DHLOGD("%{public}s: OnChannelDataReceived.", DSCREEN_LOG_TAG); int32_t ret = imageProcessor_->ProcessImage(data); if (ret != DH_SUCCESS) { - DHLOGE("%s: send data to image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: send data to image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } } @@ -324,10 +324,10 @@ void ScreenSinkTrans::SetScreenVersion(const std::string &version) void ScreenSinkTrans::OnProcessorStateNotify(int32_t state) { - DHLOGI("%s: OnProcessorStateNotify.", LOG_TAG); + DHLOGI("%{public}s: OnProcessorStateNotify.", DSCREEN_LOG_TAG); std::shared_ptr callback = transCallback_.lock(); if (callback == nullptr) { - DHLOGE("%s: Trans callback is null.", LOG_TAG); + DHLOGE("%{public}s: Trans callback is null.", DSCREEN_LOG_TAG); return; } callback->OnError(state, "OnProcessorStateNotify"); diff --git a/services/screentransport/screensourceprocessor/encoder/include/image_encoder_callback.h b/services/screentransport/screensourceprocessor/encoder/include/image_encoder_callback.h index dcf007b3ca8cc0facf59dcf96b8300a69657ae3c..3b06a70298f6c1d8283c855d4c1a5708061d48b6 100644 --- a/services/screentransport/screensourceprocessor/encoder/include/image_encoder_callback.h +++ b/services/screentransport/screensourceprocessor/encoder/include/image_encoder_callback.h @@ -38,7 +38,7 @@ public: void OnOutputFormatChanged(const Media::Format &format) override; private: - static const constexpr char *LOG_TAG = "ImageEncoderCallback"; + static const constexpr char *DSCREEN_LOG_TAG = "ImageEncoderCallback"; std::weak_ptr videoEncoder_; }; diff --git a/services/screentransport/screensourceprocessor/encoder/include/image_source_encoder.h b/services/screentransport/screensourceprocessor/encoder/include/image_source_encoder.h index 12283e83525ea40211797f318db21a3b24b50259..a07afa4cc94bc066dde17c93b781374862877841 100644 --- a/services/screentransport/screensourceprocessor/encoder/include/image_source_encoder.h +++ b/services/screentransport/screensourceprocessor/encoder/include/image_source_encoder.h @@ -41,7 +41,7 @@ public: ~ConsumerBufferListener() = default; void OnBufferAvailable() override; private: - static const constexpr char *LOG_TAG = "ConsumerBufferListener"; + static const constexpr char *DSCREEN_LOG_TAG = "ConsumerBufferListener"; std::shared_ptr encoder_; }; class ImageSourceEncoder : public std::enable_shared_from_this { @@ -72,7 +72,7 @@ private: int32_t SetEncoderFormat(const VideoParam &configParam); private: - static const constexpr char *LOG_TAG = "ImageSourceEncoder"; + static const constexpr char *DSCREEN_LOG_TAG = "ImageSourceEncoder"; Media::Format imageFormat_; MediaAVCodec::AVCodecBufferInfo encoderBufferInfo_; diff --git a/services/screentransport/screensourceprocessor/encoder/src/image_encoder_callback.cpp b/services/screentransport/screensourceprocessor/encoder/src/image_encoder_callback.cpp index 7f93cadba7ce88ac29343ff2a3fa3164ec65f7a0..93f0be2bca83ff9711d7f9c513d38866e3230bae 100644 --- a/services/screentransport/screensourceprocessor/encoder/src/image_encoder_callback.cpp +++ b/services/screentransport/screensourceprocessor/encoder/src/image_encoder_callback.cpp @@ -22,7 +22,7 @@ namespace OHOS { namespace DistributedHardware { void ImageEncoderCallback::OnError(MediaAVCodec::AVCodecErrorType errorType, int32_t errorCode) { - DHLOGD("%s: OnError.", LOG_TAG); + DHLOGD("%{public}s: OnError.", DSCREEN_LOG_TAG); std::shared_ptr encoder = videoEncoder_.lock(); if (encoder == nullptr) { DHLOGE("encoder is nullptr."); @@ -34,7 +34,7 @@ void ImageEncoderCallback::OnError(MediaAVCodec::AVCodecErrorType errorType, int void ImageEncoderCallback::OnOutputBufferAvailable(uint32_t index, MediaAVCodec::AVCodecBufferInfo info, MediaAVCodec::AVCodecBufferFlag flag, std::shared_ptr buffer) { - DHLOGD("%s: OnOutputBufferAvailable.", LOG_TAG); + DHLOGD("%{public}s: OnOutputBufferAvailable.", DSCREEN_LOG_TAG); std::shared_ptr encoder = videoEncoder_.lock(); if (encoder == nullptr) { DHLOGE("encoder is nullptr."); @@ -45,7 +45,7 @@ void ImageEncoderCallback::OnOutputBufferAvailable(uint32_t index, MediaAVCodec: void ImageEncoderCallback::OnInputBufferAvailable(uint32_t index, std::shared_ptr buffer) { - DHLOGD("%s: OnInputBufferAvailable.", LOG_TAG); + DHLOGD("%{public}s: OnInputBufferAvailable.", DSCREEN_LOG_TAG); std::shared_ptr encoder = videoEncoder_.lock(); if (encoder == nullptr) { DHLOGE("encoder is nullptr."); @@ -56,7 +56,7 @@ void ImageEncoderCallback::OnInputBufferAvailable(uint32_t index, std::shared_pt void ImageEncoderCallback::OnOutputFormatChanged(const Media::Format &format) { - DHLOGD("%s: OnOutputFormatChanged.", LOG_TAG); + DHLOGD("%{public}s: OnOutputFormatChanged.", DSCREEN_LOG_TAG); std::shared_ptr encoder = videoEncoder_.lock(); if (encoder == nullptr) { DHLOGE("encoder is nullptr."); diff --git a/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp b/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp index 228276553fb75fc537896569df1ef204774606d4..381d35b4b7a688b3cebfd73d57b5b03c69e6c826 100644 --- a/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp +++ b/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp @@ -40,7 +40,7 @@ namespace OHOS { namespace DistributedHardware { void ConsumerBufferListener::OnBufferAvailable() { - DHLOGI("%s: OnBufferAvailable, receiv data from RS.", LOG_TAG); + DHLOGI("%{public}s: OnBufferAvailable, receiv data from RS.", DSCREEN_LOG_TAG); encoder_->ConsumeSurface(); } @@ -53,13 +53,13 @@ void ImageSourceEncoder::InitDscreenDBG() } pHandler_ = dlopen(path, RTLD_LAZY | RTLD_NODELETE | RTLD_GLOBAL); if (pHandler_ == nullptr) { - DHLOGE("%s: handler load failed, fail reason: %s.", path, dlerror()); + DHLOGE("%{public}s: handler load failed, fail reason: %{public}s.", path, dlerror()); return; } GetDscreenDBGItfFunc getDscreenDBGItfFunc = (GetDscreenDBGItfFunc)dlsym(pHandler_, GET_DBG_ITF_FUNC.c_str()); GetImageDirtyFunc getImageDirtyFunc = (GetImageDirtyFunc)dlsym(pHandler_, GET_IMAGE_DIRTY_FUNC.c_str()); if (getDscreenDBGItfFunc == nullptr || getImageDirtyFunc ==nullptr) { - DHLOGE("get FUNC failed, failed reason: %s.", dlerror()); + DHLOGE("get FUNC failed, failed reason: %{public}s.", dlerror()); return; } dscreenDbgItfPtr_ = getDscreenDBGItfFunc(); @@ -74,10 +74,10 @@ void ImageSourceEncoder::InitDscreenDBG() void ImageSourceEncoder::ConsumeSurface() { - DHLOGI("%s: ConsumeSurface.", LOG_TAG); + DHLOGI("%{public}s: ConsumeSurface.", DSCREEN_LOG_TAG); std::unique_lock bufLock(bufferMtx_); if (consumerSurface_ == nullptr) { - DHLOGE("%s: consumerSurface_ is nullptr.", LOG_TAG); + DHLOGE("%{public}s: consumerSurface_ is nullptr.", DSCREEN_LOG_TAG); return; } sptr surfaceBuffer = nullptr; @@ -86,13 +86,14 @@ void ImageSourceEncoder::ConsumeSurface() OHOS::Rect damage = {0, 0, 0, 0}; SurfaceError surfaceErr = consumerSurface_->AcquireBuffer(surfaceBuffer, syncFence_, timestamp, damage); if (surfaceErr != SURFACE_ERROR_OK) { - DHLOGE("%s: consumerSurface_ acquire buffer failed, errcode: %" PRId32, LOG_TAG, surfaceErr); + DHLOGE("%{public}s: consumerSurface_ acquire buffer failed, errcode: %{public}" PRId32, DSCREEN_LOG_TAG, + surfaceErr); consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); return; } int32_t retcode = syncFence_->Wait(SURFACE_SYNC_FENCE_TIMEOUT); if (retcode == -ETIME) { - DHLOGE("%s: Sync fence wait timeout, retcode is %." PRId32, LOG_TAG, retcode); + DHLOGE("%{public}s: Sync fence wait timeout, retcode is %{public}" PRId32, DSCREEN_LOG_TAG, retcode); return; } if (pHandler_ != nullptr) { @@ -102,7 +103,7 @@ void ImageSourceEncoder::ConsumeSurface() std::vector damages = VecToDamage(eventContent_); std::shared_ptr listener = imageProcessorListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Processor listener is null", LOG_TAG); + DHLOGE("%{public}s: Processor listener is null", DSCREEN_LOG_TAG); consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); return; } @@ -112,28 +113,28 @@ void ImageSourceEncoder::ConsumeSurface() int32_t ImageSourceEncoder::ConfigureEncoder(const VideoParam &configParam) { - DHLOGI("%s: ConfigureEncoder.", LOG_TAG); + DHLOGI("%{public}s: ConfigureEncoder.", DSCREEN_LOG_TAG); int32_t ret = InitVideoEncoder(configParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: Init encoder failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Init encoder failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } ret = SetEncoderFormat(configParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: Set encoder format failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Set encoder format failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } encoderSurface_ = videoEncoder_->CreateInputSurface(); if (encoderSurface_ == nullptr) { - DHLOGE("%s: Create encoder surface failed.", LOG_TAG); + DHLOGE("%{public}s: Create encoder surface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } configParam_ = configParam; ret = AddSurface(); if (ret != DH_SUCCESS) { - DHLOGE("%s: Add surface failed ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Add surface failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); consumerSurface_ = nullptr; producerSurface_ = nullptr; return ret; @@ -143,20 +144,20 @@ int32_t ImageSourceEncoder::ConfigureEncoder(const VideoParam &configParam) int32_t ImageSourceEncoder::AddSurface() { - DHLOGI("%s: AddSurface.", LOG_TAG); + DHLOGI("%{public}s: AddSurface.", DSCREEN_LOG_TAG); consumerSurface_ = IConsumerSurface::Create(); if (consumerSurface_ == nullptr) { - DHLOGE("%s: creat consumer surface failed.", LOG_TAG); + DHLOGE("%{public}s: creat consumer surface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } sptr producer = consumerSurface_->GetProducer(); if (producer == nullptr) { - DHLOGE("%s: Creat producer surface failed.", LOG_TAG); + DHLOGE("%{public}s: Creat producer surface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } producerSurface_ = Surface::CreateSurfaceAsProducer(producer); if (producerSurface_ == nullptr) { - DHLOGE("%s: Create preducer surface failed.", LOG_TAG); + DHLOGE("%{public}s: Create preducer surface failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SURFACE_ERROR; } consumerBufferListener_ = new ConsumerBufferListener(shared_from_this()); @@ -166,13 +167,13 @@ int32_t ImageSourceEncoder::AddSurface() sptr ImageSourceEncoder::GetConsumerSurface() { - DHLOGI("%s: GetConsumerSurface.", LOG_TAG); + DHLOGI("%{public}s: GetConsumerSurface.", DSCREEN_LOG_TAG); return consumerSurface_; } sptr &ImageSourceEncoder::GetInputSurface() { - DHLOGI("%s: GetInputSurface.", LOG_TAG); + DHLOGI("%{public}s: GetInputSurface.", DSCREEN_LOG_TAG); if (producerSurface_ == nullptr || !configParam_.GetPartialRefreshFlag()) { return encoderSurface_; } @@ -181,7 +182,7 @@ sptr &ImageSourceEncoder::GetInputSurface() std::vector ImageSourceEncoder::VecToDamage(std::vector> eventContent) { - DHLOGI("%s: VecToDamage.", LOG_TAG); + DHLOGI("%{public}s: VecToDamage.", DSCREEN_LOG_TAG); std::vector damages; for (auto item : eventContent) { OHOS::Rect damage = {0, 0, 0, 0}; @@ -196,7 +197,7 @@ std::vector ImageSourceEncoder::VecToDamage(std::vector ImageSourceEncoder::GetEncoderInputSurfaceBuffer() { - DHLOGI("%s: GetEncoderInputSurfaceBuffer.", LOG_TAG); + DHLOGI("%{public}s: GetEncoderInputSurfaceBuffer.", DSCREEN_LOG_TAG); OHOS::BufferRequestConfig requestConfig; requestConfig.width = static_cast(configParam_.GetVideoWidth()); requestConfig.height = static_cast(configParam_.GetVideoHeight()); @@ -208,7 +209,7 @@ sptr ImageSourceEncoder::GetEncoderInputSurfaceBuffer() int32_t releaseFence = -1; SurfaceError surfaceErr = encoderSurface_->RequestBuffer(encoderSurfaceBuffer, releaseFence, requestConfig); if (surfaceErr != GSERROR_OK || encoderSurfaceBuffer == nullptr) { - DHLOGE("%s: RequestBuffer failed.", LOG_TAG); + DHLOGE("%{public}s: RequestBuffer failed.", DSCREEN_LOG_TAG); encoderSurface_->CancelBuffer(encoderSurfaceBuffer); } return encoderSurfaceBuffer; @@ -226,16 +227,16 @@ int32_t ImageSourceEncoder::FeedEncoderData(sptr &surfaceBuffer) auto surfaceAddr = static_cast(surfaceBuffer->GetVirAddr()); int32_t ret = memcpy_s(encoderSurfaceAddr, screenDataSize, surfaceAddr, screenDataSize); if (ret != EOK) { - DHLOGE("%s: surfaceBuffer memcpy_s run failed.", LOG_TAG); + DHLOGE("%{public}s: surfaceBuffer memcpy_s run failed.", DSCREEN_LOG_TAG); consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); encoderSurface_->CancelBuffer(encoderSurfaceBuffer); return ret; } BufferFlushConfig flushConfig = { {0, 0, encoderSurfaceBuffer->GetWidth(), encoderSurfaceBuffer->GetHeight()}, 0}; - DHLOGI("%s: FeedEncoderData to encoder.", LOG_TAG); + DHLOGI("%{public}s: FeedEncoderData to encoder.", DSCREEN_LOG_TAG); SurfaceError surfaceErr = encoderSurface_->FlushBuffer(encoderSurfaceBuffer, -1, flushConfig); if (surfaceErr != SURFACE_ERROR_OK) { - DHLOGE("%s: encoderSurface_ flush buffer failed.", LOG_TAG); + DHLOGE("%{public}s: encoderSurface_ flush buffer failed.", DSCREEN_LOG_TAG); consumerSurface_->ReleaseBuffer(surfaceBuffer, -1); encoderSurface_->CancelBuffer(encoderSurfaceBuffer); return surfaceErr; @@ -246,15 +247,15 @@ int32_t ImageSourceEncoder::FeedEncoderData(sptr &surfaceBuffer) int32_t ImageSourceEncoder::ReleaseEncoder() { - DHLOGI("%s: ReleaseEncoder.", LOG_TAG); + DHLOGI("%{public}s: ReleaseEncoder.", DSCREEN_LOG_TAG); if (videoEncoder_ == nullptr) { - DHLOGE("%s: Encoder is null.", LOG_TAG); + DHLOGE("%{public}s: Encoder is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = videoEncoder_->Release(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Release encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Release encoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_RELEASE_FAILED; } if (pHandler_ != nullptr) { @@ -269,21 +270,21 @@ int32_t ImageSourceEncoder::ReleaseEncoder() int32_t ImageSourceEncoder::StartEncoder() { - DHLOGI("%s: StartEncoder.", LOG_TAG); + DHLOGI("%{public}s: StartEncoder.", DSCREEN_LOG_TAG); if (videoEncoder_ == nullptr) { - DHLOGE("%s: Encoder is null.", LOG_TAG); + DHLOGE("%{public}s: Encoder is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = videoEncoder_->Prepare(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Prepare encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Prepare encoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_PREPARE_FAILED; } ret = videoEncoder_->Start(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Start encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Start encoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_START_FAILED; } InitDscreenDBG(); @@ -292,20 +293,20 @@ int32_t ImageSourceEncoder::StartEncoder() int32_t ImageSourceEncoder::StopEncoder() { - DHLOGI("%s: StopEncoder.", LOG_TAG); + DHLOGI("%{public}s: StopEncoder.", DSCREEN_LOG_TAG); if (videoEncoder_ == nullptr) { - DHLOGE("%s: Encoder is null.", LOG_TAG); + DHLOGE("%{public}s: Encoder is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = videoEncoder_->Flush(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Flush encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Flush encoder failed.", DSCREEN_LOG_TAG); } ret = videoEncoder_->Stop(); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Stop encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Stop encoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_STOP_FAILED; } ret = consumerSurface_->UnregisterConsumerListener(); @@ -319,7 +320,7 @@ int32_t ImageSourceEncoder::StopEncoder() int32_t ImageSourceEncoder::InitVideoEncoder(const VideoParam &configParam) { - DHLOGI("%s: InitVideoEncoder.", LOG_TAG); + DHLOGI("%{public}s: InitVideoEncoder.", DSCREEN_LOG_TAG); switch (configParam.GetCodecType()) { case VIDEO_CODEC_TYPE_VIDEO_H264: videoEncoder_ = MediaAVCodec::VideoEncoderFactory::CreateByMime( @@ -330,19 +331,19 @@ int32_t ImageSourceEncoder::InitVideoEncoder(const VideoParam &configParam) std::string(MediaAVCodec::CodecMimeType::VIDEO_HEVC)); break; default: - DHLOGE("%s: codecType is invalid!", LOG_TAG); + DHLOGE("%{public}s: codecType is invalid!", DSCREEN_LOG_TAG); videoEncoder_ = nullptr; } if (videoEncoder_ == nullptr) { - DHLOGE("%s: Create videoEncoder failed.", LOG_TAG); + DHLOGE("%{public}s: Create videoEncoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_CREATE_CODEC_FAILED; } encodeVideoCallback_ = std::make_shared(shared_from_this()); int32_t ret = videoEncoder_->SetCallback(encodeVideoCallback_); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Set codec callback failed.", LOG_TAG); + DHLOGE("%{public}s: Set codec callback failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_SET_CALLBACK_FAILED; } @@ -351,9 +352,9 @@ int32_t ImageSourceEncoder::InitVideoEncoder(const VideoParam &configParam) int32_t ImageSourceEncoder::SetEncoderFormat(const VideoParam &configParam) { - DHLOGI("%s: SetEncoderFormat.", LOG_TAG); + DHLOGI("%{public}s: SetEncoderFormat.", DSCREEN_LOG_TAG); if (videoEncoder_ == nullptr) { - DHLOGE("%s: Encoder is null.", LOG_TAG); + DHLOGE("%{public}s: Encoder is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -365,7 +366,7 @@ int32_t ImageSourceEncoder::SetEncoderFormat(const VideoParam &configParam) imageFormat_.PutStringValue("codec_mime", MediaAVCodec::CodecMimeType::VIDEO_HEVC); break; default: - DHLOGE("%s: Codec type is invalid.", LOG_TAG); + DHLOGE("%{public}s: Codec type is invalid.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } @@ -377,7 +378,7 @@ int32_t ImageSourceEncoder::SetEncoderFormat(const VideoParam &configParam) int32_t ret = videoEncoder_->Configure(imageFormat_); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: Configure encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Configure encoder failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_CODEC_CONFIGURE_FAILED; } return DH_SUCCESS; @@ -385,10 +386,11 @@ int32_t ImageSourceEncoder::SetEncoderFormat(const VideoParam &configParam) void ImageSourceEncoder::OnError(MediaAVCodec::AVCodecErrorType errorType, int32_t errorCode) { - DHLOGI("%s: Encoder error, errorType:%" PRId32", errorCode:%" PRId32, LOG_TAG, errorType, errorCode); + DHLOGI("%{public}s: Encoder error, errorType:%{public}" PRId32 ", errorCode:%{public}" PRId32, DSCREEN_LOG_TAG, + errorType, errorCode); std::shared_ptr listener = imageProcessorListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Processor listener is null", LOG_TAG); + DHLOGE("%{public}s: Processor listener is null", DSCREEN_LOG_TAG); return; } listener->OnProcessorStateNotify(errorCode); @@ -397,32 +399,32 @@ void ImageSourceEncoder::OnError(MediaAVCodec::AVCodecErrorType errorType, int32 void ImageSourceEncoder::OnOutputBufferAvailable(uint32_t index, MediaAVCodec::AVCodecBufferInfo info, MediaAVCodec::AVCodecBufferFlag flag, std::shared_ptr buffer) { - DHLOGD("%s: OnOutputBufferAvailable, receiv H264 data from encoder.", LOG_TAG); + DHLOGD("%{public}s: OnOutputBufferAvailable, receiv H264 data from encoder.", DSCREEN_LOG_TAG); std::shared_ptr listener = imageProcessorListener_.lock(); if (listener == nullptr) { - DHLOGE("%s: Processor listener is null", LOG_TAG); + DHLOGE("%{public}s: Processor listener is null", DSCREEN_LOG_TAG); return; } if (videoEncoder_ == nullptr) { - DHLOGE("%s: Encoder is null.", LOG_TAG); + DHLOGE("%{public}s: Encoder is null.", DSCREEN_LOG_TAG); return; } encoderBufferInfo_ = info; if (buffer == nullptr) { - DHLOGE("%s: Buffer is null, index = %d", LOG_TAG, index); + DHLOGE("%{public}s: Buffer is null, index = %{public}d", DSCREEN_LOG_TAG, index); return; } size_t dataSize = static_cast(info.size); if (dataSize == 0 || dataSize > DATA_BUFFER_MAX_SIZE) { - DHLOGE("%s:OnOutputBufferAvailable params invalid, size: %" PRId32, LOG_TAG, dataSize); + DHLOGE("%{public}s:OnOutputBufferAvailable params invalid, size: %{public}zu", DSCREEN_LOG_TAG, dataSize); return; } auto dataBuf = std::make_shared(dataSize); int32_t ret = memcpy_s(dataBuf->Data(), dataBuf->Capacity(), buffer->GetBase(), dataSize); if (ret != EOK) { - DHLOGE("%s: Copy data failed.", LOG_TAG); + DHLOGE("%{public}s: Copy data failed.", DSCREEN_LOG_TAG); return; } dataBuf->SetDataType(VIDEO_FULL_SCREEN_DATA); @@ -430,7 +432,7 @@ void ImageSourceEncoder::OnOutputBufferAvailable(uint32_t index, MediaAVCodec::A listener->OnImageProcessDone(dataBuf); ret = videoEncoder_->ReleaseOutputBuffer(index); if (ret != MediaAVCodec::AVCS_ERR_OK) { - DHLOGE("%s: videoEncoder ReleaseOutputBuffer failed.", LOG_TAG); + DHLOGE("%{public}s: videoEncoder ReleaseOutputBuffer failed.", DSCREEN_LOG_TAG); } } diff --git a/services/screentransport/screensourceprocessor/include/image_source_processor.h b/services/screentransport/screensourceprocessor/include/image_source_processor.h index 9a908537c66c78d1d21c089e2c1579884d4c75c3..a41b5622ba56165db3826bd1fac53731e9783896 100644 --- a/services/screentransport/screensourceprocessor/include/image_source_processor.h +++ b/services/screentransport/screensourceprocessor/include/image_source_processor.h @@ -38,7 +38,7 @@ public: int32_t ProcessFullImage(sptr &surfaceBuffer) override; private: - static const constexpr char *LOG_TAG = "ImageSourceProcessor"; + static const constexpr char *DSCREEN_LOG_TAG = "ImageSourceProcessor"; VideoParam localParam_; VideoParam remoteParam_; std::shared_ptr imageEncoder_ = nullptr; diff --git a/services/screentransport/screensourceprocessor/src/image_source_processor.cpp b/services/screentransport/screensourceprocessor/src/image_source_processor.cpp index 34c4bfcf37b7da813cbcf60b77b6624451e2fc28..7ad1b765f53f0c61f36a0a78e43999cbe261c04f 100644 --- a/services/screentransport/screensourceprocessor/src/image_source_processor.cpp +++ b/services/screentransport/screensourceprocessor/src/image_source_processor.cpp @@ -25,11 +25,11 @@ namespace DistributedHardware { int32_t ImageSourceProcessor::ConfigureImageProcessor(const VideoParam &localParam, const VideoParam &remoteParam, const std::shared_ptr &listener) { - DHLOGI("%s: ConfigureImageProcessor.", LOG_TAG); + DHLOGI("%{public}s: ConfigureImageProcessor.", DSCREEN_LOG_TAG); imageEncoder_ = std::make_shared(listener); int32_t ret = imageEncoder_->ConfigureEncoder(localParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: Configure screen encoder failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Configure screen encoder failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } @@ -40,9 +40,9 @@ int32_t ImageSourceProcessor::ConfigureImageProcessor(const VideoParam &localPar int32_t ImageSourceProcessor::ReleaseImageProcessor() { - DHLOGI("%s: ReleaseImageProcessor.", LOG_TAG); + DHLOGI("%{public}s: ReleaseImageProcessor.", DSCREEN_LOG_TAG); if (imageEncoder_ == nullptr) { - DHLOGE("%s: Create screen encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Create screen encoder failed.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "ReleaseImageProcessor encoder is nullptr."); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -51,7 +51,7 @@ int32_t ImageSourceProcessor::ReleaseImageProcessor() int32_t ret = imageEncoder_->ReleaseEncoder(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGE("%s: Release screen encoder failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Release screen encoder failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "Release screen encoder failed."); return ret; } @@ -61,9 +61,9 @@ int32_t ImageSourceProcessor::ReleaseImageProcessor() int32_t ImageSourceProcessor::StartImageProcessor() { - DHLOGI("%s: StartImageProcessor.", LOG_TAG); + DHLOGI("%{public}s: StartImageProcessor.", DSCREEN_LOG_TAG); if (imageEncoder_ == nullptr) { - DHLOGE("%s: Create screen encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Create screen encoder failed.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "StartImageProcessor encoder is nullptr."); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -72,7 +72,7 @@ int32_t ImageSourceProcessor::StartImageProcessor() int32_t ret = imageEncoder_->StartEncoder(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGE("%s: Start screen encoder failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Start screen encoder failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "Start screen encoder failed."); return ret; } @@ -82,9 +82,9 @@ int32_t ImageSourceProcessor::StartImageProcessor() int32_t ImageSourceProcessor::StopImageProcessor() { - DHLOGI("%s: StopImageProcessor.", LOG_TAG); + DHLOGI("%{public}s: StopImageProcessor.", DSCREEN_LOG_TAG); if (imageEncoder_ == nullptr) { - DHLOGE("%s: Create screen encoder failed.", LOG_TAG); + DHLOGE("%{public}s: Create screen encoder failed.", DSCREEN_LOG_TAG); ReportOptFail(DSCREEN_OPT_FAIL, ERR_DH_SCREEN_TRANS_NULL_VALUE, "StopImageProcessor encoder is nullptr."); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } @@ -93,7 +93,7 @@ int32_t ImageSourceProcessor::StopImageProcessor() int32_t ret = imageEncoder_->StopEncoder(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGE("%s: Stop screen encoder failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Stop screen encoder failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "Stop screen encoder failed."); return ret; } @@ -103,26 +103,26 @@ int32_t ImageSourceProcessor::StopImageProcessor() sptr ImageSourceProcessor::GetImageSurface() { - DHLOGI("%s: GetImageSurface.", LOG_TAG); + DHLOGI("%{public}s: GetImageSurface.", DSCREEN_LOG_TAG); return imageEncoder_->GetInputSurface(); } sptr ImageSourceProcessor::GetConsumerSurface() { - DHLOGI("%s: GetConsumerSurface.", LOG_TAG); + DHLOGI("%{public}s: GetConsumerSurface.", DSCREEN_LOG_TAG); return imageEncoder_->GetConsumerSurface(); } int32_t ImageSourceProcessor::ProcessFullImage(sptr &surfaceBuffer) { - DHLOGI("%s: ProcessFullImage.", LOG_TAG); + DHLOGI("%{public}s: ProcessFullImage.", DSCREEN_LOG_TAG); if (surfaceBuffer == nullptr) { - DHLOGE("%s: Process surfaceBuffer is null.", LOG_TAG); + DHLOGE("%{public}s: Process surfaceBuffer is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_SURFACE_BUFFER_INVALIED; } int32_t ret = imageEncoder_->FeedEncoderData(surfaceBuffer); if (ret != DH_SUCCESS) { - DHLOGE("%s: FeedEncoderData failed.", LOG_TAG); + DHLOGE("%{public}s: FeedEncoderData failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ERROR; } return DH_SUCCESS; diff --git a/services/screentransport/screensourcetrans/include/screen_source_trans.h b/services/screentransport/screensourcetrans/include/screen_source_trans.h index c0b8c0ec27de288c9596de09752976073b1aab2d..5b128fe76f96bd7375f993f29d9ae409b0eb5f51 100644 --- a/services/screentransport/screensourcetrans/include/screen_source_trans.h +++ b/services/screentransport/screensourcetrans/include/screen_source_trans.h @@ -64,7 +64,7 @@ private: void FeedChannelData(); private: - static const constexpr char *LOG_TAG = "ScreenSourceTrans"; + static const constexpr char *DSCREEN_LOG_TAG = "ScreenSourceTrans"; std::mutex sessionMtx_; std::mutex dataMtx_; diff --git a/services/screentransport/screensourcetrans/src/screen_source_trans.cpp b/services/screentransport/screensourcetrans/src/screen_source_trans.cpp index 15fd09450cca371277b2361aeb42bf9200920521..566d78527b77caa43d5304f15d2d4270a0eded58 100644 --- a/services/screentransport/screensourcetrans/src/screen_source_trans.cpp +++ b/services/screentransport/screensourcetrans/src/screen_source_trans.cpp @@ -33,15 +33,15 @@ constexpr const char* FDATA_THREAD = "FeedDataThread"; int32_t ScreenSourceTrans::SetUp(const VideoParam &localParam, const VideoParam &remoteParam, const std::string &peerDevId) { - DHLOGI("%s: SetUp.", LOG_TAG); + DHLOGI("%{public}s: SetUp.", DSCREEN_LOG_TAG); int32_t ret = CheckTransParam(localParam, remoteParam, peerDevId); if (ret != DH_SUCCESS) { - DHLOGE("%s: SetUp failed param error ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: SetUp failed param error ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } ret = InitScreenTrans(localParam, remoteParam, peerDevId); if (ret != DH_SUCCESS) { - DHLOGE("%s: SetUp failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: SetUp failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } ret = SetConsumerSurface(); @@ -54,16 +54,16 @@ int32_t ScreenSourceTrans::SetUp(const VideoParam &localParam, const VideoParam DHLOGE("screenDecisionCenter set jpeg surface failed."); return ret; } - DHLOGI("%s: SetUp success.", LOG_TAG); + DHLOGI("%{public}s: SetUp success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenSourceTrans::SetConsumerSurface() { - DHLOGI("%s: SetConsumerSurface.", LOG_TAG); + DHLOGI("%{public}s: SetConsumerSurface.", DSCREEN_LOG_TAG); consumerSurface_ = imageProcessor_->GetConsumerSurface(); if (consumerSurface_ == nullptr) { - DHLOGE("%s: consumerSurface is nullptr", LOG_TAG); + DHLOGE("%{public}s: consumerSurface is nullptr", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_SURFACE_INVALIED; } return DH_SUCCESS; @@ -71,15 +71,15 @@ int32_t ScreenSourceTrans::SetConsumerSurface() int32_t ScreenSourceTrans::Release() { - DHLOGI("%s: Release.", LOG_TAG); + DHLOGI("%{public}s: Release.", DSCREEN_LOG_TAG); if (imageProcessor_ == nullptr || screenChannel_ == nullptr) { - DHLOGE("%s: Processor or channel is null, Setup first.", LOG_TAG); + DHLOGE("%{public}s: Processor or channel is null, Setup first.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = imageProcessor_->ReleaseImageProcessor(); if (ret != DH_SUCCESS) { - DHLOGD("%s: Release image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGD("%{public}s: Release image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } imageProcessor_ = nullptr; @@ -87,7 +87,7 @@ int32_t ScreenSourceTrans::Release() ret = screenChannel_->ReleaseSession(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGD("%s: Release channel session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGD("%{public}s: Release channel session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } screenChannel_ = nullptr; @@ -96,78 +96,79 @@ int32_t ScreenSourceTrans::Release() dataQueue_.pop(); } - DHLOGI("%s: Release success.", LOG_TAG); + DHLOGI("%{public}s: Release success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenSourceTrans::Start() { - DHLOGI("%s: Start.", LOG_TAG); + DHLOGI("%{public}s: Start.", DSCREEN_LOG_TAG); if (screenChannel_ == nullptr) { - DHLOGE("%s: channel is null, Setup first.", LOG_TAG); + DHLOGE("%{public}s: channel is null, Setup first.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } StartTrace(DSCREEN_HITRACE_LABEL, DSCREEN_SOURCE_OPEN_SESSION_START); std::shared_ptr listener = shared_from_this(); if (listener == nullptr) { - DHLOGE("%s: Channel listener is null", LOG_TAG); + DHLOGE("%{public}s: Channel listener is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } if (screenChannel_ == nullptr) { - DHLOGE("%s: Channel is null", LOG_TAG); + DHLOGE("%{public}s: Channel is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = screenChannel_->OpenSession(listener); if (ret != DH_SUCCESS) { - DHLOGE("%s: Open channel session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Open channel session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } - DHLOGI("%s: Wait for channel session opened.", LOG_TAG); + DHLOGI("%{public}s: Wait for channel session opened.", DSCREEN_LOG_TAG); std::unique_lock lck(sessionMtx_); auto status = sessionCond_.wait_for(lck, std::chrono::seconds(SESSION_WAIT_SECONDS), [this]() { return isChannelReady_; }); if (!status) { - DHLOGE("%s: Open channel session timeout(%" PRId32"s).", LOG_TAG, SESSION_WAIT_SECONDS); + DHLOGE("%{public}s: Open channel session timeout(%{public}" PRId32 "s).", DSCREEN_LOG_TAG, + SESSION_WAIT_SECONDS); return ERR_DH_SCREEN_TRANS_TIMEOUT; } - DHLOGI("%s: Source start enable low latency.", LOG_TAG); + DHLOGI("%{public}s: Source start enable low latency.", DSCREEN_LOG_TAG); std::shared_ptr dhFwkKit = DScreenFwkKit::GetInstance().GetDHFwkKit(); if (dhFwkKit != nullptr) { ret = dhFwkKit->PublishMessage(DHTopic::TOPIC_LOW_LATENCY, ENABLE_LOW_LATENCY.dump()); if (ret != DH_FWK_SUCCESS) { - DHLOGE("%s: Source start enable low latency failed ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Source start enable low latency failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } } - DHLOGI("%s: Start success.", LOG_TAG); + DHLOGI("%{public}s: Start success.", DSCREEN_LOG_TAG); FinishTrace(DSCREEN_HITRACE_LABEL); return DH_SUCCESS; } int32_t ScreenSourceTrans::Stop() { - DHLOGI("%s: Stop.", LOG_TAG); + DHLOGI("%{public}s: Stop.", DSCREEN_LOG_TAG); if (imageProcessor_ == nullptr || screenChannel_ == nullptr) { - DHLOGE("%s: Processor or channel is null, Setup first.", LOG_TAG); + DHLOGE("%{public}s: Processor or channel is null, Setup first.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } bool stopStatus = true; int32_t ret = imageProcessor_->StopImageProcessor(); if (ret != DH_SUCCESS) { - DHLOGD("%s: Stop image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGD("%{public}s: Stop image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); stopStatus = false; } - DHLOGI("%s: Source stop enable low latency.", LOG_TAG); + DHLOGI("%{public}s: Source stop enable low latency.", DSCREEN_LOG_TAG); std::shared_ptr dhFwkKit = DScreenFwkKit::GetInstance().GetDHFwkKit(); if (dhFwkKit != nullptr) { ret = dhFwkKit->PublishMessage(DHTopic::TOPIC_LOW_LATENCY, DISABLE_LOW_LATENCY.dump()); if (ret != DH_FWK_SUCCESS) { - DHLOGE("%s: Source stop enable low latency failed ret: %." PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Source stop enable low latency failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); } } @@ -176,23 +177,23 @@ int32_t ScreenSourceTrans::Stop() ret = screenChannel_->CloseSession(); FinishTrace(DSCREEN_HITRACE_LABEL); if (ret != DH_SUCCESS) { - DHLOGD("%s: Close Session failed ret: %" PRId32, LOG_TAG, ret); + DHLOGD("%{public}s: Close Session failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); stopStatus = false; } if (!stopStatus) { - DHLOGE("%s: Stop source trans failed.", LOG_TAG); + DHLOGE("%{public}s: Stop source trans failed.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ERROR; } - DHLOGI("%s: Stop success.", LOG_TAG); + DHLOGI("%{public}s: Stop success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenSourceTrans::RegisterStateCallback(const std::shared_ptr &callback) { - DHLOGI("%s:RegisterStateCallback.", LOG_TAG); + DHLOGI("%{public}s:RegisterStateCallback.", DSCREEN_LOG_TAG); if (callback == nullptr) { - DHLOGE("%s: Trans callback is null.", LOG_TAG); + DHLOGE("%{public}s: Trans callback is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } transCallback_ = callback; @@ -202,7 +203,7 @@ int32_t ScreenSourceTrans::RegisterStateCallback(const std::shared_ptr ScreenSourceTrans::GetImageSurface() { - DHLOGI("%s:GetImageSurface.", LOG_TAG); + DHLOGI("%{public}s:GetImageSurface.", DSCREEN_LOG_TAG); return imageProcessor_->GetImageSurface(); } @@ -216,7 +217,7 @@ int32_t ScreenSourceTrans::CheckVideoParam(const VideoParam ¶m) if ((param.GetCodecType() != VIDEO_CODEC_TYPE_VIDEO_H264) && (param.GetCodecType() != VIDEO_CODEC_TYPE_VIDEO_H265) && (param.GetCodecType() != VIDEO_CODEC_TYPE_VIDEO_MPEG4)) { - DHLOGE("%s: Invalid codec type.", LOG_TAG); + DHLOGE("%{public}s: Invalid codec type.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } @@ -224,19 +225,19 @@ int32_t ScreenSourceTrans::CheckVideoParam(const VideoParam ¶m) (param.GetVideoFormat() != VIDEO_DATA_FORMAT_NV12) && (param.GetVideoFormat() != VIDEO_DATA_FORMAT_NV21) && (param.GetVideoFormat() != VIDEO_DATA_FORMAT_RGBA8888)) { - DHLOGE("%s: Invalid video data format.", LOG_TAG); + DHLOGE("%{public}s: Invalid video data format.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } if ((param.GetVideoWidth() > DSCREEN_MAX_VIDEO_DATA_WIDTH) || (param.GetVideoHeight() > DSCREEN_MAX_VIDEO_DATA_HEIGHT)) { - DHLOGE("%s: Invalid video data size.", LOG_TAG); + DHLOGE("%{public}s: Invalid video data size.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } if ((param.GetScreenWidth() > DSCREEN_MAX_SCREEN_DATA_WIDTH) || (param.GetScreenHeight() > DSCREEN_MAX_SCREEN_DATA_HEIGHT)) { - DHLOGE("%s: Invalid screen data size.", LOG_TAG); + DHLOGE("%{public}s: Invalid screen data size.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ILLEGAL_PARAM; } @@ -246,21 +247,21 @@ int32_t ScreenSourceTrans::CheckVideoParam(const VideoParam ¶m) int32_t ScreenSourceTrans::CheckTransParam(const VideoParam &localParam, const VideoParam &remoteParam, const std::string &peerDevId) { - DHLOGI("%s:CheckTransParam.", LOG_TAG); + DHLOGI("%{public}s:CheckTransParam.", DSCREEN_LOG_TAG); if (peerDevId.empty()) { - DHLOGE("%s: Remote device id is null.", LOG_TAG); + DHLOGE("%{public}s: Remote device id is null.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = CheckVideoParam(localParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: check localParam param failed.", LOG_TAG); + DHLOGE("%{public}s: check localParam param failed.", DSCREEN_LOG_TAG); return ret; } ret = CheckVideoParam(remoteParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: check remoteParam param failed.", LOG_TAG); + DHLOGE("%{public}s: check remoteParam param failed.", DSCREEN_LOG_TAG); return ret; } return DH_SUCCESS; @@ -269,14 +270,14 @@ int32_t ScreenSourceTrans::CheckTransParam(const VideoParam &localParam, const V int32_t ScreenSourceTrans::InitScreenTrans(const VideoParam &localParam, const VideoParam &remoteParam, const std::string &peerDevId) { - DHLOGI("%s:InitScreenTrans.", LOG_TAG); + DHLOGI("%{public}s:InitScreenTrans.", DSCREEN_LOG_TAG); screenChannel_ = std::make_shared(peerDevId); if (std::atoi(version_.c_str()) > DSCREEN_MIN_VERSION) { screenChannel_->SetJpegSessionFlag(true); } int32_t ret = RegisterChannelListener(); if (ret != DH_SUCCESS) { - DHLOGE("%s: Register channel listener failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Register channel listener failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); screenChannel_ = nullptr; return ret; } @@ -284,7 +285,7 @@ int32_t ScreenSourceTrans::InitScreenTrans(const VideoParam &localParam, const V imageProcessor_ = std::make_shared(); ret = RegisterProcessorListener(localParam, remoteParam); if (ret != DH_SUCCESS) { - DHLOGE("%s: Register data processor listener failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Register data processor listener failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); screenChannel_ = nullptr; imageProcessor_ = nullptr; return ret; @@ -295,32 +296,32 @@ int32_t ScreenSourceTrans::InitScreenTrans(const VideoParam &localParam, const V int32_t ScreenSourceTrans::RegisterChannelListener() { - DHLOGI("%s: RegisterChannelListener.", LOG_TAG); + DHLOGI("%{public}s: RegisterChannelListener.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t ScreenSourceTrans::RegisterProcessorListener(const VideoParam &localParam, const VideoParam &remoteParam) { - DHLOGI("%s: RegisterProcessorListener.", LOG_TAG); + DHLOGI("%{public}s: RegisterProcessorListener.", DSCREEN_LOG_TAG); std::shared_ptr listener = shared_from_this(); if (listener == nullptr) { - DHLOGE("%s: Processor listener is null", LOG_TAG); + DHLOGE("%{public}s: Processor listener is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_ERROR; } if (imageProcessor_ == nullptr) { - DHLOGE("%s: imageProcessor is null", LOG_TAG); + DHLOGE("%{public}s: imageProcessor is null", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_TRANS_NULL_VALUE; } int32_t ret = imageProcessor_->ConfigureImageProcessor(localParam, remoteParam, listener); if (ret != DH_SUCCESS) { - DHLOGE("%s: Config image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Config image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); ReportOptFail(DSCREEN_OPT_FAIL, ret, "Config image processor failed."); return ret; } ret = screenDecisionCenter_->ConfigureDecisionCenter(listener, imageProcessor_); if (ret != DH_SUCCESS) { - DHLOGE("%s: Config decision center failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Config decision center failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return ret; } return DH_SUCCESS; @@ -328,19 +329,19 @@ int32_t ScreenSourceTrans::RegisterProcessorListener(const VideoParam &localPara void ScreenSourceTrans::OnSessionOpened() { - DHLOGI("%s: OnChannelSessionOpened.", LOG_TAG); + DHLOGI("%{public}s: OnChannelSessionOpened.", DSCREEN_LOG_TAG); if (imageProcessor_ == nullptr) { - DHLOGE("%s: imageProcessor is null", LOG_TAG); + DHLOGE("%{public}s: imageProcessor is null", DSCREEN_LOG_TAG); return; } int32_t ret = imageProcessor_->StartImageProcessor(); if (ret != DH_SUCCESS) { - DHLOGE("%s: Start image processor failed ret: %" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: Start image processor failed ret: %{public}" PRId32, DSCREEN_LOG_TAG, ret); return; } isChannelReady_ = true; - DHLOGI("%s: Start thread.", LOG_TAG); + DHLOGI("%{public}s: Start thread.", DSCREEN_LOG_TAG); std::thread(&ScreenSourceTrans::FeedChannelData, this).detach(); std::unique_lock lck(sessionMtx_); sessionCond_.notify_all(); @@ -348,12 +349,12 @@ void ScreenSourceTrans::OnSessionOpened() void ScreenSourceTrans::OnSessionClosed() { - DHLOGI("%s: OnChannelSessionClosed.", LOG_TAG); + DHLOGI("%{public}s: OnChannelSessionClosed.", DSCREEN_LOG_TAG); isChannelReady_ = false; std::shared_ptr callback = transCallback_.lock(); if (callback == nullptr) { - DHLOGE("%s: Trans callback is null.", LOG_TAG); + DHLOGE("%{public}s: Trans callback is null.", DSCREEN_LOG_TAG); return; } callback->OnError(ERR_DH_SCREEN_TRANS_SESSION_CLOSED, "OnChannelSessionClosed"); @@ -362,31 +363,31 @@ void ScreenSourceTrans::OnSessionClosed() void ScreenSourceTrans::OnDataReceived(const std::shared_ptr &data) { (void) data; - DHLOGI("%s: OnChannelDataReceived source trans not support.", LOG_TAG); + DHLOGI("%{public}s: OnChannelDataReceived source trans not support.", DSCREEN_LOG_TAG); } void ScreenSourceTrans::OnDamageProcessDone(sptr &surfaceBuffer, const std::vector &damages) { - DHLOGI("%s: OnDamageProcessDone.", LOG_TAG); + DHLOGI("%{public}s: OnDamageProcessDone.", DSCREEN_LOG_TAG); if (surfaceBuffer == nullptr) { - DHLOGE("%s: Trans surfaceBuffer is null.", LOG_TAG); + DHLOGE("%{public}s: Trans surfaceBuffer is null.", DSCREEN_LOG_TAG); return; } if (std::atoi(version_.c_str()) == DSCREEN_MIN_VERSION) { - DHLOGI("%s: not support partial refresh, run full full image process.", LOG_TAG); + DHLOGI("%{public}s: not support partial refresh, run full full image process.", DSCREEN_LOG_TAG); imageProcessor_->ProcessFullImage(surfaceBuffer); } else { - DHLOGI("%s: run partial refresh image process.", LOG_TAG); + DHLOGI("%{public}s: run partial refresh image process.", DSCREEN_LOG_TAG); screenDecisionCenter_->InputBufferImage(surfaceBuffer, damages); } } void ScreenSourceTrans::OnImageProcessDone(const std::shared_ptr &data) { - DHLOGD("%s: OnImageProcessDone.", LOG_TAG); + DHLOGD("%{public}s: OnImageProcessDone.", DSCREEN_LOG_TAG); std::lock_guard lck(dataQueueMtx_); while (dataQueue_.size() >= DATA_QUEUE_MAX_SIZE) { - DHLOGE("%s: Data queue overflow.", LOG_TAG); + DHLOGE("%{public}s: Data queue overflow.", DSCREEN_LOG_TAG); dataQueue_.pop(); } dataQueue_.push(data); @@ -395,10 +396,10 @@ void ScreenSourceTrans::OnImageProcessDone(const std::shared_ptr &da void ScreenSourceTrans::OnProcessorStateNotify(int32_t state) { - DHLOGI("%s:OnProcessorStateNotify.", LOG_TAG); + DHLOGI("%{public}s:OnProcessorStateNotify.", DSCREEN_LOG_TAG); std::shared_ptr callback = transCallback_.lock(); if (callback == nullptr) { - DHLOGE("%s: Trans callback is null.", LOG_TAG); + DHLOGE("%{public}s: Trans callback is null.", DSCREEN_LOG_TAG); return; } callback->OnError(state, "OnProcessorStateNotify"); @@ -408,7 +409,7 @@ void ScreenSourceTrans::FeedChannelData() { int32_t ret = pthread_setname_np(pthread_self(), FDATA_THREAD); if (ret != DH_SUCCESS) { - DHLOGE("ScreenSourceTrans set thread name failed, ret %" PRId32, ret); + DHLOGE("ScreenSourceTrans set thread name failed, ret %{public}" PRId32, ret); } while (isChannelReady_) { std::shared_ptr screenData; @@ -416,7 +417,7 @@ void ScreenSourceTrans::FeedChannelData() std::unique_lock lock(dataQueueMtx_); dataCond_.wait_for(lock, std::chrono::seconds(DATA_WAIT_SECONDS), [this]() { return !dataQueue_.empty(); }); if (dataQueue_.empty()) { - DHLOGD("%s:Data queue is empty.", LOG_TAG); + DHLOGD("%{public}s:Data queue is empty.", DSCREEN_LOG_TAG); continue; } screenData = dataQueue_.front(); @@ -424,18 +425,18 @@ void ScreenSourceTrans::FeedChannelData() } if (screenChannel_ == nullptr) { - DHLOGE("%s: Channel is null", LOG_TAG); + DHLOGE("%{public}s: Channel is null", DSCREEN_LOG_TAG); return; } if (screenData == nullptr) { - DHLOGE("%s: Screen data is null", LOG_TAG); + DHLOGE("%{public}s: Screen data is null", DSCREEN_LOG_TAG); continue; } - DHLOGD("%s: FeedChannelData.", LOG_TAG); + DHLOGD("%{public}s: FeedChannelData.", DSCREEN_LOG_TAG); ret = screenChannel_->SendData(screenData); if (ret != DH_SUCCESS) { - DHLOGD("%s:Send data failed.", LOG_TAG); + DHLOGD("%{public}s:Send data failed.", DSCREEN_LOG_TAG); } } } diff --git a/services/screentransport/test/fuzztest/screensinkprocessor/onbufferavailable_fuzzer/BUILD.gn b/services/screentransport/test/fuzztest/screensinkprocessor/onbufferavailable_fuzzer/BUILD.gn index 0bc65fd7c7c88646ce5c52af80597db9887c88ad..b534a8db7f0220cecfcef94f9b81fc4524897db6 100644 --- a/services/screentransport/test/fuzztest/screensinkprocessor/onbufferavailable_fuzzer/BUILD.gn +++ b/services/screentransport/test/fuzztest/screensinkprocessor/onbufferavailable_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("OnBufferAvailableFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "graphic_surface:surface", "graphic_surface:sync_fence", + "hilog:libhilog", "ipc:ipc_core", "media_foundation:media_foundation", ] diff --git a/services/screentransport/test/fuzztest/screensourceprocessor/onbufferavailable_fuzzer/BUILD.gn b/services/screentransport/test/fuzztest/screensourceprocessor/onbufferavailable_fuzzer/BUILD.gn index 144edd00e144f02fc6b09368851c7ac38ae5b385..50a341f4f3d2d9710c767e97375f328a315c0db1 100644 --- a/services/screentransport/test/fuzztest/screensourceprocessor/onbufferavailable_fuzzer/BUILD.gn +++ b/services/screentransport/test/fuzztest/screensourceprocessor/onbufferavailable_fuzzer/BUILD.gn @@ -66,6 +66,7 @@ ohos_fuzztest("OnBufferAvailableFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "graphic_surface:surface", "graphic_surface:sync_fence", + "hilog:libhilog", "ipc:ipc_core", "media_foundation:media_foundation", ] diff --git a/services/screentransport/test/fuzztest/screensourceprocessor/onerror_fuzzer/BUILD.gn b/services/screentransport/test/fuzztest/screensourceprocessor/onerror_fuzzer/BUILD.gn index de41f68bbfe5521211cc545da179b23adfc52c29..b08e2d4e36291bea89d5753ac3abb61cfc767d5a 100644 --- a/services/screentransport/test/fuzztest/screensourceprocessor/onerror_fuzzer/BUILD.gn +++ b/services/screentransport/test/fuzztest/screensourceprocessor/onerror_fuzzer/BUILD.gn @@ -58,6 +58,7 @@ ohos_fuzztest("OnErrorFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "graphic_surface:surface", "graphic_surface:sync_fence", + "hilog:libhilog", "ipc:ipc_core", "media_foundation:media_foundation", ] diff --git a/services/screentransport/test/fuzztest/screensourceprocessor/oninputbufferavailable_fuzzer/BUILD.gn b/services/screentransport/test/fuzztest/screensourceprocessor/oninputbufferavailable_fuzzer/BUILD.gn index 8489032f0fd31c53cbfc66132113302344571ce6..f2766772abb30b22e1d9aec34b4fac1f2b9c96d5 100644 --- a/services/screentransport/test/fuzztest/screensourceprocessor/oninputbufferavailable_fuzzer/BUILD.gn +++ b/services/screentransport/test/fuzztest/screensourceprocessor/oninputbufferavailable_fuzzer/BUILD.gn @@ -58,6 +58,7 @@ ohos_fuzztest("OnInputBufferAvailableFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "graphic_surface:surface", "graphic_surface:sync_fence", + "hilog:libhilog", "ipc:ipc_core", "media_foundation:media_foundation", ] diff --git a/services/screentransport/test/fuzztest/screensourceprocessor/onoutputbufferavailable_fuzzer/BUILD.gn b/services/screentransport/test/fuzztest/screensourceprocessor/onoutputbufferavailable_fuzzer/BUILD.gn index 21d998c44b9be2d0f674a73475abfc83d3027c4a..62f428be87ceee903b9ef176464e8b3f3636769c 100644 --- a/services/screentransport/test/fuzztest/screensourceprocessor/onoutputbufferavailable_fuzzer/BUILD.gn +++ b/services/screentransport/test/fuzztest/screensourceprocessor/onoutputbufferavailable_fuzzer/BUILD.gn @@ -59,6 +59,7 @@ ohos_fuzztest("OnOutputBufferAvailableFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "graphic_surface:surface", "graphic_surface:sync_fence", + "hilog:libhilog", "ipc:ipc_core", "media_foundation:media_foundation", ] diff --git a/services/screentransport/test/fuzztest/screensourceprocessor/onoutputformatchanged_fuzzer/BUILD.gn b/services/screentransport/test/fuzztest/screensourceprocessor/onoutputformatchanged_fuzzer/BUILD.gn index 68bb613452569c617cb2827bb06e359b56712971..bba659612b57cb7d0bc760883cc8df8ee145154d 100644 --- a/services/screentransport/test/fuzztest/screensourceprocessor/onoutputformatchanged_fuzzer/BUILD.gn +++ b/services/screentransport/test/fuzztest/screensourceprocessor/onoutputformatchanged_fuzzer/BUILD.gn @@ -58,6 +58,7 @@ ohos_fuzztest("OnOutputFormatChangedFuzzTest") { "distributed_hardware_fwk:libdhfwk_sdk", "graphic_surface:surface", "graphic_surface:sync_fence", + "hilog:libhilog", "ipc:ipc_core", "media_foundation:media_foundation", ] diff --git a/services/screentransport/test/unittest/screendatachannel/BUILD.gn b/services/screentransport/test/unittest/screendatachannel/BUILD.gn index 7b7f8307769e61ec897c89ebe9fa0d687b843504..6f1c9c3ae84637fea8d9d9557d46b88d756d0220 100644 --- a/services/screentransport/test/unittest/screendatachannel/BUILD.gn +++ b/services/screentransport/test/unittest/screendatachannel/BUILD.gn @@ -63,6 +63,7 @@ ohos_unittest("DataChannelTest") { "access_token:libtoken_setproc", "c_utils:utils", "dsoftbus:softbus_client", + "hilog:libhilog", ] defines = [ diff --git a/services/screentransport/test/unittest/screensinkprocessor/BUILD.gn b/services/screentransport/test/unittest/screensinkprocessor/BUILD.gn index a096cc98db06a8bad97f4102bc93e785e154c33d..e59428b7d54be56e50d2451f647bdfe5d61f161c 100644 --- a/services/screentransport/test/unittest/screensinkprocessor/BUILD.gn +++ b/services/screentransport/test/unittest/screensinkprocessor/BUILD.gn @@ -67,6 +67,7 @@ ohos_unittest("SinkProcessorTest") { "av_codec:av_codec_client", "c_utils:utils", "graphic_surface:surface", + "hilog:libhilog", "media_foundation:media_foundation", ] diff --git a/services/screentransport/test/unittest/screensinktrans/BUILD.gn b/services/screentransport/test/unittest/screensinktrans/BUILD.gn index 74e638fc7b69540f97266802ca74ed0f85dec207..8ca83c994b51fa1b74a34907b0aee7fc4bb33b2c 100644 --- a/services/screentransport/test/unittest/screensinktrans/BUILD.gn +++ b/services/screentransport/test/unittest/screensinktrans/BUILD.gn @@ -65,6 +65,7 @@ ohos_unittest("SinkTransTest") { "c_utils:utils", "dsoftbus:softbus_client", "graphic_surface:surface", + "hilog:libhilog", "media_foundation:media_foundation", ] diff --git a/services/softbusadapter/include/softbus_adapter.h b/services/softbusadapter/include/softbus_adapter.h index 1b2845dfcd1faae17df48e75e706aa93f92a60e0..65a666506f4eecaae08b3f4d90eaf7cac13c555e 100644 --- a/services/softbusadapter/include/softbus_adapter.h +++ b/services/softbusadapter/include/softbus_adapter.h @@ -66,7 +66,7 @@ private: std::shared_ptr &GetSoftbusListenerById(int32_t sessionId); private: - static const constexpr char *LOG_TAG = "SoftbusAdapter"; + static const constexpr char *DSCREEN_LOG_TAG = "SoftbusAdapter"; std::mutex listenerMtx_; std::mutex idMapMutex_; std::mutex serverIdMapMutex_; diff --git a/services/softbusadapter/src/softbus_adapter.cpp b/services/softbusadapter/src/softbus_adapter.cpp index 624298b2d44d3be4044d252b11f934b4c2885960..c05009e80351650bdd7e136bde52add6461b4ebe 100644 --- a/services/softbusadapter/src/softbus_adapter.cpp +++ b/services/softbusadapter/src/softbus_adapter.cpp @@ -73,14 +73,15 @@ int32_t SoftbusAdapter::RegisterSoftbusListener(const std::shared_ptr lisLock(listenerMtx_); if (mapListeners_.find(strListenerKey) != mapListeners_.end()) { - DHLOGE("%s: Session listener already register.", LOG_TAG); + DHLOGE("%{public}s: Session listener already register.", DSCREEN_LOG_TAG); return ERR_DH_SCREEN_ADAPTER_REGISTER_SOFTBUS_LISTENER_FAIL; } mapListeners_.insert(std::make_pair(strListenerKey, listener)); @@ -90,7 +91,8 @@ int32_t SoftbusAdapter::RegisterSoftbusListener(const std::shared_ptr lisLock(listenerMtx_); @@ -102,13 +104,14 @@ int32_t SoftbusAdapter::UnRegisterSoftbusListener(const std::string &sessionName int32_t SoftbusAdapter::CreateSoftbusSessionServer(const std::string &pkgname, const std::string &sessionName, const std::string &peerDevId) { - DHLOGI("%s: CreateSessionServer sess:%s id:%s.", LOG_TAG, sessionName.c_str(), GetAnonyString(peerDevId).c_str()); + DHLOGI("%{public}s: CreateSessionServer sess:%{public}s id:%{public}s.", DSCREEN_LOG_TAG, sessionName.c_str(), + GetAnonyString(peerDevId).c_str()); { std::lock_guard lock(serverIdMapMutex_); std::string idMapValue = sessionName + "_" + peerDevId; for (auto it = serverIdMap_.begin(); it != serverIdMap_.end(); it++) { if (((it->second).find(idMapValue) != std::string::npos)) { - DHLOGI("%s: Session already create.", sessionName.c_str()); + DHLOGI("%{public}s: Session already create.", sessionName.c_str()); return DH_SUCCESS; } } @@ -121,7 +124,7 @@ int32_t SoftbusAdapter::CreateSoftbusSessionServer(const std::string &pkgname, c }; int32_t socketId = Socket(serverInfo); if (socketId < 0) { - DHLOGE("Create Socket fail socketId:%" PRId32, socketId); + DHLOGE("Create Socket fail socketId:%{public}" PRId32, socketId); return ERR_DH_SCREEN_ADAPTER_BAD_VALUE; } QosTV qos[] = { @@ -132,14 +135,14 @@ int32_t SoftbusAdapter::CreateSoftbusSessionServer(const std::string &pkgname, c int32_t ret = Listen(socketId, qos, sizeof(qos) / sizeof(qos[0]), &sessListener_); if (ret != DH_SUCCESS) { - DHLOGE("Listen socket error for sessionName:%s", sessionName.c_str()); + DHLOGE("Listen socket error for sessionName:%{public}s", sessionName.c_str()); return ERR_DH_SCREEN_ADAPTER_BAD_VALUE; } { std::lock_guard lock(serverIdMapMutex_); serverIdMap_.insert(std::make_pair(socketId, sessionName + "_" + peerDevId)); } - DHLOGI("%s: CreateSessionServer success sessionId. %." PRId32, LOG_TAG, socketId); + DHLOGI("%{public}s: CreateSessionServer success sessionId. %{public}" PRId32, DSCREEN_LOG_TAG, socketId); return DH_SUCCESS; } @@ -150,7 +153,8 @@ int32_t SoftbusAdapter::RemoveSoftbusSessionServer(const std::string &pkgname, c if (sessionName.empty() || peerDevId.empty()) { return ERR_DH_SCREEN_TRANS_NULL_VALUE; } - DHLOGI("%s: RemoveSessionServer sess:%s id:%s", LOG_TAG, sessionName.c_str(), GetAnonyString(peerDevId).c_str()); + DHLOGI("%{public}s: RemoveSessionServer sess:%{public}s id:%{public}s", DSCREEN_LOG_TAG, sessionName.c_str(), + GetAnonyString(peerDevId).c_str()); int32_t serverSocketId = INVALID_SESSION_ID; { std::lock_guard lock(serverIdMapMutex_); @@ -165,15 +169,15 @@ int32_t SoftbusAdapter::RemoveSoftbusSessionServer(const std::string &pkgname, c } } Shutdown(serverSocketId); - DHLOGI("%s: RemoveSessionServer success.", LOG_TAG); + DHLOGI("%{public}s: RemoveSessionServer success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t SoftbusAdapter::OpenSoftbusSession(const std::string &mySessionName, const std::string &peerSessionName, const std::string &peerDevId) { - DHLOGI("%s: OpenSoftbusSession mysess:%s peersess:%s id:%s.", LOG_TAG, mySessionName.c_str(), - peerSessionName.c_str(), GetAnonyString(peerDevId).c_str()); + DHLOGI("%{public}s: OpenSoftbusSession mysess:%{public}s peersess:%{public}s id:%{public}s.", DSCREEN_LOG_TAG, + mySessionName.c_str(), peerSessionName.c_str(), GetAnonyString(peerDevId).c_str()); QosTV qos[] = { {.qos = QOS_TYPE_MIN_BW, .value = 40 * 1024 * 1024}, @@ -212,13 +216,13 @@ int32_t SoftbusAdapter::OpenSoftbusSession(const std::string &mySessionName, con if (ret != DH_SUCCESS) { return ret; } - DHLOGI("%s: OpenSoftbusSession success sessionId: %." PRId32, LOG_TAG, socketId); + DHLOGI("%{public}s: OpenSoftbusSession success sessionId: %{public}" PRId32, DSCREEN_LOG_TAG, socketId); return socketId; } int32_t SoftbusAdapter::CloseSoftbusSession(const int32_t sessionId) { - DHLOGI("%s: CloseSoftbusSession, sessid:%" PRId32, LOG_TAG, sessionId); + DHLOGI("%{public}s: CloseSoftbusSession, sessid:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); Shutdown(sessionId); { std::lock_guard lock(idMapMutex_); @@ -227,16 +231,16 @@ int32_t SoftbusAdapter::CloseSoftbusSession(const int32_t sessionId) std::lock_guard lisLock(listenerMtx_); mapSessListeners_.erase(sessionId); - DHLOGI("%s: CloseSoftbusSession success.", LOG_TAG); + DHLOGI("%{public}s: CloseSoftbusSession success.", DSCREEN_LOG_TAG); return DH_SUCCESS; } int32_t SoftbusAdapter::SendSoftbusBytes(int32_t sessionId, const void *data, int32_t dataLen) const { - DHLOGD("%s: SendSoftbusBytes, sessid:%" PRId32, LOG_TAG, sessionId); + DHLOGD("%{public}s: SendSoftbusBytes, sessid:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); int32_t ret = SendBytes(sessionId, data, dataLen); if (ret != DH_SUCCESS) { - DHLOGE("%s: SendBytes failed ret:%" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: SendBytes failed ret:%{public}" PRId32, DSCREEN_LOG_TAG, ret); return ERR_DH_SCREEN_TRANS_ERROR; } @@ -246,10 +250,10 @@ int32_t SoftbusAdapter::SendSoftbusBytes(int32_t sessionId, const void *data, in int32_t SoftbusAdapter::SendSoftbusStream(int32_t sessionId, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param) const { - DHLOGD("%s: SendSoftbusStream, sessid:%" PRId32, LOG_TAG, sessionId); + DHLOGD("%{public}s: SendSoftbusStream, sessid:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); int32_t ret = SendStream(sessionId, data, ext, param); if (ret != DH_SUCCESS) { - DHLOGE("%s: SendStream failed ret:%" PRId32, LOG_TAG, ret); + DHLOGE("%{public}s: SendStream failed ret:%{public}" PRId32, DSCREEN_LOG_TAG, ret); return ERR_DH_SCREEN_TRANS_ERROR; } @@ -258,7 +262,7 @@ int32_t SoftbusAdapter::SendSoftbusStream(int32_t sessionId, const StreamData *d std::shared_ptr &SoftbusAdapter::GetSoftbusListenerByName(int32_t sessionId) { - DHLOGD("%s: GetSoftbusListenerByName, sessionId:%" PRId32, LOG_TAG, sessionId); + DHLOGD("%{public}s: GetSoftbusListenerByName, sessionId:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); std::string strListenerKey = ""; { std::lock_guard lock(idMapMutex_); @@ -271,7 +275,7 @@ std::shared_ptr &SoftbusAdapter::GetSoftbusListenerByName(int3 } std::lock_guard lisLock(listenerMtx_); if (mapListeners_.find(strListenerKey) == mapListeners_.end()) { - DHLOGE("%s: Find listener failed.", LOG_TAG); + DHLOGE("%{public}s: Find listener failed.", DSCREEN_LOG_TAG); return nullListener_; } return mapListeners_[strListenerKey]; @@ -281,7 +285,7 @@ std::shared_ptr &SoftbusAdapter::GetSoftbusListenerById(int32_ { std::lock_guard lisLock(listenerMtx_); if (mapSessListeners_.find(sessionId) == mapSessListeners_.end()) { - DHLOGE("%s: Find listener failed.", LOG_TAG); + DHLOGE("%{public}s: Find listener failed.", DSCREEN_LOG_TAG); return nullListener_; } @@ -290,7 +294,7 @@ std::shared_ptr &SoftbusAdapter::GetSoftbusListenerById(int32_ int32_t SoftbusAdapter::OnSoftbusSessionOpened(int32_t sessionId, PeerSocketInfo info) { - DHLOGI("%s: OnSoftbusSessionOpened session:%" PRId32, LOG_TAG, sessionId); + DHLOGI("%{public}s: OnSoftbusSessionOpened session:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); { std::lock_guard lock(serverIdMapMutex_); for (auto it = serverIdMap_.begin(); it != serverIdMap_.end(); it++) { @@ -321,7 +325,7 @@ int32_t SoftbusAdapter::OnSoftbusSessionOpened(int32_t sessionId, PeerSocketInfo void SoftbusAdapter::OnSoftbusSessionClosed(int32_t sessionId, ShutdownReason reason) { - DHLOGI("%s: OnSessionClosed sessionId:%" PRId32, LOG_TAG, sessionId); + DHLOGI("%{public}s: OnSessionClosed sessionId:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); std::shared_ptr &listener = GetSoftbusListenerById(sessionId); if (listener == nullptr) { DHLOGE("Get softbus listener failed."); @@ -338,13 +342,13 @@ void SoftbusAdapter::OnSoftbusSessionClosed(int32_t sessionId, ShutdownReason re void SoftbusAdapter::OnBytesReceived(int32_t sessionId, const void *data, uint32_t dataLen) { - DHLOGD("%s: OnBytesReceived, sessionId:%" PRId32, LOG_TAG, sessionId); + DHLOGD("%{public}s: OnBytesReceived, sessionId:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); if (data == nullptr) { DHLOGE("BytesData is null."); return; } if (dataLen == 0 || dataLen > DSCREEN_MAX_RECV_DATA_LEN) { - DHLOGE("BytesData length is too large, dataLen:%u.", dataLen); + DHLOGE("BytesData length is too large, dataLen:%{public}" PRIu32, dataLen); return; } @@ -359,13 +363,13 @@ void SoftbusAdapter::OnBytesReceived(int32_t sessionId, const void *data, uint32 void SoftbusAdapter::OnStreamReceived(int32_t sessionId, const StreamData *data, const StreamData *ext, const StreamFrameInfo *frameInfo) { - DHLOGD("%s OnStreamReceived, sessionId:%" PRId32, LOG_TAG, sessionId); + DHLOGD("%{public}s OnStreamReceived, sessionId:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); if (data == nullptr) { DHLOGE("StreamData is null."); return; } if (data->bufLen <= 0 || data->bufLen > static_cast(DSCREEN_MAX_RECV_DATA_LEN)) { - DHLOGE("StreamData length is too large, dataLen:%" PRId32, data->bufLen); + DHLOGE("StreamData length is too large, dataLen:%{public}" PRId32, data->bufLen); return; } @@ -381,7 +385,7 @@ void SoftbusAdapter::OnMessageReceived(int sessionId, const void *data, unsigned { (void)data; (void)dataLen; - DHLOGD("%s OnMessageReceived, sessionId:%" PRId32, LOG_TAG, sessionId); + DHLOGD("%{public}s OnMessageReceived, sessionId:%{public}" PRId32, DSCREEN_LOG_TAG, sessionId); } } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/services/softbusadapter/test/fuzztest/softbusonbytesreceived_fuzzer/BUILD.gn b/services/softbusadapter/test/fuzztest/softbusonbytesreceived_fuzzer/BUILD.gn index cee45251e712a2bd90483f57eaba79945b1d08a1..6f073755a6bfb00b1cfea096fccb56ba81fd3633 100644 --- a/services/softbusadapter/test/fuzztest/softbusonbytesreceived_fuzzer/BUILD.gn +++ b/services/softbusadapter/test/fuzztest/softbusonbytesreceived_fuzzer/BUILD.gn @@ -48,6 +48,7 @@ ohos_fuzztest("SoftbusOnBytesReceivedFuzzTest") { "distributed_hardware_fwk:distributed_av_receiver", "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", + "hilog:libhilog", ] defines = [ diff --git a/services/softbusadapter/test/fuzztest/softbusonmessagereceived_fuzzer/BUILD.gn b/services/softbusadapter/test/fuzztest/softbusonmessagereceived_fuzzer/BUILD.gn index c52fa46fbc79f0ed8f1757d5f49dc8a83798752a..e7afe09ba0aeece01257231a32c8b9a56493bc47 100644 --- a/services/softbusadapter/test/fuzztest/softbusonmessagereceived_fuzzer/BUILD.gn +++ b/services/softbusadapter/test/fuzztest/softbusonmessagereceived_fuzzer/BUILD.gn @@ -48,6 +48,7 @@ ohos_fuzztest("SoftbusOnMessageReceivedFuzzTest") { "distributed_hardware_fwk:distributed_av_receiver", "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", + "hilog:libhilog", ] defines = [ diff --git a/services/softbusadapter/test/fuzztest/softbusonsessionclosed_fuzzer/BUILD.gn b/services/softbusadapter/test/fuzztest/softbusonsessionclosed_fuzzer/BUILD.gn index 35a2fd0f77ede0c9edd4c6ff2e44dd32fd6c56b5..95035875683408dedea4236fbf5e4a7a86e5adfa 100644 --- a/services/softbusadapter/test/fuzztest/softbusonsessionclosed_fuzzer/BUILD.gn +++ b/services/softbusadapter/test/fuzztest/softbusonsessionclosed_fuzzer/BUILD.gn @@ -48,6 +48,7 @@ ohos_fuzztest("SoftbusOnSessionClosedFuzzTest") { "distributed_hardware_fwk:distributed_av_receiver", "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", + "hilog:libhilog", ] defines = [ diff --git a/services/softbusadapter/test/fuzztest/softbusonsessionopened_fuzzer/BUILD.gn b/services/softbusadapter/test/fuzztest/softbusonsessionopened_fuzzer/BUILD.gn index 27124a69dfbd4edcd110b7063620415518d7f1ff..4be4cf4051b3efd82c8cba6b7f2b526ac4e5d6b9 100644 --- a/services/softbusadapter/test/fuzztest/softbusonsessionopened_fuzzer/BUILD.gn +++ b/services/softbusadapter/test/fuzztest/softbusonsessionopened_fuzzer/BUILD.gn @@ -48,6 +48,7 @@ ohos_fuzztest("SoftbusOnSessionOpenedFuzzTest") { "distributed_hardware_fwk:distributed_av_receiver", "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", + "hilog:libhilog", ] defines = [ diff --git a/services/softbusadapter/test/fuzztest/softbusonstreamreceived_fuzzer/BUILD.gn b/services/softbusadapter/test/fuzztest/softbusonstreamreceived_fuzzer/BUILD.gn index 3edbc7fb1221d6b6247f4f755fb90e53163459b4..a73e5dd2f215d151d6ef2d084219c0219a9c16cb 100644 --- a/services/softbusadapter/test/fuzztest/softbusonstreamreceived_fuzzer/BUILD.gn +++ b/services/softbusadapter/test/fuzztest/softbusonstreamreceived_fuzzer/BUILD.gn @@ -48,6 +48,7 @@ ohos_fuzztest("SoftbusOnStreamReceivedFuzzTest") { "distributed_hardware_fwk:distributed_av_receiver", "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", + "hilog:libhilog", ] defines = [