diff --git a/common/BUILD.gn b/common/BUILD.gn index ac535f8225060a4b04d4cb75668697377673914c..711d3385d9281ef1b54cf0d71f938184e99803bc 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -44,6 +44,11 @@ ohos_shared_library("distributed_screen_utils") { "DH_LOG_TAG=\"dscreenutil\"", "LOG_DOMAIN=0xD004100", ] + cflags = [ + "-fPIC", + "-Wall", + ] + cflags_cc = cflags subsystem_name = "distributedhardware" diff --git a/common/src/dscreen_sa_process_state.cpp b/common/src/dscreen_sa_process_state.cpp index 8f052d23d4c7fc0687d2c80153a64f8549d9b936..563f5dfec98b014227e3316b1c87caa8c1c0de08 100644 --- a/common/src/dscreen_sa_process_state.cpp +++ b/common/src/dscreen_sa_process_state.cpp @@ -46,6 +46,7 @@ void SetSinkProcessExit() DHLOGI("exit sa process success."); ReportSaEvent(DSCREEN_EXIT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, "dscreen sink sa exit success."); exit(0); + return; } void SetSourceProcessExit() @@ -60,6 +61,7 @@ void SetSourceProcessExit() DHLOGI("exit sa process success."); ReportSaEvent(DSCREEN_EXIT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, "dscreen source sa exit success."); exit(0); + return; } } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_proxy.h b/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_proxy.h index 13c3df828652b262a32c180b57df7ff652f77f1d..df2f4e4e15a79e81972074b7e05e786d2e35eb51 100644 --- a/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_proxy.h +++ b/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_proxy.h @@ -36,7 +36,7 @@ public: ~DScreenSourceProxy() {} int32_t InitSource(const std::string ¶ms, const sptr &callback) override; - int32_t ReleaseSource() override; + void ReleaseSource() override; int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const EnableParam ¶m, const std::string &reqId) override; int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, diff --git a/interfaces/innerkits/native_cpp/screen_source/include/idscreen_source.h b/interfaces/innerkits/native_cpp/screen_source/include/idscreen_source.h index 6c1a69edf41eaf1c18b995e577798a9636c4162c..bcffa0848cf198422a0c1ce10b55c0e8fae33967 100644 --- a/interfaces/innerkits/native_cpp/screen_source/include/idscreen_source.h +++ b/interfaces/innerkits/native_cpp/screen_source/include/idscreen_source.h @@ -36,7 +36,7 @@ public: virtual ~IDScreenSource() {} virtual int32_t InitSource(const std::string ¶ms, const sptr &callback) = 0; - virtual int32_t ReleaseSource() = 0; + virtual void ReleaseSource() = 0; virtual int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const EnableParam ¶m, const std::string &reqId) = 0; virtual int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, 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 73d8509ca68ef99c5213bed4797d2aa6fc909efb..32baffaf4f1840b8e29712af6772b10f16bdc271 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 @@ -122,9 +122,9 @@ int32_t DScreenSourceHandler::ReleaseSource() "dscreen source proxy not init."); return ERR_DH_SCREEN_SA_SOURCEPROXY_NOT_INIT; } - int32_t ret = dScreenSourceProxy_->ReleaseSource(); + dScreenSourceProxy_->ReleaseSource(); dScreenSourceProxy_ = nullptr; - return ret; + return DH_SUCCESS; } int32_t DScreenSourceHandler::RegisterDistributedHardware(const std::string &devId, diff --git a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_proxy.cpp b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_proxy.cpp index f4ab20d03a5f7126e477cc27b40872322a72ecfe..5da0f08f5596ae4b136def5fd886ac58e8c7841a 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_proxy.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_proxy.cpp @@ -46,19 +46,18 @@ int32_t DScreenSourceProxy::InitSource(const std::string ¶ms, const sptrSendRequest(RELEASE_SOURCE, data, reply, option); - int32_t ret = reply.ReadInt32(); - return ret; + return; } int32_t DScreenSourceProxy::RegisterDistributedHardware(const std::string &devId, diff --git a/services/screendemo/BUILD.gn b/services/screendemo/BUILD.gn index 2d7f20312698ba1300f1d26ae8001cfa9974f1a3..2f7a0aa91d3c8b9c23407bb704a7186e36c4bfe7 100644 --- a/services/screendemo/BUILD.gn +++ b/services/screendemo/BUILD.gn @@ -60,7 +60,10 @@ ohos_executable("distributedScreenTest") { "multimedia_player_framework:media_client", ] - cflags = [ "-Wall" ] + cflags = [ + "-fPIC", + "-Wall", + ] cflags_cc = cflags part_name = "distributed_screen" diff --git a/services/screendemo/test.cpp b/services/screendemo/test.cpp index 5d07ccefd8dbbc89c23d7ad6ad218f6f189979f8..2f0dcb849c5271af2b6d04494c131b0b42c4eb1a 100644 --- a/services/screendemo/test.cpp +++ b/services/screendemo/test.cpp @@ -78,7 +78,6 @@ static void StartMirror() { vector> remoteScreens = QueryRemoteScreenInfo(); if (remoteScreens.size() == 0) { - cout << "Error: no remote screens enabled" << endl; return; } @@ -108,6 +107,7 @@ static void StartMirror() vector mirrorIds; mirrorIds.push_back(mirrorId); ScreenManager::GetInstance().MakeMirror(defaultDisplay->GetScreenId(), mirrorIds); + return; } static void StopMirror() @@ -142,6 +142,7 @@ static void StopMirror() vector stopMirrorIds; stopMirrorIds.push_back(stopMirrorId); ScreenManager::GetInstance().RemoveVirtualScreenFromGroup(stopMirrorIds); + return; } static void StartExpand() @@ -177,6 +178,7 @@ static void StartExpand() cout << "expand screen Id is " << expandId << endl; vector options = {{defaultDisplay->GetScreenId(), 0, 0}, {expandId, defaultDisplay->GetWidth(), 0}}; ScreenManager::GetInstance().MakeExpand(options); + return; } static void StopExpand() @@ -211,6 +213,7 @@ static void StopExpand() vector stopExpandIds; stopExpandIds.push_back(stopExpandId); ScreenManager::GetInstance().RemoveVirtualScreenFromGroup(stopExpandIds); + return; } static void PrintNodeProperty(NodeBasicInfo *nodeInfo) @@ -236,6 +239,7 @@ static void PrintNodeProperty(NodeBasicInfo *nodeInfo) } else { printf("Uuid = %s\n", GetAnonyString((char *)uuid).c_str()); } + return; } static void QueryRemoteDeviceInfo() @@ -261,6 +265,7 @@ static void QueryRemoteDeviceInfo() } FreeNodeInfo(remoteNodeInfo); printf("SoftBusDumpDeviceInfo complete!\n"); + return; } static void CreateWindow() @@ -303,6 +308,7 @@ static void CreateWindow() << ", width: " << windowWidth << ", height: " << windowHeight << endl; ScreenClient::GetInstance().RemoveWindow(windowId); + return; } int main() @@ -316,21 +322,21 @@ int main() cout << "5:QueryRemoteDeviceInfo" << endl; cout << "6:QueryRemoteScreenInfo" << endl; string mode; - (void)getline(cin, mode); + getline(cin, mode); if (mode == "" || mode == "0") { - (void)StartMirror(); + StartMirror(); } else if (mode == "1") { - (void)StopMirror(); + StopMirror(); } else if (mode == "2") { - (void)StartExpand(); + StartExpand(); } else if (mode == "3") { - (void)StopExpand(); + StopExpand(); } else if (mode == "4") { - (void)CreateWindow(); + CreateWindow(); } else if (mode == "5") { - (void)QueryRemoteDeviceInfo(); + QueryRemoteDeviceInfo(); } else if (mode == "6") { - (void)QueryRemoteScreenInfo(); + QueryRemoteScreenInfo(); } else { cout << "no that selection" << endl; } diff --git a/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_service.h b/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_service.h index 415673d00c4df055232aef2807a5ec840615a9ee..997e8af32e31562c30d59f764667c2c54e33515d 100644 --- a/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_service.h +++ b/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_service.h @@ -32,7 +32,7 @@ public: DScreenSourceService(int32_t saId, bool runOnCreate); ~DScreenSourceService(); int32_t InitSource(const std::string ¶ms, const sptr &callback) override; - int32_t ReleaseSource() override; + void ReleaseSource() override; int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const EnableParam ¶m, const std::string &reqId) override; int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, diff --git a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp index 00e8cd8d79dcc441275635de60e5b72cdc7dccc9..11355c7351e769e01a93da15a817fe503911fe15 100644 --- a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp +++ b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp @@ -87,17 +87,17 @@ int32_t DScreenSourceService::InitSource(const std::string ¶ms, const sptr