From: Seungha Son Date: Wed, 8 Nov 2017 12:24:21 +0000 (+0900) Subject: Fix wrong IsPackageInstalled() logic X-Git-Tag: accepted/tizen/unified/20171109.124921~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F159389%2F1;p=platform%2Fcore%2Fappfw%2Fapp-installers.git Fix wrong IsPackageInstalled() logic Signed-off-by: Seungha Son Change-Id: I63d0f8a956bda8b9974dcfa0a2231a69fa05654c --- diff --git a/src/common/pkgmgr_query.cc b/src/common/pkgmgr_query.cc index eb5fec0..e38637f 100644 --- a/src/common/pkgmgr_query.cc +++ b/src/common/pkgmgr_query.cc @@ -114,7 +114,19 @@ std::string PkgQueryInterface::StorageForPkgId() { } bool PkgQueryInterface::IsPackageInstalled() { - return IsValid(); + if (!IsValid()) + return false; + bool is_global = false; + if (pkgmgrinfo_pkginfo_is_for_all_users(handle_, &is_global) != PMINFO_R_OK) { + LOG(ERROR) << "pkgmgrinfo_pkginfo_is_for_all_users failed"; + return false; + } + + if (uid_ == kGlobalUserUid && is_global) + return true; + if (uid_ != kGlobalUserUid && is_global) + return false; + return true; } bool PkgQueryInterface::IsPackageInstalled(RequestMode mode) {