return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetDelayedResultProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- int retry_cnt = 0;
- int ret = 0;
- do {
- if (proxy->GetResult(req_key, ret) == PKGMGR_R_OK)
- return ret;
+ try {
+ auto* proxy = con->GetDelayedResultProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ int retry_cnt = 0;
+ int ret = 0;
+ do {
+ if (proxy->GetResult(req_key, ret) == PKGMGR_R_OK)
+ return ret;
- _E("Failed to get result sleep and retry[%d/%d]",
- retry_cnt, CONNECTION_RETRY_MAX);
- usleep(CONNECTION_WAIT_USEC);
- retry_cnt++;
- } while (retry_cnt <= CONNECTION_RETRY_MAX);
+ _E("Failed to get result sleep and retry[%d/%d]",
+ retry_cnt, CONNECTION_RETRY_MAX);
+ usleep(CONNECTION_WAIT_USEC);
+ retry_cnt++;
+ } while (retry_cnt <= CONNECTION_RETRY_MAX);
- _E("Failed to get result");
- return PKGMGR_R_ERROR;
+ _E("Failed to get result");
+ return PKGMGR_R_ERROR;
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
static int ResultGetSizeSync(pkgmgr_client *pc, const std::string& req_key) {
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetInfoProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- int retry_cnt = 0;
- int ret = PKGMGR_R_ECOMM;
- long long size_info = 0;
- do {
- if (proxy->GetSizeSyncResult(req_key, ret, size_info) == PKGMGR_R_OK) {
- if (ret != PKGMGR_R_OK) {
- _E("request result failed: %d", ret);
- return ret;
- }
-
- if (size_info < 0) {
- _E("invalid size_info=(%lld)", size_info);
- return -1;
+ try {
+ auto* proxy = con->GetInfoProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ int retry_cnt = 0;
+ int ret = PKGMGR_R_ECOMM;
+ long long size_info = 0;
+ do {
+ if (proxy->GetSizeSyncResult(req_key, ret, size_info) == PKGMGR_R_OK) {
+ if (ret != PKGMGR_R_OK) {
+ _E("request result failed: %d", ret);
+ return ret;
+ }
+
+ if (size_info < 0) {
+ _E("invalid size_info=(%lld)", size_info);
+ return -1;
+ }
+
+ _D("size_info(%lld), return size(%d)", size_info, ret);
+ return size_info;
}
- _D("size_info(%lld), return size(%d)", size_info, ret);
- return size_info;
- }
+ _E("Failed to get result sleep and retry[%d/%d]",
+ retry_cnt, CONNECTION_RETRY_MAX);
+ usleep(CONNECTION_WAIT_USEC);
+ retry_cnt++;
+ } while (retry_cnt <= CONNECTION_RETRY_MAX);
- _E("Failed to get result sleep and retry[%d/%d]",
- retry_cnt, CONNECTION_RETRY_MAX);
- usleep(CONNECTION_WAIT_USEC);
- retry_cnt++;
- } while (retry_cnt <= CONNECTION_RETRY_MAX);
-
- _E("Failed to get result");
- return ret;
+ _E("Failed to get result");
+ return ret;
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
static int GetGenerateLicenseResult(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- int retry_cnt = 0;
- int ret = PKGMGR_R_ECOMM;
- do {
- if (proxy->GetGenerateLicenseResult(req_key,
- ret, reqData, licenseUrl) == PKGMGR_R_OK)
- return ret;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ int retry_cnt = 0;
+ int ret = PKGMGR_R_ECOMM;
+ do {
+ if (proxy->GetGenerateLicenseResult(req_key,
+ ret, reqData, licenseUrl) == PKGMGR_R_OK)
+ return ret;
- _E("Failed to get result sleep and retry[%d/%d]",
- retry_cnt, CONNECTION_RETRY_MAX);
- usleep(CONNECTION_WAIT_USEC);
- retry_cnt++;
- } while (retry_cnt <= CONNECTION_RETRY_MAX);
+ _E("Failed to get result sleep and retry[%d/%d]",
+ retry_cnt, CONNECTION_RETRY_MAX);
+ usleep(CONNECTION_WAIT_USEC);
+ retry_cnt++;
+ } while (retry_cnt <= CONNECTION_RETRY_MAX);
- _E("Failed to get result");
- return ret;
+ _E("Failed to get result");
+ return ret;
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
static inline uid_t GetUid() {
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- std::string req_key;
- std::vector<std::string> pkgs;
- for (int i = 0; i < n_pkgs; i++)
- pkgs.push_back(pkg_paths[i]);
-
- int ret = proxy->InstallPkgs(uid, pkgs, con->GetArgv(),
- con->GenerateRequestId(), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ std::vector<std::string> pkgs;
+ for (int i = 0; i < n_pkgs; i++)
+ pkgs.push_back(pkg_paths[i]);
+
+ int ret = proxy->InstallPkgs(uid, pkgs, con->GetArgv(),
+ con->GenerateRequestId(), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_install_packages(pkgmgr_client *pc,
con->SetTepArgs();
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- std::string req_key;
- int ret = proxy->Install(uid, pkg_type ? pkg_type : "", pkg_path, con->GetArgv(),
- con->GenerateRequestId(), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ int ret = proxy->Install(uid, pkg_type ? pkg_type : "", pkg_path, con->GetArgv(),
+ con->GenerateRequestId(), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->Reinstall(uid, pkgid, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->Reinstall(uid, pkgid, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- std::vector<std::string> pkgs;
- for (int i = 0; i < n_pkgs; i++)
- pkgs.push_back(pkgids[i]);
+ std::string req_key;
+ std::vector<std::string> pkgs;
+ for (int i = 0; i < n_pkgs; i++)
+ pkgs.push_back(pkgids[i]);
- int ret = proxy->UninstallPkgs(uid, pkgs, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ int ret = proxy->UninstallPkgs(uid, pkgs, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->Uninstall(uid, pkgid, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->Uninstall(uid, pkgid, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_listen_res_status(pkgmgr_client *pc,
const auto& receiver = con->GetSignalReceiver();
return receiver->AddEventHandler("", event_cb, data);
} catch (...) {
- _E("exception occured");
+ _E("Exception occured");
return PKGMGR_R_ERROR;
}
}
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ std::vector<std::string> pkgs;
+ for (int i = 0; i < n_pkgs; i++) {
+ if (access(pkg_paths[i], F_OK) != 0) {
+ _E("failed to access: %s", pkg_paths[i]);
+ return PKGMGR_R_EINVAL;
+ }
- std::string req_key;
- std::vector<std::string> pkgs;
- for (int i = 0; i < n_pkgs; i++) {
- if (access(pkg_paths[i], F_OK) != 0) {
- _E("failed to access: %s", pkg_paths[i]);
- return PKGMGR_R_EINVAL;
+ pkgs.push_back(pkg_paths[i]);
}
- pkgs.push_back(pkg_paths[i]);
- }
-
- int ret = proxy->MountInstallPkgs(uid, pkgs, con->GenerateRequestId(),
- req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ int ret = proxy->MountInstallPkgs(uid, pkgs, con->GenerateRequestId(),
+ req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_mount_install_packages(pkgmgr_client *pc,
con->SetTepArgs();
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- std::string req_key;
- int ret = proxy->MountInstall(uid, pkg_type ? pkg_type : "", pkg_path,
- con->GetArgv(), con->GenerateRequestId(), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ int ret = proxy->MountInstall(uid, pkg_type ? pkg_type : "", pkg_path,
+ con->GetArgv(), con->GenerateRequestId(), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->Move(uid, pkgid, move_type, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->Move(uid, pkgid, move_type, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_register_pkg_update_info(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ int ret = proxy->RegisterPkgUpdateInfo(uid, update_info->pkgid,
+ update_info->version, update_info->type, req_key);
+ if (ret != 0) {
+ _E("Request fail");
+ return ret;
+ }
- std::string req_key;
- int ret = proxy->RegisterPkgUpdateInfo(uid, update_info->pkgid,
- update_info->version, update_info->type, req_key);
- if (ret != 0) {
- _E("Request fail");
- return ret;
+ return GetDelayedResult(pc, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
}
-
- return GetDelayedResult(pc, req_key);
}
API int pkgmgr_client_usr_unregister_pkg_update_info(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->UnregisterPkgUpdateInfo(uid, pkgid, req_key);
+ std::string req_key;
+ int ret = proxy->UnregisterPkgUpdateInfo(uid, pkgid, req_key);
- if (ret != 0) {
- _E("Request fail");
- return ret;
- }
+ if (ret != 0) {
+ _E("Request fail");
+ return ret;
+ }
- return GetDelayedResult(pc, req_key);
+ return GetDelayedResult(pc, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_unregister_pkg_update_info(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- return proxy->UnregisterAllPkgUpdateInfo(uid, req_key);
+ std::string req_key;
+ return proxy->UnregisterAllPkgUpdateInfo(uid, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_unregister_all_pkg_update_info(pkgmgr_client *pc) {
}
auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ if (con->GetPcType() != PC_REQUEST) {
+ _E("client type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
- std::string req_key;
- return proxy->EnablePkgs(uid, { pkgid }, req_key);
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ return proxy->EnablePkgs(uid, { pkgid }, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_activate(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;
-
- std::string req_key;
- std::vector<std::string> vec;
- for (int i = 0; i < n_pkgs; i++) {
- vec.push_back(pkgids[i]);
- }
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ std::vector<std::string> vec;
+ for (int i = 0; i < n_pkgs; i++) {
+ vec.push_back(pkgids[i]);
+ }
- int ret = proxy->EnablePkgs(uid, std::move(vec), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ int ret = proxy->EnablePkgs(uid, std::move(vec), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, data);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_activate_packages(pkgmgr_client *pc,
}
auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ if (con->GetPcType() != PC_REQUEST) {
+ _E("client type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
+
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- return proxy->DisablePkgs(uid, { pkgid }, req_key);
+ std::string req_key;
+ return proxy->DisablePkgs(uid, { pkgid }, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_deactivate(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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ std::vector<std::string> vec;
+ for (int i = 0; i < n_pkgs; i++) {
+ vec.push_back(pkgids[i]);
+ }
+ int ret = proxy->DisablePkgs(uid, std::move(vec), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- std::string req_key;
- std::vector<std::string> vec;
- for (int i = 0; i < n_pkgs; i++) {
- vec.push_back(pkgids[i]);
+ return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
}
- int ret = proxy->DisablePkgs(uid, std::move(vec), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
-
- return receiver->AddEventHandler(req_key, event_cb, data);
}
API int pkgmgr_client_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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->EnableApp(uid, appid, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->EnableApp(uid, appid, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, app_event_cb, data);
+ return receiver->AddEventHandler(req_key, app_event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_activate_app(pkgmgr_client *pc, const char *appid,
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- std::string req_key;
- std::vector<std::string> vec;
- for (int i = 0; i < n_apps; i++) {
- vec.push_back(appids[i]);
- }
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ std::vector<std::string> vec;
+ for (int i = 0; i < n_apps; i++) {
+ vec.push_back(appids[i]);
+ }
- int ret = proxy->EnableApps(uid, std::move(vec), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ int ret = proxy->EnableApps(uid, std::move(vec), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, app_event_cb, data);
+ return receiver->AddEventHandler(req_key, app_event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->EnableGlobalAppForUid(uid, appid, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->EnableGlobalAppForUid(uid, appid, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, app_event_cb, data);
+ return receiver->AddEventHandler(req_key, app_event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_usr_deactivate_app(pkgmgr_client *pc, const char *appid,
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->DisableApp(uid, appid, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->DisableApp(uid, appid, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, app_event_cb, data);
+ return receiver->AddEventHandler(req_key, app_event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_deactivate_app(pkgmgr_client *pc, const char *appid,
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- std::string req_key;
- std::vector<std::string> vec;
- for (int i = 0; i < n_apps; i++) {
- vec.push_back(appids[i]);
- }
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ std::vector<std::string> vec;
+ for (int i = 0; i < n_apps; i++) {
+ vec.push_back(appids[i]);
+ }
- int ret = proxy->DisableApps(uid, std::move(vec), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ int ret = proxy->DisableApps(uid, std::move(vec), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, app_event_cb, data);
+ return receiver->AddEventHandler(req_key, app_event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_deactivate_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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->DisableGlobalAppForUid(uid, appid, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->DisableGlobalAppForUid(uid, appid, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, app_event_cb, data);
+ return receiver->AddEventHandler(req_key, app_event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- return proxy->ClearData(uid, pkgid);
+ return proxy->ClearData(uid, pkgid);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_usr_clear_user_data_with_path(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- return proxy->ClearDataWithPath(uid, pkgid, file_path);
+ return proxy->ClearDataWithPath(uid, pkgid, file_path);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_clear_user_data_with_path(pkgmgr_client *pc, const char *pkg_type,
const auto& receiver = con->GetSignalReceiver();
return receiver->AddEventHandler("", event_cb, data);
} catch (...) {
- _E("exception occured");
+ _E("Exception occured");
return PKGMGR_R_ERROR;
}
}
const auto& receiver = con->GetSignalReceiver();
return receiver->AddEventHandler("", app_event_cb, data);
} catch (...) {
- _E("exception occured");
+ _E("Exception occured");
return PKGMGR_R_ERROR;
}
}
event_cb, data, uid);
}
case PM_REQUEST_GET_SIZE: {
- auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetInfoProxy();
- std::string req_key;
- int ret = proxy->GetSizeSync(uid, pkgid, service_mode, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
-
- return ResultGetSizeSync(pc, req_key);
+ try {
+ auto* con = static_cast<Connector*>(pc);
+ auto* proxy = con->GetInfoProxy();
+ std::string req_key;
+ int ret = proxy->GetSizeSync(uid, pkgid, service_mode, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
+
+ return ResultGetSizeSync(pc, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
case PM_REQUEST_KILL_APP: {
- auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- int pid = 0;
- int ret = proxy->Kill(uid, pkgid, pid);
- *(int *)data = pid;
+ try {
+ auto* con = static_cast<Connector*>(pc);
+ auto* proxy = con->GetAdminProxy();
+ int pid = 0;
+ int ret = proxy->Kill(uid, pkgid, pid);
+ *(int *)data = pid;
- return ret;
+ return ret;
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
case PM_REQUEST_CHECK_APP: {
- auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetInfoProxy();
- int pid = 0;
- int ret = proxy->Check(uid, pkgid, pid);
- *(int *)data = pid;
+ try {
+ auto* con = static_cast<Connector*>(pc);
+ auto* proxy = con->GetInfoProxy();
+ int pid = 0;
+ int ret = proxy->Check(uid, pkgid, pid);
+ *(int *)data = pid;
- return ret;
+ return ret;
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
default:
_E("Wrong Request");
break;
}
- return 0;
+
+ return PKGMGR_R_ERROR;
}
API int pkgmgr_client_usr_clear_cache_dir(const char *pkgid, uid_t uid) {
return PKGMGR_R_EINVAL;
}
- auto* con = new Connector(PC_REQUEST);
- auto* proxy = con->GetCacheProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ auto* con = new Connector(PC_REQUEST);
+ auto* proxy = con->GetCacheProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- int ret = proxy->ClearCache(uid, pkgid);
- delete con;
+ int ret = proxy->ClearCache(uid, pkgid);
+ delete con;
- return ret;
+ return ret;
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_clear_cache_dir(const char *pkgid) {
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetInfoProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetInfoProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->GetSize(uid, pkgid, get_type, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->GetSize(uid, pkgid, get_type, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
+
+ return receiver->AddEventHandler(req_key, event_cb, data);
- return receiver->AddEventHandler(req_key, event_cb, data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_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;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetInfoProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->GetSize(uid, pkgid, get_type, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->GetSize(uid, pkgid, get_type, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- receiver->AddEventHandler(req_key, event_cb, pc, user_data);
+ receiver->AddEventHandler(req_key, event_cb, pc, user_data);
- return PKGMGR_R_OK;
+ return PKGMGR_R_OK;
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_generate_license_request(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
-
- std::string data;
- std::string url;
- std::string req_key;
- int ret = proxy->GenerateLicenseRequest(resp_data, req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string data;
+ std::string url;
+ std::string req_key;
+ int ret = proxy->GenerateLicenseRequest(resp_data, req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- ret = GetGenerateLicenseResult(pc, req_key, data, url);
- if (ret != PKGMGR_R_OK)
- return ret;
+ ret = GetGenerateLicenseResult(pc, req_key, data, url);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- *req_data = strdup(data.c_str());
- *license_url = strdup(url.c_str());
- return PKGMGR_R_OK;
+ *req_data = strdup(data.c_str());
+ *license_url = strdup(url.c_str());
+ return PKGMGR_R_OK;
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_register_license(pkgmgr_client *pc, const char *resp_data) {
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->RegisterLicense(resp_data, req_key);
+ std::string req_key;
+ int ret = proxy->RegisterLicense(resp_data, req_key);
- if (ret != 0) {
- _E("Request fail");
- return ret;
- }
+ if (ret != 0) {
+ _E("Request fail");
+ return ret;
+ }
- return GetDelayedResult(pc, req_key);
+ return GetDelayedResult(pc, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_decrypt_package(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->DecryptPackage(drm_file_path, decrypted_file_path, req_key);
+ std::string req_key;
+ int ret = proxy->DecryptPackage(drm_file_path, decrypted_file_path, req_key);
- if (ret != 0) {
- _E("Request fail");
- return ret;
- }
+ if (ret != 0) {
+ _E("Request fail");
+ return ret;
+ }
- return GetDelayedResult(pc, req_key);
+ return GetDelayedResult(pc, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_enable_splash_screen(pkgmgr_client *pc, const char *appid) {
}
auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ if (con->GetPcType() != PC_REQUEST) {
+ _E("client type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
- return proxy->EnableAppSplashScreen(uid, appid);
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ return proxy->EnableAppSplashScreen(uid, appid);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_disable_splash_screen(pkgmgr_client *pc,
}
auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ if (con->GetPcType() != PC_REQUEST) {
+ _E("client type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
+
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- return proxy->DisableAppSplashScreen(uid, appid);
+ return proxy->DisableAppSplashScreen(uid, appid);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_usr_set_pkg_restriction_mode(pkgmgr_client *pc,
}
auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ if (con->GetPcType() != PC_REQUEST) {
+ _E("client type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
- std::string req_key;
- int ret = proxy->SetAppLabel(uid, appid, label, req_key);
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- if (ret != 0) {
- _E("Request fail");
- return ret;
- }
+ std::string req_key;
+ int ret = proxy->SetAppLabel(uid, appid, label, req_key);
- return GetDelayedResult(pc, req_key);
+ if (ret != 0) {
+ _E("Request fail");
+ return ret;
+ }
+
+ return GetDelayedResult(pc, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_set_app_label(pkgmgr_client *pc, char *appid, char *label) {
}
auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ if (con->GetPcType() != PC_REQUEST) {
+ _E("client type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
- std::string req_key;
- int ret = proxy->SetAppIcon(uid, appid, icon_path, req_key);
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- if (ret != 0) {
- _E("Request fail");
- return ret;
- }
+ std::string req_key;
+ int ret = proxy->SetAppIcon(uid, appid, icon_path, req_key);
- return GetDelayedResult(pc, req_key);
+ if (ret != 0) {
+ _E("Request fail");
+ return ret;
+ }
+
+ return GetDelayedResult(pc, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_set_app_icon(pkgmgr_client *pc, char *appid, char *icon_path) {
}
auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ if (con->GetPcType() != PC_REQUEST) {
+ _E("client type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
- return proxy->MigrateExternalImage(uid, pkgid);
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ return proxy->MigrateExternalImage(uid, pkgid);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_add_res_copy_path(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->ResCopy(con->GetResCopyPath(), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->ResCopy(con->GetResCopyPath(), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, user_data);
+ return receiver->AddEventHandler(req_key, event_cb, user_data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_add_res_create_dir_path(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->ResCreateDir(con->GetResCreateDir(), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->ResCreateDir(con->GetResCreateDir(), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, user_data);
+ return receiver->AddEventHandler(req_key, event_cb, user_data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_add_res_remove_path(pkgmgr_client *pc,
return PKGMGR_R_EINVAL;
}
- const auto& receiver = con->GetSignalReceiver();
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ try {
+ const auto& receiver = con->GetSignalReceiver();
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
- std::string req_key;
- int ret = proxy->ResRemove(con->GetResRemovePath(), req_key);
- if (ret != PKGMGR_R_OK)
- return ret;
+ std::string req_key;
+ int ret = proxy->ResRemove(con->GetResRemovePath(), req_key);
+ if (ret != PKGMGR_R_OK)
+ return ret;
- return receiver->AddEventHandler(req_key, event_cb, user_data);
+ return receiver->AddEventHandler(req_key, event_cb, user_data);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API int pkgmgr_client_res_uninstall(pkgmgr_client *pc, const char *pkgid) {
}
auto* con = static_cast<Connector*>(pc);
- auto* proxy = con->GetAdminProxy();
- if (proxy == nullptr)
- return PKGMGR_R_EIO;
+ if (con->GetPcType() != PC_REQUEST) {
+ _E("client type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
- std::string req_key;
- return proxy->ResUninstall(uid, pkgid, req_key);
+ try {
+ auto* proxy = con->GetAdminProxy();
+ if (proxy == nullptr)
+ return PKGMGR_R_EIO;
+
+ std::string req_key;
+ return proxy->ResUninstall(uid, pkgid, req_key);
+ } catch (...) {
+ _E("Exception occured");
+ return PKGMGR_R_ESYSTEM;
+ }
}
API pkgmgr_res_event_info *pkgmgr_res_event_info_new() {