change the method to check if the package is installed externally. 71/81871/3
authorjongmyeongko <jongmyeong.ko@samsung.com>
Fri, 29 Jul 2016 04:09:23 +0000 (13:09 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Fri, 29 Jul 2016 04:26:02 +0000 (13:26 +0900)
app2ext api was removed.

Change-Id: I0e9d8f43d54e89d102355cef6b95b296da9e251b
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/external_mount.cc

index 8762629..b9add82 100644 (file)
@@ -7,8 +7,18 @@
 #include <app2ext_interface.h>
 #include <manifest_parser/utils/logging.h>
 
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+
+#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() {