From 45730c58c3390d93b1ada789f41644f9ed1feaa3 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Fri, 29 Jul 2016 13:09:23 +0900 Subject: [PATCH] change the method to check if the package is installed externally. app2ext api was removed. Change-Id: I0e9d8f43d54e89d102355cef6b95b296da9e251b Signed-off-by: jongmyeongko --- src/common/external_mount.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/common/external_mount.cc b/src/common/external_mount.cc index 8762629..b9add82 100644 --- a/src/common/external_mount.cc +++ b/src/common/external_mount.cc @@ -7,8 +7,18 @@ #include #include +#include +#include + +#include "common/paths.h" +#include "common/pkgmgr_query.h" + +namespace bf = boost::filesystem; + namespace common_installer { +const char kInstalledExternally[] = "installed_external"; + ExternalMount::ExternalMount(const std::string& pkgid, uid_t uid) : pkgid_(pkgid), uid_(uid), @@ -26,7 +36,16 @@ ExternalMount::~ExternalMount() { } bool ExternalMount::IsAvailable() const { - return app2ext_usr_get_app_location(pkgid_.c_str(), uid_) == APP2EXT_SD_CARD; + bf::path storage_path = GetExternalCardPath(); + if (!bf::exists(storage_path)) { + LOG(WARNING) << "External storage (SD Card) is not mounted."; + return false; + } + std::string storage = QueryStorageForPkgId(pkgid_.c_str(), uid_); + if (storage != kInstalledExternally) + return false; + + return true; } bool ExternalMount::Mount() { -- 2.7.4