const std::string& disable_pkg_sym_name = "app2ext_usr_enable_external_pkg";
const std::string& enable_pkg_sym_name = "app2ext_usr_enable_external_pkg";
+const std::string& get_image_path_sym_name = "app2ext_usr_get_image_path";
const std::string& init_sym_name = "app2ext_init";
const std::string& deinit_sym_name = "app2ext_deinit";
const std::string& LIBNAME = "libapp2ext.so.0";
return ret == 0;
}
+std::string App2ExtDynamicService::GetExternalImagePath(const char* pkgid,
+ uid_t uid) {
+ char* image_path = CallMethod<char*>(nullptr, get_image_path_sym_name.c_str(),
+ pkgid, uid);
+ std::string result;
+ if (image_path) {
+ result = std::string(image_path);
+ free(image_path);
+ }
+ return result;
+}
+
app2ext_handle* App2ExtDynamicService::InitLibrary() {
return CallMethod<app2ext_handle*>(NULL, init_sym_name.c_str(),
APP2EXT_SD_CARD);
#include <string>
#include <vector>
+#include "common/app2ext_dynamic_service.h"
#include "common/app_installer.h"
#include "common/feature_validator.h"
#include "common/installer_context.h"
const char kManifestFileName[] = "tizen-manifest.xml";
const char kInstalledInternally[] = "installed_internal";
+const char kInstalledExternally[] = "installed_external";
const char kPortraitOrientation[] = "portrait";
const char kLandscapeOrientation[] = "landscape";
const char kOperationEffectKey[] = "operation_effect";
manifest->type = strdup(pkg_info->type().c_str());
}
+ // Set external path if the package is installed at external storage.
+ if (req_type == RequestType::ManifestDirectInstall ||
+ req_type == RequestType::ManifestDirectUpdate ||
+ req_type == RequestType::ManifestPartialInstall ||
+ req_type == RequestType::ManifestPartialUpdate) {
+ App2ExtDynamicService service;
+ std::string image_path = service.GetExternalImagePath(
+ context_->pkgid.get().c_str(), context_->uid.get());
+ if (!image_path.empty()) {
+ manifest->external_path = strdup(image_path.c_str());
+ manifest->installed_storage = strdup(kInstalledExternally);
+ }
+ }
+
for (auto& pair : pkg_info->labels()) {
label_x* label = reinterpret_cast<label_x*>(calloc(1, sizeof(label_x)));
if (!label) {
// set installed_storage if package is installed
// this is internal field in package manager but after reading configuration
// we must know it
- if (manifest_location_ == ManifestLocation::INSTALLED ||
- manifest_location_ == ManifestLocation::RECOVERY) {
- PkgQueryInterface pkg_query(manifest->package, context_->uid.get());
- std::string storage = pkg_query.StorageForPkgId();
- if (storage.empty()) {
+ if (!manifest->installed_storage) {
+ if (manifest_location_ == ManifestLocation::INSTALLED ||
+ manifest_location_ == ManifestLocation::RECOVERY) {
+ PkgQueryInterface pkg_query(manifest->package, context_->uid.get());
+ std::string storage = pkg_query.StorageForPkgId();
+ if (storage.empty()) {
// Failed to query installation storage, assign internal
manifest->installed_storage = strdup(kInstalledInternally);
- } else {
+ } else {
manifest->installed_storage = strdup(storage.c_str());
+ }
+ } else {
+ manifest->installed_storage = strdup(kInstalledInternally);
}
- } else {
- manifest->installed_storage = strdup(kInstalledInternally);
}
return true;