diff --git a/bundle.json b/bundle.json index d60cc4590c9a26f2cca66e7b8516de2ba6e2c046..bf7c1623c4242e4dc66778a408fc53e2d44a41fb 100644 --- a/bundle.json +++ b/bundle.json @@ -47,8 +47,7 @@ "c_utils", "window_manager", "distributed_hardware_fwk", - "libjpeg-turbo", - "json" + "libjpeg-turbo" ], "third_party": [] }, diff --git a/common/BUILD.gn b/common/BUILD.gn index 96cc038b20a4d51e5d7d57f0a335a0a498469471..74c7be178dcabbd7709fa155f4184b3ed93f48a7 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -50,8 +50,6 @@ ohos_shared_library("distributed_screen_utils") { "json:nlohmann_json_static", ] - public_external_deps = [ "json:nlohmann_json_static" ] - defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"dscreenutil\"", diff --git a/screenhandler/include/dscreen_handler.h b/screenhandler/include/dscreen_handler.h index c53faf559e256dd1ef81d1d1e9c94a5a235a1291..fb7b7e06ba6783addb2e5e8fc10b6978a9222db2 100644 --- a/screenhandler/include/dscreen_handler.h +++ b/screenhandler/include/dscreen_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * 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 @@ -37,7 +37,6 @@ public: int32_t Initialize() override; std::vector QueryMeta() override; std::vector Query() override; - std::vector RealQuery(); std::map QueryExtraInfo() override; bool IsSupportPlugin() override; void RegisterPluginListener(std::shared_ptr listener) override; diff --git a/screenhandler/src/dscreen_handler.cpp b/screenhandler/src/dscreen_handler.cpp index f400116f6efce5ca0f30afad79cc32b62b6b6438..36a29ecd1dce391359f363db3956171b5257a696 100644 --- a/screenhandler/src/dscreen_handler.cpp +++ b/screenhandler/src/dscreen_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -126,19 +126,12 @@ void DScreenHandler::UnPluginHardware(const std::string &dhId) std::vector DScreenHandler::QueryMeta() { - DHLOGI("DScreenHandler query meta hardware info"); - return RealQuery(); + return {}; } std::vector DScreenHandler::Query() { - DHLOGI("DScreenHandler query full hardware info"); - return RealQuery(); -} - -std::vector DScreenHandler::RealQuery() -{ - DHLOGI("DScreenHandler RealQuery"); + DHLOGI("DScreenHandler query hardware info"); std::vector dhItemVec; std::vector> screens; Rosen::ScreenManager::GetInstance().GetAllScreens(screens); diff --git a/services/common/screen_channel/include/iscreen_channel.h b/services/common/screen_channel/include/iscreen_channel.h index 24d5c4935f651867bb378b4745f27332d6d3924e..b2e74395662013a84c97825c185f40949a0009f3 100644 --- a/services/common/screen_channel/include/iscreen_channel.h +++ b/services/common/screen_channel/include/iscreen_channel.h @@ -28,7 +28,7 @@ public: virtual ~IScreenChannel() = default; virtual int32_t CreateSession(const std::shared_ptr &listener) = 0; virtual int32_t ReleaseSession() = 0; - virtual int32_t OpenSession(const std::shared_ptr &listener) = 0; + virtual int32_t OpenSession(const std::shared_ptr listener) = 0; virtual int32_t CloseSession() = 0; virtual int32_t SendData(const std::shared_ptr &data) = 0; virtual void SetJpegSessionFlag(bool flag) = 0; diff --git a/services/screenservice/sinkservice/BUILD.gn b/services/screenservice/sinkservice/BUILD.gn index 6db4bea6f71766aed5d3a4ecdbe6548a0cdf3e5a..350eeae32d5f1dd033a9fc04fd8f28deb04dbb2b 100644 --- a/services/screenservice/sinkservice/BUILD.gn +++ b/services/screenservice/sinkservice/BUILD.gn @@ -98,8 +98,6 @@ ohos_shared_library("distributed_screen_sink") { "window_manager:libdm", ] - public_external_deps = [ "json:nlohmann_json_static" ] - subsystem_name = "distributedhardware" part_name = "distributed_screen" diff --git a/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregionmgr.cpp b/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregionmgr.cpp index 93da68f3db1886986795d80b76ca41186dfd62dd..babed377057992597d2acf151958cd59a0ba02e3 100644 --- a/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregionmgr.cpp +++ b/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregionmgr.cpp @@ -47,6 +47,11 @@ using AVTransProviderClass = IAVEngineProvider *(*)(const std::string); const std::string RECEIVER_SO_NAME = "libdistributed_av_receiver.z.so"; const std::string GET_PROVIDER_FUNC = "GetAVReceiverEngineProvider"; +#ifdef __LP64__ +const std::string LIB_LOAD_PATH = "/system/lib64/"; +#else +const std::string LIB_LOAD_PATH = "/system/lib/"; +#endif ScreenRegionManager::ScreenRegionManager() { @@ -156,13 +161,15 @@ void ScreenRegionManager::GetScreenDumpInfo(std::string &result) int32_t ScreenRegionManager::LoadAVReceiverEngineProvider() { DHLOGI("LoadAVReceiverEngineProvider enter"); - if ((RECEIVER_SO_NAME.length() == 0) || (RECEIVER_SO_NAME.length() > PATH_MAX)) { - DHLOGE("File canonicalization failed, so name: %{public}s.", RECEIVER_SO_NAME.c_str()); + char path[PATH_MAX + 1] = {0x00}; + if ((LIB_LOAD_PATH.length() + RECEIVER_SO_NAME.length()) > PATH_MAX || + realpath((LIB_LOAD_PATH + RECEIVER_SO_NAME).c_str(), path) == nullptr) { + DHLOGE("File canonicalization failed"); return ERR_DH_AV_TRANS_LOAD_ERROR; } - void *pHandler = dlopen(RECEIVER_SO_NAME.c_str(), RTLD_LAZY | RTLD_NODELETE); + void *pHandler = dlopen(path, RTLD_LAZY | RTLD_NODELETE); if (pHandler == nullptr) { - DHLOGE("so: %{public}s load failed, failed reason : %{public}s", RECEIVER_SO_NAME.c_str(), 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()); @@ -179,11 +186,13 @@ int32_t ScreenRegionManager::LoadAVReceiverEngineProvider() int32_t ScreenRegionManager::UnloadAVReceiverEngineProvider() { DHLOGI("UnloadAVReceiverEngineProvider enter"); - if ((RECEIVER_SO_NAME.length() == 0) || (RECEIVER_SO_NAME.length() > PATH_MAX)) { - DHLOGE("File canonicalization failed, so name: %{public}s.", RECEIVER_SO_NAME.c_str()); + char path[PATH_MAX + 1] = {0x00}; + if ((LIB_LOAD_PATH.length() + RECEIVER_SO_NAME.length()) > PATH_MAX || + realpath((LIB_LOAD_PATH + RECEIVER_SO_NAME).c_str(), path) == nullptr) { + DHLOGE("File canonicalization failed"); return ERR_DH_AV_TRANS_LOAD_ERROR; } - void *pHandler = dlopen(RECEIVER_SO_NAME.c_str(), RTLD_LAZY | RTLD_NODELETE); + void *pHandler = dlopen(path, RTLD_LAZY | RTLD_NODELETE); if (pHandler != nullptr) { dlclose(pHandler); pHandler = nullptr; diff --git a/services/screenservice/sourceservice/BUILD.gn b/services/screenservice/sourceservice/BUILD.gn index 97da3dd8f6be69224997c9352f38f7ff1a0d0871..4061c4fb4728bfc06f3b1983729ac6cce82de5c2 100644 --- a/services/screenservice/sourceservice/BUILD.gn +++ b/services/screenservice/sourceservice/BUILD.gn @@ -106,8 +106,6 @@ ohos_shared_library("distributed_screen_source") { "window_manager:libdm", ] - public_external_deps = [ "json:nlohmann_json_static" ] - subsystem_name = "distributedhardware" part_name = "distributed_screen" 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 2ccb802ab21a39b7566de78e4709a2b1206ac1a2..b064c1103cf2912e7b24fcebe2a6d39b94705c27 100644 --- a/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen_manager.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/2.0/src/dscreen_manager.cpp @@ -44,6 +44,11 @@ using AVTransProviderClass = IAVEngineProvider *(*)(const std::string); const std::string SENDER_SO_NAME = "libdistributed_av_sender.z.so"; const std::string GET_PROVIDER_FUNC = "GetAVSenderEngineProvider"; +#ifdef __LP64__ +const std::string LIB_LOAD_PATH = "/system/lib64/"; +#else +const std::string LIB_LOAD_PATH = "/system/lib/"; +#endif const std::map stateMap = { { DISABLED, "disabled" }, @@ -397,13 +402,15 @@ void DScreenManager::PublishMessage(const DHTopic topic, const std::shared_ptr PATH_MAX)) { - DHLOGE("File canonicalization failed, so name: %{public}s.", SENDER_SO_NAME.c_str()); + char path[PATH_MAX + 1] = {0x00}; + if ((LIB_LOAD_PATH.length() + SENDER_SO_NAME.length()) > PATH_MAX || + realpath((LIB_LOAD_PATH + SENDER_SO_NAME).c_str(), path) == nullptr) { + DHLOGE("File canonicalization failed"); return ERR_DH_AV_TRANS_LOAD_ERROR; } - void *pHandler = dlopen(SENDER_SO_NAME.c_str(), RTLD_LAZY | RTLD_NODELETE); + void *pHandler = dlopen(path, RTLD_LAZY | RTLD_NODELETE); if (pHandler == nullptr) { - DHLOGE("so: %{public}s load failed, failed reason : %{public}s", SENDER_SO_NAME.c_str(), 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()); @@ -420,11 +427,13 @@ int32_t DScreenManager::LoadAVSenderEngineProvider() int32_t DScreenManager::UnloadAVSenderEngineProvider() { DHLOGI("UnloadAVSenderEngineProvider enter"); - if ((SENDER_SO_NAME.length() == 0) || (SENDER_SO_NAME.length() > PATH_MAX)) { - DHLOGE("File canonicalization failed, so name: %{public}s.", SENDER_SO_NAME.c_str()); + char path[PATH_MAX + 1] = {0x00}; + if ((LIB_LOAD_PATH.length() + SENDER_SO_NAME.length()) > PATH_MAX || + realpath((LIB_LOAD_PATH + SENDER_SO_NAME).c_str(), path) == nullptr) { + DHLOGE("File canonicalization failed"); return ERR_DH_AV_TRANS_LOAD_ERROR; } - void *pHandler = dlopen(SENDER_SO_NAME.c_str(), RTLD_LAZY | RTLD_NODELETE); + void *pHandler = dlopen(path, RTLD_LAZY | RTLD_NODELETE); if (pHandler != nullptr) { dlclose(pHandler); pHandler = nullptr; diff --git a/services/screentransport/screendatachannel/include/screen_data_channel_impl.h b/services/screentransport/screendatachannel/include/screen_data_channel_impl.h index 23a3bc10aa335dcce84f8310425d3993a6e91738..46a1d95c80b70b12ff02b9585adb70310e70b902 100644 --- a/services/screentransport/screendatachannel/include/screen_data_channel_impl.h +++ b/services/screentransport/screendatachannel/include/screen_data_channel_impl.h @@ -34,7 +34,7 @@ public: ~ScreenDataChannelImpl() override = default; int32_t CreateSession(const std::shared_ptr &listener) override; int32_t ReleaseSession() override; - int32_t OpenSession(const std::shared_ptr &listener) override; + int32_t OpenSession(const std::shared_ptr listener) override; int32_t CloseSession() override; int32_t SendData(const std::shared_ptr &screenData) override; void SetJpegSessionFlag(bool flag) override; diff --git a/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp b/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp index 535eb8df25ec9ec9d5b7dedfe2faa00e21f4ab55..e452b829aba2243e9dae1f691d6c1f5c86612c27 100644 --- a/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp +++ b/services/screentransport/screendatachannel/src/screen_data_channel_impl.cpp @@ -100,7 +100,7 @@ int32_t ScreenDataChannelImpl::ReleaseSession() return DH_SUCCESS; } -int32_t ScreenDataChannelImpl::OpenSession(const std::shared_ptr &listener) +int32_t ScreenDataChannelImpl::OpenSession(const std::shared_ptr listener) { DHLOGI("%{public}s: OpenSession, peerDevId(%{public}s)", DSCREEN_LOG_TAG, GetAnonyString(peerDevId_).c_str()); if (listener == nullptr) { diff --git a/services/screentransport/screensinktrans/BUILD.gn b/services/screentransport/screensinktrans/BUILD.gn index 4bb63ebcce1310d2c4bf886a4aa7c4b48e8d181a..f073e1aa117311d0f71fac3f7d805e9765f46f93 100644 --- a/services/screentransport/screensinktrans/BUILD.gn +++ b/services/screentransport/screensinktrans/BUILD.gn @@ -80,8 +80,6 @@ ohos_shared_library("distributed_screen_sinktrans") { "media_foundation:media_foundation", ] - public_external_deps = [ "json:nlohmann_json_static" ] - subsystem_name = "distributedhardware" part_name = "distributed_screen" diff --git a/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp b/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp index c2b3b08f6a3f289c0c1a740330b0d15d7f006358..fa17fc66b1ba10afe54ea81d034e0c185b8cbe95 100644 --- a/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp +++ b/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp @@ -29,12 +29,15 @@ #include "dscreen_hisysevent.h" #include "dscreen_log.h" #include "jpeglib.h" - +#ifdef __LP64__ +static const std::string LIB_LOAD_PATH = "/system/lib64/libdistributed_screen_dbg_itf.z.so"; +#else +static const std::string LIB_LOAD_PATH = "/system/lib/libdistributed_screen_dbg_itf.z.so"; +#endif using GetDscreenDBGItfFunc = OHOS::DistributedHardware::IDScreenDBGItf* (*)(); using GetImageDirtyFunc = OHOS::DistributedHardware::IImageSetDirty* (*)(); namespace OHOS { namespace DistributedHardware { -const std::string DBG_SO_NAME = "libdistributed_screen_dbg_itf.z.so"; void ConsumerBufferListener::OnBufferAvailable() { DHLOGI("%{public}s: OnBufferAvailable, receiv data from RS.", DSCREEN_LOG_TAG); @@ -43,13 +46,14 @@ void ConsumerBufferListener::OnBufferAvailable() void ImageSourceEncoder::InitDscreenDBG() { - if ((DBG_SO_NAME.length() == 0) || (DBG_SO_NAME.length() > PATH_MAX)) { - DHLOGE("File canonicalization failed, so name: %{public}s.", DBG_SO_NAME.c_str()); + char path[PATH_MAX + 1] = {0x00}; + if (LIB_LOAD_PATH.length() > PATH_MAX || realpath(LIB_LOAD_PATH.c_str(), path) == nullptr) { + DHLOGE("File connicailization failed."); return; } - pHandler_ = dlopen(DBG_SO_NAME.c_str(), RTLD_LAZY | RTLD_NODELETE | RTLD_GLOBAL); + pHandler_ = dlopen(path, RTLD_LAZY | RTLD_NODELETE | RTLD_GLOBAL); if (pHandler_ == nullptr) { - DHLOGE("so: %{public}s load failed, fail reason: %{public}s.", DBG_SO_NAME.c_str(), 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()); diff --git a/services/screentransport/screensourcetrans/BUILD.gn b/services/screentransport/screensourcetrans/BUILD.gn index 0960cebcd41451f1c70504da3b06fcd97d976f2f..d75d798ea84f4cee99bfd16bb22b292ff6d5db6e 100644 --- a/services/screentransport/screensourcetrans/BUILD.gn +++ b/services/screentransport/screensourcetrans/BUILD.gn @@ -81,8 +81,6 @@ ohos_shared_library("distributed_screen_sourcetrans") { "media_foundation:media_foundation", ] - public_external_deps = [ "json:nlohmann_json_static" ] - subsystem_name = "distributedhardware" part_name = "distributed_screen" diff --git a/services/screentransport/test/unittest/screentranstestutils/include/screentrans_test_utils.h b/services/screentransport/test/unittest/screentranstestutils/include/screentrans_test_utils.h index a0a36c99fc850f8882cbbfd998f57ce499d53e93..eb7937564776a085e481c912d709ea5fd5a66a14 100644 --- a/services/screentransport/test/unittest/screentranstestutils/include/screentrans_test_utils.h +++ b/services/screentransport/test/unittest/screentranstestutils/include/screentrans_test_utils.h @@ -90,7 +90,7 @@ public: { return DH_SUCCESS; } - int32_t OpenSession(const std::shared_ptr &listener) override + int32_t OpenSession(const std::shared_ptr listener) override { return DH_SUCCESS; }