diff options
author | Ilho Kim <ilho159.kim@samsung.com> | 2024-04-11 15:33:43 +0900 |
---|---|---|
committer | Ilho Kim <ilho159.kim@samsung.com> | 2024-04-11 17:47:15 +0900 |
commit | 7d57137fda1d6a53d250447a47eb093d9c45e9d0 (patch) | |
tree | 4af1b5845de1cbf53e7947442586139452b52733 | |
parent | c1348d08716fd65a7fee556ec8fd86626db23d31 (diff) | |
download | slp-pkgmgr-7d57137fda1d6a53d250447a47eb093d9c45e9d0.tar.gz slp-pkgmgr-7d57137fda1d6a53d250447a47eb093d9c45e9d0.tar.bz2 slp-pkgmgr-7d57137fda1d6a53d250447a47eb093d9c45e9d0.zip |
Listen signal before connecting to the server
Listening signal can take a long time
Change-Id: Ib84d991dc44328aecfd4b7855d2443b0f66c88b5
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
-rw-r--r-- | client/src/api_stub.cc | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/client/src/api_stub.cc b/client/src/api_stub.cc index ff31413..f875642 100644 --- a/client/src/api_stub.cc +++ b/client/src/api_stub.cc @@ -209,6 +209,7 @@ API int pkgmgr_client_usr_install_packages(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; @@ -218,7 +219,6 @@ API int pkgmgr_client_usr_install_packages(pkgmgr_client *pc, for (int i = 0; i < n_pkgs; i++) pkgs.push_back(pkg_paths[i]); - const auto& receiver = con->GetSignalReceiver(); int ret = proxy->InstallPkgs(uid, pkgs, con->GetArgv(), con->GenerateRequestId(), req_key); if (ret != PKGMGR_R_OK) @@ -271,11 +271,11 @@ API int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type, con->SetTepArgs(); } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->Install(uid, pkg_type ? pkg_type : "", pkg_path, con->GetArgv(), con->GenerateRequestId(), req_key); @@ -306,11 +306,11 @@ API int pkgmgr_client_usr_reinstall(pkgmgr_client *pc, const char *pkg_type, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->Reinstall(uid, pkgid, req_key); if (ret != PKGMGR_R_OK) @@ -340,6 +340,7 @@ API int pkgmgr_client_usr_uninstall_packages(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; @@ -349,7 +350,6 @@ API int pkgmgr_client_usr_uninstall_packages(pkgmgr_client *pc, for (int i = 0; i < n_pkgs; i++) pkgs.push_back(pkgids[i]); - const auto& receiver = con->GetSignalReceiver(); int ret = proxy->UninstallPkgs(uid, pkgs, req_key); if (ret != PKGMGR_R_OK) return ret; @@ -378,11 +378,11 @@ API int pkgmgr_client_usr_uninstall(pkgmgr_client *pc, const char *pkg_type, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->Uninstall(uid, pkgid, req_key); if (ret != PKGMGR_R_OK) @@ -428,6 +428,7 @@ API int pkgmgr_client_usr_mount_install_packages(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; @@ -443,7 +444,6 @@ API int pkgmgr_client_usr_mount_install_packages(pkgmgr_client *pc, pkgs.push_back(pkg_paths[i]); } - const auto& receiver = con->GetSignalReceiver(); int ret = proxy->MountInstallPkgs(uid, pkgs, con->GenerateRequestId(), req_key); if (ret != PKGMGR_R_OK) @@ -497,11 +497,11 @@ API int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type, con->SetTepArgs(); } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->MountInstall(uid, pkg_type ? pkg_type : "", pkg_path, con->GetArgv(), con->GenerateRequestId(), req_key); @@ -536,11 +536,11 @@ API int pkgmgr_client_usr_move(pkgmgr_client *pc, const char *pkg_type, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->Move(uid, pkgid, move_type, req_key); if (ret != PKGMGR_R_OK) @@ -676,6 +676,7 @@ API int pkgmgr_client_usr_activate_packages(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; @@ -686,7 +687,6 @@ API int pkgmgr_client_usr_activate_packages(pkgmgr_client *pc, vec.push_back(pkgids[i]); } - const auto& receiver = con->GetSignalReceiver(); int ret = proxy->EnablePkgs(uid, std::move(vec), req_key); if (ret != PKGMGR_R_OK) return ret; @@ -736,6 +736,7 @@ API int pkgmgr_client_usr_deactivate_packages(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; @@ -745,7 +746,6 @@ API int pkgmgr_client_usr_deactivate_packages(pkgmgr_client *pc, for (int i = 0; i < n_pkgs; i++) { vec.push_back(pkgids[i]); } - const auto& receiver = con->GetSignalReceiver(); int ret = proxy->DisablePkgs(uid, std::move(vec), req_key); if (ret != PKGMGR_R_OK) return ret; @@ -768,11 +768,16 @@ API int pkgmgr_client_usr_activate_app(pkgmgr_client *pc, const char *appid, } auto* con = static_cast<Connector*>(pc); + if (con->GetPcType() != PC_REQUEST) { + _E("client type is not PC_REQUEST"); + return PKGMGR_R_EINVAL; + } + + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->EnableApp(uid, appid, req_key); if (ret != PKGMGR_R_OK) @@ -800,6 +805,7 @@ API int pkgmgr_client_usr_activate_apps(pkgmgr_client *pc, const char **appids, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; @@ -810,7 +816,6 @@ API int pkgmgr_client_usr_activate_apps(pkgmgr_client *pc, const char **appids, vec.push_back(appids[i]); } - const auto& receiver = con->GetSignalReceiver(); int ret = proxy->EnableApps(uid, std::move(vec), req_key); if (ret != PKGMGR_R_OK) return ret; @@ -832,11 +837,16 @@ API int pkgmgr_client_activate_global_app_for_uid(pkgmgr_client *pc, } auto* con = static_cast<Connector*>(pc); + if (con->GetPcType() != PC_REQUEST) { + _E("client type is not PC_REQUEST"); + return PKGMGR_R_EINVAL; + } + + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->EnableGlobalAppForUid(uid, appid, req_key); if (ret != PKGMGR_R_OK) @@ -853,11 +863,16 @@ API int pkgmgr_client_usr_deactivate_app(pkgmgr_client *pc, const char *appid, } auto* con = static_cast<Connector*>(pc); + if (con->GetPcType() != PC_REQUEST) { + _E("client type is not PC_REQUEST"); + return PKGMGR_R_EINVAL; + } + + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->DisableApp(uid, appid, req_key); if (ret != PKGMGR_R_OK) @@ -886,6 +901,7 @@ API int pkgmgr_client_usr_deactivate_apps(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; @@ -896,7 +912,6 @@ API int pkgmgr_client_usr_deactivate_apps(pkgmgr_client *pc, vec.push_back(appids[i]); } - const auto& receiver = con->GetSignalReceiver(); int ret = proxy->DisableApps(uid, std::move(vec), req_key); if (ret != PKGMGR_R_OK) return ret; @@ -918,11 +933,16 @@ API int pkgmgr_client_deactivate_global_app_for_uid(pkgmgr_client *pc, } auto* con = static_cast<Connector*>(pc); + if (con->GetPcType() != PC_REQUEST) { + _E("client type is not PC_REQUEST"); + return PKGMGR_R_EINVAL; + } + + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->DisableGlobalAppForUid(uid, appid, req_key); if (ret != PKGMGR_R_OK) @@ -1160,11 +1180,11 @@ API int pkgmgr_client_usr_get_size(pkgmgr_client *pc, const char *pkgid, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetInfoProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->GetSize(uid, pkgid, get_type, req_key); if (ret != PKGMGR_R_OK) @@ -1215,11 +1235,11 @@ API int pkgmgr_client_usr_get_package_size_info(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetInfoProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->GetSize(uid, pkgid, get_type, req_key); if (ret != PKGMGR_R_OK) @@ -1619,11 +1639,16 @@ API int pkgmgr_client_res_copy(pkgmgr_client *pc, } auto* con = static_cast<Connector*>(pc); + if (con->GetPcType() != PC_REQUEST) { + _E("client type is not PC_REQUEST"); + return PKGMGR_R_EINVAL; + } + + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->ResCopy(con->GetResCopyPath(), req_key); @@ -1654,11 +1679,16 @@ API int pkgmgr_client_res_create_dir(pkgmgr_client *pc, } auto* con = static_cast<Connector*>(pc); + if (con->GetPcType() != PC_REQUEST) { + _E("client type is not PC_REQUEST"); + return PKGMGR_R_EINVAL; + } + + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->ResCreateDir(con->GetResCreateDir(), req_key); @@ -1689,11 +1719,16 @@ API int pkgmgr_client_res_remove(pkgmgr_client *pc, } auto* con = static_cast<Connector*>(pc); + if (con->GetPcType() != PC_REQUEST) { + _E("client type is not PC_REQUEST"); + return PKGMGR_R_EINVAL; + } + + const auto& receiver = con->GetSignalReceiver(); auto* proxy = con->GetAdminProxy(); if (proxy == nullptr) return PKGMGR_R_EIO; - const auto& receiver = con->GetSignalReceiver(); std::string req_key; int ret = proxy->ResRemove(con->GetResRemovePath(), req_key); |