diff --git a/common/include/dscreen_errcode.h b/common/include/dscreen_errcode.h index 6b11c11ecf2178c11542415596dd80e02b762477..0806f91e2d4b1fdd6c5389ca1be6e24e69c860f4 100644 --- a/common/include/dscreen_errcode.h +++ b/common/include/dscreen_errcode.h @@ -58,6 +58,7 @@ enum DScreenErrorCode { ERR_DH_SCREEN_SA_LOAD_TIMEOUT = -500032, ERR_DH_SCREEN_SA_HIDUMPER_ERROR = -500033, ERR_DH_SCREEN_SA_ENABLE_JSON_ERROR = -500034, + ERR_DH_SCREEN_SA_VALUE_NOT_INIT = -500035, // Transport component error code ERR_DH_SCREEN_TRANS_ERROR = -51000, ERR_DH_SCREEN_TRANS_TIMEOUT = -51001, @@ -96,6 +97,8 @@ enum DScreenErrorCode { ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR = -54004, // screen register callback ERR_DH_SCREEN_REGISTER_CALLBACK_NOT_INIT = -55000, + // screen string param empty + ERR_DH_SCREEN_STRING_PARAM_EMPTY = -56000, }; } // namespace DistributedHardware } // namespace OHOS 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 e503e1f7bb6d98700e6f188c720aa8fa2521600d..38bdd4b4b52b8320a1038b920719a39d7b6540b4 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 @@ -97,7 +97,7 @@ int32_t DScreenSinkHandler::InitSink(const std::string ¶ms) void DScreenSinkHandler::FinishStartSA(const std::string ¶ms, const sptr &remoteObject) { DHLOGI("DScreenSinkHandler FinishStartSA"); - std::unique_lock lock(proxyMutex_); + std::lock_guard lock(proxyMutex_); if (sinkSvrRecipient_ == nullptr) { DHLOGE("sinkSvrRecipient is nullptr."); ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, @@ -106,7 +106,7 @@ void DScreenSinkHandler::FinishStartSA(const std::string ¶ms, const sptrAddDeathRecipient(sinkSvrRecipient_); dScreenSinkProxy_ = iface_cast(remoteObject); - if ((dScreenSinkProxy_== nullptr) || (!dScreenSinkProxy_->AsObject())) { + if ((dScreenSinkProxy_== nullptr) || (dScreenSinkProxy_->AsObject() == nullptr)) { DHLOGE("Failed to get dscreen sink proxy."); ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, "dscreen sink get proxy failed."); @@ -141,8 +141,8 @@ int32_t DScreenSinkHandler::SubscribeLocalHardware(const std::string &dhId, cons DHLOGE("screen sink proxy not init."); return ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT; } - int32_t ret = dScreenSinkProxy_->SubscribeLocalHardware(dhId, param); - return ret; + + return dScreenSinkProxy_->SubscribeLocalHardware(dhId, param); } int32_t DScreenSinkHandler::UnsubscribeLocalHardware(const std::string &dhId) @@ -153,8 +153,8 @@ int32_t DScreenSinkHandler::UnsubscribeLocalHardware(const std::string &dhId) DHLOGE("screen sink proxy not init."); return ERR_DH_SCREEN_SA_SINKPROXY_NOT_INIT; } - int32_t ret = dScreenSinkProxy_->UnsubscribeLocalHardware(dhId); - return ret; + + return dScreenSinkProxy_->UnsubscribeLocalHardware(dhId); } void DScreenSinkHandler::DScreenSinkSvrRecipient::OnRemoteDied(const wptr &remote) @@ -172,10 +172,18 @@ void DScreenSinkHandler::OnRemoteSinkSvrDied(const wptr &remote) return; } std::lock_guard lock(proxyMutex_); - if (dScreenSinkProxy_ != nullptr && sinkSvrRecipient_ != nullptr) { - dScreenSinkProxy_->AsObject()->RemoveDeathRecipient(sinkSvrRecipient_); + if (dScreenSinkProxy_ == nullptr || dScreenSinkProxy_->AsObject() == nullptr) { + delete sinkSvrRecipient_; + sinkSvrRecipient_ = nullptr; dScreenSinkProxy_ = nullptr; + return; + } + if (sinkSvrRecipient_ == nullptr) { + dScreenSinkProxy_ = nullptr; + return; } + dScreenSinkProxy_->AsObject()->RemoveDeathRecipient(sinkSvrRecipient_); + dScreenSinkProxy_ = nullptr; } IDistributedHardwareSink *GetSinkHardwareHandler() diff --git a/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_proxy.cpp b/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_proxy.cpp index 92c5688cf34d219755ad1394ba92eeff9ecf5330..1da1aeba8997fd2abd5ce34980746f0318ba0067 100644 --- a/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_proxy.cpp +++ b/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_proxy.cpp @@ -27,7 +27,6 @@ namespace OHOS { namespace DistributedHardware { int32_t DScreenSinkProxy::InitSink(const std::string ¶ms) { - DHLOGI("DScreenSinkProxy InitSink"); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSinkProxy remote service null"); @@ -53,7 +52,6 @@ int32_t DScreenSinkProxy::InitSink(const std::string ¶ms) int32_t DScreenSinkProxy::ReleaseSink() { - DHLOGI("DScreenSinkProxy ReleaseSink"); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSinkProxy remote service null"); @@ -74,7 +72,6 @@ int32_t DScreenSinkProxy::ReleaseSink() int32_t DScreenSinkProxy::SubscribeLocalHardware(const std::string &dhId, const std::string ¶m) { - DHLOGI("DScreenSinkProxy SubscribeLocalHardware dhId: %s", GetAnonyString(dhId).c_str()); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSinkProxy remote service null"); @@ -100,7 +97,6 @@ int32_t DScreenSinkProxy::SubscribeLocalHardware(const std::string &dhId, const int32_t DScreenSinkProxy::UnsubscribeLocalHardware(const std::string &dhId) { - DHLOGI("DScreenSinkProxy UnsubscribeLocalHardware dhId: %s", GetAnonyString(dhId).c_str()); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSinkProxy remote service null"); @@ -126,8 +122,6 @@ int32_t DScreenSinkProxy::UnsubscribeLocalHardware(const std::string &dhId) void DScreenSinkProxy::DScreenNotify(const std::string &devId, int32_t eventCode, const std::string &eventContent) { - DHLOGI("DScreenNotify devId: %s eventCode: %d eventContent: %s", - GetAnonyString(devId).c_str(), eventCode, eventContent.c_str()); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSinkProxy remote service null"); diff --git a/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback.h b/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback.h index f7bc172d2992f4affb0ca8a45bb2037aa66e58db..403c0a9fc8eb4eb1229643ceaf928817b377268e 100644 --- a/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback.h +++ b/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback.h @@ -29,7 +29,7 @@ namespace DistributedHardware { class DScreenSourceCallback : public DScreenSourceCallbackStub { public: DScreenSourceCallback() = default; - ~DScreenSourceCallback(); + ~DScreenSourceCallback() = default; int32_t OnNotifyRegResult(const std::string &devId, const std::string &dhId, const std::string &reqId, int32_t status, const std::string &data) override; diff --git a/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback_stub.h b/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback_stub.h index a63a556092988d93e1307e5e2302ddde293e0c0f..65a48aae1096131dc5331cafe866ea4fb8d46b36 100644 --- a/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback_stub.h +++ b/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_callback_stub.h @@ -31,7 +31,7 @@ namespace DistributedHardware { class DScreenSourceCallbackStub : public IRemoteStub { public: DScreenSourceCallbackStub(); - virtual ~DScreenSourceCallbackStub(); + virtual ~DScreenSourceCallbackStub() = default; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; private: diff --git a/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_load_callback.h b/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_load_callback.h index e8420e23349dae7fbe9bc60b4be06ee70bbacbd6..50b433d505f38cd70b5d92d296ba03fd857fc4ac 100644 --- a/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_load_callback.h +++ b/interfaces/innerkits/native_cpp/screen_source/include/callback/dscreen_source_load_callback.h @@ -27,7 +27,7 @@ namespace OHOS { namespace DistributedHardware { class DScreenSourceLoadCallback : public SystemAbilityLoadCallbackStub { public: - explicit DScreenSourceLoadCallback(const std::string ¶ms); + explicit DScreenSourceLoadCallback(const std::string ¶ms): params_(params) {}; void OnLoadSystemAbilitySuccess(int32_t systemAbilityId, const sptr &remoteObject) override; void OnLoadSystemAbilityFail(int32_t systemAbilityId) override; diff --git a/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_handler.h b/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_handler.h index bcb400340e998329dc5bb003e95b204c1632bb05..6f13791a8b105a12878e593eb493f83d0e284547 100644 --- a/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_handler.h +++ b/interfaces/innerkits/native_cpp/screen_source/include/dscreen_source_handler.h @@ -51,7 +51,7 @@ private: }; DScreenSourceHandler(); - ~DScreenSourceHandler(); + ~DScreenSourceHandler() = default; std::mutex proxyMutex_; std::condition_variable proxyConVar_; 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 e22ba562089bfa45a77e688d82bef203b32d68b3..5631fcf91f44f6438bc717ab29631b1bb597e068 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 @@ -21,8 +21,6 @@ namespace OHOS { namespace DistributedHardware { -DScreenSourceCallback::~DScreenSourceCallback() {} - int32_t DScreenSourceCallback::OnNotifyRegResult(const std::string &devId, const std::string &dhId, const std::string &reqId, int32_t status, const std::string &data) { @@ -30,6 +28,10 @@ int32_t DScreenSourceCallback::OnNotifyRegResult(const std::string &devId, const GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), status); auto iter = registerCallbackMap_.find(reqId); if (iter != registerCallbackMap_.end()) { + if (iter->second == nullptr) { + DHLOGE("DScreenSourceCallback Regcallback is null."); + return ERR_DH_SCREEN_SA_REGISTERCALLBACK_NOT_FOUND; + } iter->second->OnRegisterResult(devId, dhId, status, data); registerCallbackMap_.erase(reqId); return DH_SUCCESS; @@ -45,6 +47,10 @@ int32_t DScreenSourceCallback::OnNotifyUnregResult(const std::string &devId, con GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), status); auto iter = unregisterCallbackMap_.find(reqId); if (iter != unregisterCallbackMap_.end()) { + if (iter->second == nullptr) { + DHLOGE("DScreenSourceCallback Unregcallback is null."); + return ERR_DH_SCREEN_SA_UNREGISTERCALLBACK_NOT_FOUND; + } iter->second->OnUnregisterResult(devId, dhId, status, data); unregisterCallbackMap_.erase(reqId); return DH_SUCCESS; diff --git a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback_stub.cpp b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback_stub.cpp index 5c4fdf17588e66b1a22837b22675e8b15ef7864a..faaf680268235531f31368db37f7b3b7e8a5d5ed 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback_stub.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_callback_stub.cpp @@ -33,14 +33,9 @@ DScreenSourceCallbackStub::DScreenSourceCallbackStub() memberFuncMap_[NOTIFY_UNREG_RESULT] = &DScreenSourceCallbackStub::OnNotifyUnregResultInner; } -DScreenSourceCallbackStub::~DScreenSourceCallbackStub() -{ -} - int32_t DScreenSourceCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("OnRemoteRequest, code: %d", code); std::u16string desc = DScreenSourceCallbackStub::GetDescriptor(); std::u16string remoteDesc = data.ReadInterfaceToken(); if (desc != remoteDesc) { @@ -60,7 +55,6 @@ int32_t DScreenSourceCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel int32_t DScreenSourceCallbackStub::OnNotifyRegResultInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("DScreenSourceCallbackStub OnNotifyRegResultInner"); std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string reqId = data.ReadString(); @@ -73,7 +67,6 @@ int32_t DScreenSourceCallbackStub::OnNotifyRegResultInner(MessageParcel &data, M int32_t DScreenSourceCallbackStub::OnNotifyUnregResultInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("DScreenSourceCallbackStub OnNotifyUnregResultInner"); std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string reqId = data.ReadString(); 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 1e0943a5df16e2b61980eef10e797fdfa28ed71f..5bfda8edbd1685d4b0ee5fe4de25adb2fb207e45 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 @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "dscreen_source_load_callback.h" #include "dscreen_constants.h" @@ -23,9 +24,6 @@ namespace OHOS { class IRemoteObject; } namespace OHOS { namespace DistributedHardware { -DScreenSourceLoadCallback::DScreenSourceLoadCallback( - const std::string ¶ms) : params_(params) {} - void DScreenSourceLoadCallback::OnLoadSystemAbilitySuccess( int32_t systemAbilityId, const sptr &remoteObject) { 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 beff2a16cdadc7ee8fd84731ade0eaea07f8ec93..6132293936fd7a6b569222e68735e5b79de000cd 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 @@ -52,11 +52,6 @@ DScreenSourceHandler::DScreenSourceHandler() } } -DScreenSourceHandler::~DScreenSourceHandler() -{ - DHLOGI("~DScreenSourceHandler."); -} - int32_t DScreenSourceHandler::InitSource(const std::string ¶ms) { DHLOGI("DScreenSourceHandler InitSource"); @@ -97,7 +92,7 @@ int32_t DScreenSourceHandler::InitSource(const std::string ¶ms) void DScreenSourceHandler::FinishStartSA(const std::string ¶ms, const sptr &remoteObject) { DHLOGI("DScreenSourceHandler FinishStartSA"); - std::unique_lock lock(proxyMutex_); + std::lock_guard lock(proxyMutex_); if (sourceSvrRecipient_ == nullptr) { DHLOGE("sourceSvrRecipient is nullptr."); ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SOURCEPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, @@ -106,7 +101,7 @@ void DScreenSourceHandler::FinishStartSA(const std::string ¶ms, const sptrAddDeathRecipient(sourceSvrRecipient_); dScreenSourceProxy_ = iface_cast(remoteObject); - if ((dScreenSourceProxy_ == nullptr) || (!dScreenSourceProxy_->AsObject())) { + if ((dScreenSourceProxy_ == nullptr) || (dScreenSourceProxy_->AsObject() == nullptr)) { DHLOGE("Failed to get dscreen source proxy."); ReportSaFail(DSCREEN_INIT_FAIL, ERR_DH_SCREEN_SA_SOURCEPROXY_NOT_INIT, DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, "dscreen source get proxy failed."); @@ -141,12 +136,16 @@ int32_t DScreenSourceHandler::ReleaseSource() int32_t DScreenSourceHandler::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const EnableParam ¶m, std::shared_ptr callback) { - DHLOGI("RegisterDistributedHardware, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), - GetAnonyString(dhId).c_str()); + if (devId.empty() || dhId.empty()) { + DHLOGE("device id or dh id empty."); + return ERR_DH_SCREEN_STRING_PARAM_EMPTY; + } if (callback == nullptr) { DHLOGE("callback is nullptr."); return ERR_DH_SCREEN_REGISTER_CALLBACK_NOT_INIT; } + DHLOGI("RegisterDistributedHardware, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), + GetAnonyString(dhId).c_str()); std::lock_guard lock(proxyMutex_); if (dScreenSourceProxy_ == nullptr) { DHLOGE("screen source proxy not init."); @@ -159,19 +158,22 @@ int32_t DScreenSourceHandler::RegisterDistributedHardware(const std::string &dev std::string reqId = GetRandomID(); dScreenSourceCallback_->PushRegRegisterCallback(reqId, callback); - int ret = dScreenSourceProxy_->RegisterDistributedHardware(devId, dhId, param, reqId); - return ret; + return dScreenSourceProxy_->RegisterDistributedHardware(devId, dhId, param, reqId); } int32_t DScreenSourceHandler::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, std::shared_ptr callback) { - DHLOGI("UnregisterDistributedHardware, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), - GetAnonyString(dhId).c_str()); + if (devId.empty() || dhId.empty()) { + DHLOGE("device id or dh id empty."); + return ERR_DH_SCREEN_STRING_PARAM_EMPTY; + } if (callback == nullptr) { DHLOGE("callback is nullptr."); return ERR_DH_SCREEN_REGISTER_CALLBACK_NOT_INIT; } + DHLOGI("UnregisterDistributedHardware, devId: %s, dhId: %s", GetAnonyString(devId).c_str(), + GetAnonyString(dhId).c_str()); std::lock_guard lock(proxyMutex_); if (dScreenSourceProxy_ == nullptr) { DHLOGE("screen source proxy not init."); @@ -184,8 +186,7 @@ int32_t DScreenSourceHandler::UnregisterDistributedHardware(const std::string &d std::string reqId = GetRandomID(); dScreenSourceCallback_->PushUnregisterCallback(reqId, callback); - int ret = dScreenSourceProxy_->UnregisterDistributedHardware(devId, dhId, reqId); - return ret; + return dScreenSourceProxy_->UnregisterDistributedHardware(devId, dhId, reqId); } int32_t DScreenSourceHandler::ConfigDistributedHardware(const std::string &devId, @@ -210,10 +211,18 @@ void DScreenSourceHandler::OnRemoteSourceSvrDied(const wptr &remo return; } std::lock_guard lock(proxyMutex_); - if (dScreenSourceProxy_ != nullptr && sourceSvrRecipient_ != nullptr) { - dScreenSourceProxy_->AsObject()->RemoveDeathRecipient(sourceSvrRecipient_); + if (dScreenSourceProxy_ == nullptr || dScreenSourceProxy_->AsObject() == nullptr) { + delete sourceSvrRecipient_; + sourceSvrRecipient_ = nullptr; dScreenSourceProxy_ = nullptr; + return; } + if (sourceSvrRecipient_ == nullptr) { + dScreenSourceProxy_ = nullptr; + return; + } + dScreenSourceProxy_->AsObject()->RemoveDeathRecipient(sourceSvrRecipient_); + dScreenSourceProxy_ = nullptr; } IDistributedHardwareSource *GetSourceHardwareHandler() 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 e0b1dc7e4c94d4c3fb6cdc7a45e59ba22da44e19..37fc7138256331fbbf25caf752e78801c38715ce 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 @@ -28,7 +28,6 @@ namespace OHOS { namespace DistributedHardware { int32_t DScreenSourceProxy::InitSource(const std::string ¶ms, const sptr &callback) { - DHLOGI("DScreenSourceProxy InitSource"); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSourceProxy remote service null"); @@ -55,7 +54,6 @@ int32_t DScreenSourceProxy::InitSource(const std::string ¶ms, const sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSourceProxy remote service null"); @@ -77,8 +75,6 @@ int32_t DScreenSourceProxy::ReleaseSource() int32_t DScreenSourceProxy::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const EnableParam ¶m, const std::string &reqId) { - DHLOGI("DScreenSourceProxy RegisterDistributedHardware devId: %s dhId: %s", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSourceProxy remote service null"); @@ -106,8 +102,6 @@ int32_t DScreenSourceProxy::RegisterDistributedHardware(const std::string &devId int32_t DScreenSourceProxy::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, const std::string &reqId) { - DHLOGI("DScreenSourceProxy UnregisterDistributedHardware devId: %s dhId: %s", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSourceProxy remote service null"); @@ -134,8 +128,6 @@ int32_t DScreenSourceProxy::UnregisterDistributedHardware(const std::string &dev int32_t DScreenSourceProxy::ConfigDistributedHardware(const std::string &devId, const std::string &dhId, const std::string &key, const std::string &value) { - DHLOGI("DScreenSourceProxy ConfigDistributedHardware devId: %s dhId: %s", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSourceProxy remote service null"); @@ -162,8 +154,6 @@ int32_t DScreenSourceProxy::ConfigDistributedHardware(const std::string &devId, void DScreenSourceProxy::DScreenNotify(const std::string &devId, int32_t eventCode, const std::string &eventContent) { - DHLOGI("DScreenNotify devId: %s eventCode: %d eventContent: %s", - GetAnonyString(devId).c_str(), eventCode, eventContent.c_str()); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSourceProxy remote service null"); diff --git a/services/screenservice/sinkservice/dscreenservice/include/dscreen_sink_stub.h b/services/screenservice/sinkservice/dscreenservice/include/dscreen_sink_stub.h index 68f8c47afb0b4a10fdb68a728ae278f28bbb4039..7f13411fbfe8335c07e71e09ba018ae4abee472e 100644 --- a/services/screenservice/sinkservice/dscreenservice/include/dscreen_sink_stub.h +++ b/services/screenservice/sinkservice/dscreenservice/include/dscreen_sink_stub.h @@ -27,7 +27,7 @@ namespace DistributedHardware { class DScreenSinkStub : public IRemoteStub { public: DScreenSinkStub(); - virtual ~DScreenSinkStub(); + virtual ~DScreenSinkStub() = default; virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; private: diff --git a/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_service.cpp b/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_service.cpp index bb888f813548c8e4f5fd888fac4cd0c29eae9a5b..8ff09e7216a3a2a77db3f64db30ef04e058dfaf5 100644 --- a/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_service.cpp +++ b/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_service.cpp @@ -71,6 +71,7 @@ bool DScreenSinkService::Init() int32_t DScreenSinkService::InitSink(const std::string ¶ms) { DHLOGI("InitSink"); + (void)params; return DH_SUCCESS; } @@ -86,12 +87,15 @@ int32_t DScreenSinkService::ReleaseSink() int32_t DScreenSinkService::SubscribeLocalHardware(const std::string &dhId, const std::string ¶m) { DHLOGI("SubscribeLocalHardware"); + (void)dhId; + (void)param; return DH_SUCCESS; } int32_t DScreenSinkService::UnsubscribeLocalHardware(const std::string &dhId) { DHLOGI("UnsubscribeLocalHardware"); + (void)dhId; return DH_SUCCESS; } @@ -105,6 +109,7 @@ void DScreenSinkService::DScreenNotify(const std::string &devId, int32_t eventCo int32_t DScreenSinkService::Dump(int32_t fd, const std::vector& args) { DHLOGI("DScreenSinkService Dump."); + (void)args; std::string result; ScreenRegionManager::GetInstance().GetScreenDumpInfo(result); int ret = dprintf(fd, "%s\n", result.c_str()); diff --git a/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_stub.cpp b/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_stub.cpp index 5ca32cd51d4113566e8d08bc6f7f539de478e048..e735fac05f0f561c486a93ee3599b9d9f84e2f72 100644 --- a/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_stub.cpp +++ b/services/screenservice/sinkservice/dscreenservice/src/dscreen_sink_stub.cpp @@ -23,7 +23,6 @@ namespace OHOS { namespace DistributedHardware { DScreenSinkStub::DScreenSinkStub() { - DHLOGI("DScreenSinkStub construct."); memberFuncMap_[INIT_SINK] = &DScreenSinkStub::InitSinkInner; memberFuncMap_[RELEASE_SINK] = &DScreenSinkStub::ReleaseSinkInner; memberFuncMap_[SUBSCRIBE_DISTRIBUTED_HARDWARE] = &DScreenSinkStub::SubscribeDistributedHardwareInner; @@ -31,15 +30,9 @@ DScreenSinkStub::DScreenSinkStub() memberFuncMap_[DSCREEN_NOTIFY] = &DScreenSinkStub::DScreenNotifyInner; } -DScreenSinkStub::~DScreenSinkStub() -{ - DHLOGI("DScreenSinkStub deconstruct."); -} - int32_t DScreenSinkStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("OnRemoteRequest, code: %d", code); std::u16string desc = DScreenSinkStub::GetDescriptor(); std::u16string remoteDesc = data.ReadInterfaceToken(); if (desc != remoteDesc) { @@ -59,7 +52,6 @@ int32_t DScreenSinkStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Mes int32_t DScreenSinkStub::InitSinkInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("InitSinkInner"); std::string param = data.ReadString(); int32_t ret = InitSink(param); reply.WriteInt32(ret); @@ -69,7 +61,6 @@ int32_t DScreenSinkStub::InitSinkInner(MessageParcel &data, MessageParcel &reply int32_t DScreenSinkStub::ReleaseSinkInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("ReleaseSinkInner"); int32_t ret = ReleaseSink(); reply.WriteInt32(ret); return DH_SUCCESS; @@ -78,7 +69,6 @@ int32_t DScreenSinkStub::ReleaseSinkInner(MessageParcel &data, MessageParcel &re int32_t DScreenSinkStub::SubscribeDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("SubscribeDistributedHardwareInner"); std::string dhId = data.ReadString(); std::string param = data.ReadString(); int32_t ret = SubscribeLocalHardware(dhId, param); @@ -89,7 +79,6 @@ int32_t DScreenSinkStub::SubscribeDistributedHardwareInner(MessageParcel &data, int32_t DScreenSinkStub::UnsubscribeDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("UnsubscribeDistributedHardwareInner"); std::string dhId = data.ReadString(); int32_t ret = UnsubscribeLocalHardware(dhId); reply.WriteInt32(ret); @@ -99,7 +88,6 @@ int32_t DScreenSinkStub::UnsubscribeDistributedHardwareInner(MessageParcel &data int32_t DScreenSinkStub::DScreenNotifyInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("DScreenNotifyInner"); std::string devId = data.ReadString(); int32_t eventCode = data.ReadInt32(); std::string eventContent = data.ReadString(); diff --git a/services/screenservice/sourceservice/dscreenmgr/include/dscreen.h b/services/screenservice/sourceservice/dscreenmgr/include/dscreen.h index 3729dd6fba59ad44f5b89a04e5e03bb02a2965b2..90a394bf5991245dbd9ff0368a70b63630de785b 100644 --- a/services/screenservice/sourceservice/dscreenmgr/include/dscreen.h +++ b/services/screenservice/sourceservice/dscreenmgr/include/dscreen.h @@ -33,9 +33,9 @@ class IDScreenCallback { public: virtual ~IDScreenCallback() {}; virtual void OnRegResult(const std::shared_ptr &dScreen, - const std::string &reqId, int32_t status, const std::string &data) = 0; + const std::string &reqId, const int32_t status, const std::string &data) = 0; virtual void OnUnregResult(const std::shared_ptr &dScreen, - const std::string &reqId, int32_t status, const std::string &data) = 0; + const std::string &reqId, const int32_t status, const std::string &data) = 0; }; class ScreenSourceTransCallback : public IScreenSourceTransCallback { diff --git a/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h b/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h index 0e58de3cf9109cf18ca32d8f49684359bbccd6b4..df5589542c24cdb18fa37d166c4b9a8cb64eea9e 100644 --- a/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h +++ b/services/screenservice/sourceservice/dscreenmgr/include/dscreen_manager.h @@ -32,9 +32,9 @@ namespace DistributedHardware { class DScreenCallback : public IDScreenCallback { public: void OnRegResult(const std::shared_ptr &dScreen, const std::string &reqId, - int32_t status, const std::string &data) override; + const int32_t status, const std::string &data) override; void OnUnregResult(const std::shared_ptr &dScreen, const std::string &reqId, - int32_t status, const std::string &data) override; + const int32_t status, const std::string &data) override; }; class DScreenGroupListener : public Rosen::ScreenManager::IScreenGroupListener { @@ -46,9 +46,9 @@ class DScreenManager { DECLARE_SINGLE_INSTANCE_BASE(DScreenManager); public: void OnRegResult(const std::shared_ptr &dScreen, const std::string &reqId, - int32_t status, const std::string &data); + const int32_t status, const std::string &data); void OnUnregResult(const std::shared_ptr &dScreen, const std::string &reqId, - int32_t status, const std::string &data); + const int32_t status, const std::string &data); int32_t Init(); int32_t UnInit(); @@ -59,8 +59,8 @@ public: void RegisterDScreenCallback(const sptr &callback); void HandleScreenChange(const std::shared_ptr &changedScreen, Rosen::ScreenGroupChangeEvent event); std::shared_ptr FindDScreenByScreenId(uint64_t screenId); - void AddToGroup(const std::shared_ptr &changedScreen, uint64_t screenId); - void RemoveFromGroup(const std::shared_ptr &changedScreen, uint64_t screenId); + int32_t AddToGroup(const std::shared_ptr &changedScreen, uint64_t screenId); + int32_t RemoveFromGroup(const std::shared_ptr &changedScreen, uint64_t screenId); void GetScreenDumpInfo(std::string &result); void PublishMessage(const DHTopic topic, const std::shared_ptr &dScreen); private: diff --git a/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp b/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp index e5dfbe528d9393432d87b84854a6e2ed100b8310..c3e4d3db93988fb565e997d51cb7dabd41b6fd44 100644 --- a/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/src/dscreen_manager.cpp @@ -60,26 +60,26 @@ int32_t DScreenManager::Init() DHLOGI("DScreenManager::Init"); if (dScreenGroupListener_ == nullptr) { dScreenGroupListener_ = new (std::nothrow) DScreenGroupListener(); + int32_t ret = ScreenMgrAdapter::GetInstance().RegisterScreenGroupListener(dScreenGroupListener_); + if (ret != DH_SUCCESS) { + DHLOGE("DScreenManager Init failed, err: %d", ret); + delete dScreenGroupListener_; + dScreenGroupListener_ = nullptr; + return ret; + } } - int32_t ret = ScreenMgrAdapter::GetInstance().RegisterScreenGroupListener(dScreenGroupListener_); - if (ret != DH_SUCCESS) { - DHLOGE("DScreenManager Init failed, err: %d", ret); - } + if (dScreenCallback_ == nullptr) { dScreenCallback_ = std::make_shared(); } - return ret; + return DH_SUCCESS; } int32_t DScreenManager::UnInit() { DHLOGI("DScreenManager::UnInit"); - int32_t ret = DH_SUCCESS; - if (dScreenGroupListener_ != nullptr) { - ret = ScreenMgrAdapter::GetInstance().UnregisterScreenGroupListener(dScreenGroupListener_); - } - + int32_t ret = ScreenMgrAdapter::GetInstance().UnregisterScreenGroupListener(dScreenGroupListener_); if (ret != DH_SUCCESS) { DHLOGE("DScreenManager UnInit failed, err: %d", ret); } @@ -103,8 +103,7 @@ void DScreenGroupListener::OnChange(const std::vector &screenIds, Rose { DHLOGI("On Screen change, screenIds size: %d", screenIds.size()); for (uint64_t screenId : screenIds) { - std::shared_ptr changedScreen = nullptr; - changedScreen = DScreenManager::GetInstance().FindDScreenByScreenId(screenId); + std::shared_ptr changedScreen = DScreenManager::GetInstance().FindDScreenByScreenId(screenId); if (changedScreen == nullptr) { DHLOGD("screen change not about remote screen, screenId: %ulld", screenId); continue; @@ -124,11 +123,16 @@ void DScreenManager::HandleScreenChange(const std::shared_ptr &changedS uint64_t screenId = changedScreen->GetScreenId(); DHLOGI("DScreenManager::HandleScreenChange, screenId: %ulld, changeEvent: %", screenId, event); if (event == Rosen::ScreenGroupChangeEvent::ADD_TO_GROUP) { - AddToGroup(changedScreen, screenId); + if (DH_SUCCESS != AddToGroup(changedScreen, screenId)) { + DHLOGE("AddToGroup failed."); + return; + } NotifyRemoteSinkSetUp(changedScreen); PublishMessage(DHTopic::TOPIC_START_DSCREEN, changedScreen); } else if (event == Rosen::ScreenGroupChangeEvent::REMOVE_FROM_GROUP) { - RemoveFromGroup(changedScreen, screenId); + if (DH_SUCCESS != RemoveFromGroup(changedScreen, screenId)) { + DHLOGE("RemoveFromGroup failed."); + } PublishMessage(DHTopic::TOPIC_STOP_DSCREEN, changedScreen); } else if (event == Rosen::ScreenGroupChangeEvent::CHANGE_GROUP) { DHLOGE("CHANGE_GROUP not implement."); @@ -137,22 +141,22 @@ void DScreenManager::HandleScreenChange(const std::shared_ptr &changedS } } -void DScreenManager::AddToGroup(const std::shared_ptr &changedScreen, uint64_t screenId) +int32_t DScreenManager::AddToGroup(const std::shared_ptr &changedScreen, uint64_t screenId) { DHLOGI("DScreenManager::ADDToGroup, screenId: %ulld", screenId); if (changedScreen == nullptr) { DHLOGE("DScreenManager::ADDToGroup, dScreen is null."); - return; + return ERR_DH_SCREEN_SA_VALUE_NOT_INIT; } if (changedScreen->GetState() == CONNECTING) { DHLOGD("screen is connecting, no need handle change"); - return; + return DH_SUCCESS; } std::shared_ptr mapRelation = ScreenMgrAdapter::GetInstance().GetMapRelation(screenId); if (mapRelation == nullptr) { DHLOGE("mapRelation construct failed. screenId: %ulld", screenId); - return; + return ERR_DH_SCREEN_SA_VALUE_NOT_INIT; } std::shared_ptr videoParam = changedScreen->GetVideoParam(); @@ -165,35 +169,32 @@ void DScreenManager::AddToGroup(const std::shared_ptr &changedScreen, u std::lock_guard lock(dScreenMapRelationMtx_); mapRelations_[screenId] = mapRelation; } + return DH_SUCCESS; } -void DScreenManager::RemoveFromGroup(const std::shared_ptr &changedScreen, uint64_t screenId) +int32_t DScreenManager::RemoveFromGroup(const std::shared_ptr &changedScreen, uint64_t screenId) { DHLOGI("DScreenManager::RemoveFromGroup, screenId: %ulld", screenId); if (changedScreen == nullptr) { DHLOGE("DScreenManager::RemoveFromGroup, dScreen is null."); - return; + return ERR_DH_SCREEN_SA_VALUE_NOT_INIT; } if (changedScreen->GetState() == DISCONNECTING) { DHLOGD("screen is disconnecting, no need handle change"); - return; + return DH_SUCCESS; } std::shared_ptr mapRelation = nullptr; { std::lock_guard lock(dScreenMapRelationMtx_); - if (mapRelations_.count(screenId) == 0) { - DHLOGE("destroyed relation not found."); - return; - } - mapRelation = mapRelations_[screenId]; mapRelations_.erase(screenId); } changedScreen->AddTask(std::make_shared(TaskType::TASK_DISCONNECT, "")); + return DH_SUCCESS; } void DScreenCallback::OnRegResult(const std::shared_ptr &dScreen, - const std::string &reqId, int32_t status, const std::string &data) + const std::string &reqId, const int32_t status, const std::string &data) { DHLOGI("DScreenCallback::OnRegResult, devId: %s, dhId: %s, reqId: %s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), reqId.c_str()); @@ -201,7 +202,7 @@ void DScreenCallback::OnRegResult(const std::shared_ptr &dScreen, } void DScreenCallback::OnUnregResult(const std::shared_ptr &dScreen, - const std::string &reqId, int32_t status, const std::string &data) + const std::string &reqId, const int32_t status, const std::string &data) { DHLOGI("DScreenCallback::OnUnregResult, devId: %s, dhId: %s, reqId: %s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), reqId.c_str()); @@ -209,7 +210,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) + const std::string &reqId, const int32_t status, const std::string &data) { DHLOGI("DScreenManager::OnRegResult, devId: %s, dhId: %s, reqId: %s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), reqId.c_str()); @@ -221,7 +222,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) + const std::string &reqId, const int32_t status, const std::string &data) { DHLOGI("DScreenManager::OnUnregResult, devId: %s, dhId: %s, reqId: %s", GetAnonyString(dScreen->GetDevId()).c_str(), GetAnonyString(dScreen->GetDHId()).c_str(), reqId.c_str()); @@ -243,19 +244,15 @@ int32_t DScreenManager::EnableDistributedScreen(const std::string &devId, const } std::string dScreenIdx = devId + SEPERATOR + dhId; - std::shared_ptr dScreen = nullptr; std::lock_guard lock(dScreenMapMtx_); - if (dScreens_.count(dScreenIdx) != 0) { - dScreen = dScreens_[dScreenIdx]; - } - + std::shared_ptr dScreen = dScreens_[dScreenIdx]; if (dScreen == nullptr) { dScreen = std::make_shared(devId, dhId, dScreenCallback_); } int32_t dScreenState = dScreen->GetState(); - if (dScreenState != DISABLED && dScreenState != DISABLING) { - DHLOGE("dScreen state is invalid."); + if (dScreenState == ENABLED || dScreenState == ENABLING) { + DHLOGE("dScreen state is ENABLED or ENABLING."); return ERR_DH_SCREEN_SA_ENABLE_FAILED; } diff --git a/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_stub.h b/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_stub.h index 59c4fd9e03c3f4f81aae78c755454cd524822705..9ed200600a6cbba8329e08840c258e9654c5de1d 100644 --- a/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_stub.h +++ b/services/screenservice/sourceservice/dscreenservice/include/dscreen_source_stub.h @@ -25,7 +25,7 @@ namespace DistributedHardware { class DScreenSourceStub : public IRemoteStub { public: DScreenSourceStub(); - virtual ~DScreenSourceStub(); + virtual ~DScreenSourceStub() = default; virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/services/screenservice/sourceservice/dscreenservice/src/callback/dscreen_source_callback_proxy.cpp b/services/screenservice/sourceservice/dscreenservice/src/callback/dscreen_source_callback_proxy.cpp index 574988e0fc1f31352421bbf5c4b68f695f3324c4..508a0bbf148601974c2a338f712dc15e7ee94564 100644 --- a/services/screenservice/sourceservice/dscreenservice/src/callback/dscreen_source_callback_proxy.cpp +++ b/services/screenservice/sourceservice/dscreenservice/src/callback/dscreen_source_callback_proxy.cpp @@ -26,8 +26,6 @@ namespace DistributedHardware { int32_t DScreenSourceCallbackProxy::OnNotifyRegResult(const std::string &devId, const std::string &dhId, const std::string &reqId, int32_t status, const std::string &resultData) { - DHLOGD("OnNotifyRegResult, devId: %s, dhId: %s, reqId: %s, status: %d", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), reqId.c_str(), status); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSourceCallbackProxy remote service null"); @@ -55,8 +53,6 @@ int32_t DScreenSourceCallbackProxy::OnNotifyRegResult(const std::string &devId, int32_t DScreenSourceCallbackProxy::OnNotifyUnregResult(const std::string &devId, const std::string &dhId, const std::string &reqId, int32_t status, const std::string &resultData) { - DHLOGD("OnNotifyUnregResult, devId: %s, dhId: %s, reqId: %s, status: %d", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), reqId.c_str(), status); sptr remote = Remote(); if (remote == nullptr) { DHLOGE("DScreenSourceCallbackProxy remote service null"); diff --git a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp index 5461367099b4db87fc85d12f38bfad3ad12a4333..58278abe90dd3ae32cd3a7fcf6d9ab739d55fa40 100644 --- a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp +++ b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_service.cpp @@ -103,11 +103,8 @@ int32_t DScreenSourceService::ReleaseSource() int32_t DScreenSourceService::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const EnableParam ¶m, const std::string &reqId) { - DHLOGI("RegisterDistributedHardware"); std::string version = param.version; std::string attrs = param.attrs; - DHLOGD("enable distributedScreen. devId: %s, dhId: %s, reqId: %s, attrs: %s, version: %s", - GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), reqId.c_str(), attrs.c_str(), version.c_str()); int ret = DScreenManager::GetInstance().EnableDistributedScreen(devId, dhId, attrs, reqId); if (ret != DH_SUCCESS) { DHLOGE("enable distributedScreen failed. devId: %s, dhId: %s, reqId: %s, attrs: %s", @@ -122,7 +119,6 @@ int32_t DScreenSourceService::RegisterDistributedHardware(const std::string &dev int32_t DScreenSourceService::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, const std::string &reqId) { - DHLOGI("UnregisterDistributedHardware"); int ret = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); if (ret != DH_SUCCESS) { DHLOGE("disable distributedScreen failed. devId: %s, dhId: %s, reqId: %s", @@ -137,7 +133,10 @@ int32_t DScreenSourceService::UnregisterDistributedHardware(const std::string &d int32_t DScreenSourceService::ConfigDistributedHardware(const std::string &devId, const std::string &dhId, const std::string &key, const std::string &value) { - DHLOGI("ConfigDistributedHardware"); + (void)devId; + (void)dhId; + (void)key; + (void)value; return DH_SUCCESS; } @@ -151,6 +150,7 @@ void DScreenSourceService::DScreenNotify(const std::string &devId, const int32_t int32_t DScreenSourceService::Dump(int32_t fd, const std::vector& args) { DHLOGI("DScreenSourceService Dump."); + (void)args; std::string result; DScreenManager::GetInstance().GetScreenDumpInfo(result); int ret = dprintf(fd, "%s\n", result.c_str()); diff --git a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_stub.cpp b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_stub.cpp index bb03193cf419c94a5c8740d947d03414d2e244b5..d15449bf8206b4f65f97ff899b0160bcda8c69f4 100644 --- a/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_stub.cpp +++ b/services/screenservice/sourceservice/dscreenservice/src/dscreen_source_stub.cpp @@ -26,7 +26,6 @@ namespace OHOS { namespace DistributedHardware { DScreenSourceStub::DScreenSourceStub() { - DHLOGI("DScreenSourceStub construct."); memberFuncMap_[INIT_SOURCE] = &DScreenSourceStub::InitSourceInner; memberFuncMap_[RELEASE_SOURCE] = &DScreenSourceStub::ReleaseSourceInner; memberFuncMap_[REGISTER_DISTRIBUTED_HARDWARE] = &DScreenSourceStub::RegisterDistributedHardwareInner; @@ -35,15 +34,9 @@ DScreenSourceStub::DScreenSourceStub() memberFuncMap_[DSCREEN_NOTIFY] = &DScreenSourceStub::DScreenNotifyInner; } -DScreenSourceStub::~DScreenSourceStub() -{ - DHLOGI("DScreenSourceStub deconstruct."); -} - int32_t DScreenSourceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("OnRemoteRequest, code: %d", code); std::u16string desc = DScreenSourceStub::GetDescriptor(); std::u16string remoteDesc = data.ReadInterfaceToken(); if (desc != remoteDesc) { @@ -63,7 +56,6 @@ int32_t DScreenSourceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M int32_t DScreenSourceStub::InitSourceInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("InitSourceInner"); std::string param = data.ReadString(); sptr remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { @@ -80,7 +72,6 @@ int32_t DScreenSourceStub::InitSourceInner(MessageParcel &data, MessageParcel &r int32_t DScreenSourceStub::ReleaseSourceInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("ReleaseSourceInner"); int32_t ret = ReleaseSource(); reply.WriteInt32(ret); return DH_SUCCESS; @@ -89,7 +80,6 @@ int32_t DScreenSourceStub::ReleaseSourceInner(MessageParcel &data, MessageParcel int32_t DScreenSourceStub::RegisterDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("RegisterDistributedHardwareInner"); std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string version = data.ReadString(); @@ -107,7 +97,6 @@ int32_t DScreenSourceStub::RegisterDistributedHardwareInner(MessageParcel &data, int32_t DScreenSourceStub::UnregisterDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("UnregisterDistributedHardwareInner"); std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string reqId = data.ReadString(); @@ -120,7 +109,6 @@ int32_t DScreenSourceStub::UnregisterDistributedHardwareInner(MessageParcel &dat int32_t DScreenSourceStub::ConfigDistributedHardwareInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("ConfigDistributedHardwareInner"); std::string devId = data.ReadString(); std::string dhId = data.ReadString(); std::string key = data.ReadString(); @@ -134,7 +122,6 @@ int32_t DScreenSourceStub::ConfigDistributedHardwareInner(MessageParcel &data, M int32_t DScreenSourceStub::DScreenNotifyInner(MessageParcel &data, MessageParcel &reply, MessageOption &option) { - DHLOGI("DScreenNotifyInner"); std::string devId = data.ReadString(); int32_t eventCode = data.ReadInt32(); std::string eventContent = data.ReadString();