diff options
author | Ilho Kim <ilho159.kim@samsung.com> | 2024-04-16 10:23:36 +0900 |
---|---|---|
committer | Ilho Kim <ilho159.kim@samsung.com> | 2024-04-16 12:02:34 +0900 |
commit | dfbb16d632fdd67ac49f34d8792ae770cfbe305d (patch) | |
tree | 265ff55782a5352b16134da4efce17ee9a88f8dc | |
parent | b0baac7866dd1489e9ed2071f13c57a8f55f5433 (diff) | |
download | slp-pkgmgr-dfbb16d632fdd67ac49f34d8792ae770cfbe305d.tar.gz slp-pkgmgr-dfbb16d632fdd67ac49f34d8792ae770cfbe305d.tar.bz2 slp-pkgmgr-dfbb16d632fdd67ac49f34d8792ae770cfbe305d.zip |
Impelement pkgmgr_client_remove_listen_status
Change-Id: Iaced471eb6c22a5f64a95d1708b48368724899e0
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
-rw-r--r-- | client/src/api_stub.cc | 16 | ||||
-rw-r--r-- | client/src/signal_receiver.cc | 11 | ||||
-rw-r--r-- | client/src/signal_receiver.hh | 1 |
3 files changed, 26 insertions, 2 deletions
diff --git a/client/src/api_stub.cc b/client/src/api_stub.cc index b60ae41..20dc44d 100644 --- a/client/src/api_stub.cc +++ b/client/src/api_stub.cc @@ -1215,8 +1215,20 @@ API int pkgmgr_client_listen_app_status(pkgmgr_client *pc, } API int pkgmgr_client_remove_listen_status(pkgmgr_client *pc) { - //TODO - return PKGMGR_R_OK; + if (pc == nullptr) { + _E("invalid parameter"); + return PKGMGR_R_EINVAL; + } + + auto* con = static_cast<Connector*>(pc); + try { + const auto& receiver = con->GetSignalReceiver(); + receiver->RemoveEventHandler(); + return PKGMGR_R_OK; + } catch (...) { + _E("Exception occured"); + return PKGMGR_R_ERROR; + } } API int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type, diff --git a/client/src/signal_receiver.cc b/client/src/signal_receiver.cc index b4761f0..fc669e8 100644 --- a/client/src/signal_receiver.cc +++ b/client/src/signal_receiver.cc @@ -257,6 +257,17 @@ void SignalReceiver::SetStatusType(int status_type) { } +void SignalReceiver::RemoveEventHandler() { + handlers_.clear(); + global_handlers_.clear(); + res_handlers_.clear(); + global_res_handlers_.clear(); + size_info_handlers_.clear(); + global_size_info_handlers_.clear(); + global_pkg_upgrade_handlers_.clear(); +} + + int SignalReceiver::GetRequestId() { return ++request_id_; } diff --git a/client/src/signal_receiver.hh b/client/src/signal_receiver.hh index 18a4572..65db908 100644 --- a/client/src/signal_receiver.hh +++ b/client/src/signal_receiver.hh @@ -58,6 +58,7 @@ class SignalReceiver : public pkg_group::PkgSignal { void* data); int AddEventHandler(pkgmgr_pkg_upgrade_handler event_cb, void* data); void SetStatusType(int status_type); + void RemoveEventHandler(); private: static int GetRequestId(); |