From b46081ce0ef07bbbb87a982cf669601e808b6801 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Wed, 3 Jun 2015 09:21:03 +0900 Subject: [PATCH] Fix Application/Package to use pkgmgr API for Multi-User version. Change-Id: I283e5586557d0e1fbfdb3546852e84bf2f0a87c7 --- src/application/application_manager.cc | 16 ++++++++-------- src/application/application_utils.cc | 2 +- src/package/package_info_provider.cc | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/application/application_manager.cc b/src/application/application_manager.cc index a84a583..2ec2354 100755 --- a/src/application/application_manager.cc +++ b/src/application/application_manager.cc @@ -78,7 +78,7 @@ void ApplicationManager::GetCurrentApplication(const std::string& app_id, // obtain handle to application info pkgmgrinfo_appinfo_h handle; - int ret = pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle); + int ret = pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle); if (PMINFO_R_OK != ret) { LoggerE("Failed to get app info."); ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get app info."), out); @@ -674,7 +674,7 @@ void ApplicationManager::FindAppControl(const picojson::value& args) { } pkgmgrinfo_appinfo_h handle; - int ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle); + int ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &handle); if (PMINFO_R_OK != ret) { LoggerE("Failed to get appInfo"); } else { @@ -855,10 +855,10 @@ void ApplicationManager::GetAppsInfo(const picojson::value& args) { return 0; }; - int ret = pkgmgrinfo_appinfo_get_installed_list(app_info_cb, &array); + int ret = pkgmgrinfo_appinfo_get_usr_installed_list(app_info_cb, getuid(), &array); if (APP_MANAGER_ERROR_NONE != ret) { - LoggerE("pkgmgrinfo_appinfo_get_installed_list error"); + LoggerE("pkgmgrinfo_appinfo_get_usr_installed_list error"); ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), &response_obj); } else { ReportSuccess(result, response_obj); @@ -883,7 +883,7 @@ void ApplicationManager::GetAppInfo(const std::string& app_id, picojson::object* pkgmgrinfo_appinfo_h handle = nullptr; - if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle)) { + if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle)) { LoggerE("Failed to get app info"); ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get app info."), out); return; @@ -1024,7 +1024,7 @@ void ApplicationManager::GetAppSharedUri(const std::string& app_id, picojson::ob pkgmgrinfo_pkginfo_h pkg_info = nullptr; - int ret = pkgmgrinfo_pkginfo_get_pkginfo(package_id, &pkg_info); + int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(package_id, getuid(), &pkg_info); std::unique_ptr::type, int(*)(pkgmgrinfo_pkginfo_h)> pkg_info_ptr(pkg_info, &pkgmgrinfo_pkginfo_destroy_pkginfo); // automatically release the memory @@ -1056,7 +1056,7 @@ void ApplicationManager::GetAppMetaData(const std::string& app_id, picojson::obj pkgmgrinfo_appinfo_h handle = nullptr; - int ret = pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle); + int ret = pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle); std::unique_ptr::type, int(*)(pkgmgrinfo_appinfo_h)> pkg_info_ptr(handle, &pkgmgrinfo_appinfo_destroy_appinfo); // automatically release the memory @@ -1191,7 +1191,7 @@ class ApplicationListChangedBroker { case Event::kUpdated: { pkgmgrinfo_appinfo_h handle = nullptr; - if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle)) { + if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle)) { LoggerE("Failed to get application information handle."); continue; } diff --git a/src/application/application_utils.cc b/src/application/application_utils.cc index e532bec..e2fa81e 100755 --- a/src/application/application_utils.cc +++ b/src/application/application_utils.cc @@ -102,7 +102,7 @@ void ApplicationUtils::CreateApplicationInformation(const pkgmgrinfo_appinfo_h h } pkgmgrinfo_pkginfo_h pkginfo; - ret = pkgmgrinfo_pkginfo_get_pkginfo(tmp_str, &pkginfo); + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(tmp_str, getuid(), &pkginfo); if (PMINFO_R_OK != ret) { LoggerE("Failed to get package info"); } else { diff --git a/src/package/package_info_provider.cc b/src/package/package_info_provider.cc index 0c829d4..3378977 100644 --- a/src/package/package_info_provider.cc +++ b/src/package/package_info_provider.cc @@ -65,7 +65,7 @@ void PackageInfoProvider::GetPackagesInfo( start_time = clock(); picojson::array array_data; - if ( pkgmgrinfo_pkginfo_get_list(PackageInfoGetListCb, &array_data) + if ( pkgmgrinfo_pkginfo_get_usr_list(PackageInfoGetListCb, &array_data, getuid()) != PMINFO_R_OK ) { LoggerE("Failed to get package information"); REPORT_ERROR(out, UnknownException("Any other platform error occurs")); @@ -105,7 +105,7 @@ void PackageInfoProvider::GetPackageInfo( } pkgmgrinfo_pkginfo_h info; - if ( pkgmgrinfo_pkginfo_get_pkginfo(package_id, &info) + if ( pkgmgrinfo_pkginfo_get_usr_pkginfo(package_id, getuid(), &info) != PMINFO_R_OK ) { LoggerE("Failed to get pkginfo"); REPORT_ERROR(out, NotFoundException("The package with the specified ID is not found")); -- 2.7.4