step/configuration/step_parse_manifest.cc
step/configuration/step_parse_preload.cc
step/filesystem/step_acquire_external_storage.cc
+ step/filesystem/step_optional_acquire_external_storage.cc
step/filesystem/step_change_owner.cc
step/filesystem/step_clear_data.cc
step/filesystem/step_copy.cc
--- /dev/null
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "common/step/filesystem/step_optional_acquire_external_storage.h"
+
+#include <vconf.h>
+#include <vconf-internal-keys.h>
+
+#include <cstring>
+#include <string>
+
+#include "common/external_storage.h"
+#include "common/pkgmgr_query.h"
+
+namespace {
+
+const char kInstalledExternally[] = "installed_external";
+
+} // namespace
+
+namespace common_installer {
+namespace filesystem {
+
+StepOptionalAcquireExternalStorage::StepOptionalAcquireExternalStorage(
+ InstallerContext* context)
+ : StepAcquireExternalStorage(context, true) {
+}
+
+Step::Status StepOptionalAcquireExternalStorage::process() {
+ Storage storage = Storage::NONE;
+
+ std::string storage_str = QueryStorageForPkgId(context_->pkgid.get(),
+ context_->uid.get());
+ if (!strcmp(storage_str.c_str(), kInstalledExternally))
+ storage = Storage::EXTERNAL;
+ else
+ storage = Storage::INTERNAL;
+
+ if (storage == Storage::EXTERNAL)
+ context_->external_storage =
+ ExternalStorage::AcquireExternalStorage(context_->request_type.get(),
+ context_->root_application_path.get(),
+ context_->pkgid.get(),
+ context_->pkg_type.get(),
+ context_->unpacked_dir_path.get(),
+ context_->uid.get());
+
+ if (storage == Storage::EXTERNAL && !context_->external_storage)
+ LOG(WARNING) << "Cannot initialize external storage for uninstalled package";
+
+ return Status::OK;
+}
+
+} // namespace filesystem
+} // namespace common_installer
+
--- /dev/null
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef COMMON_STEP_FILESYSTEM_STEP_OPTIONAL_ACQUIRE_EXTERNAL_STORAGE_H_
+#define COMMON_STEP_FILESYSTEM_STEP_OPTIONAL_ACQUIRE_EXTERNAL_STORAGE_H_
+
+#include "common/installer_context.h"
+#include "common/step/filesystem/step_acquire_external_storage.h"
+
+namespace common_installer {
+namespace filesystem {
+
+class StepOptionalAcquireExternalStorage : public StepAcquireExternalStorage {
+ public:
+ explicit StepOptionalAcquireExternalStorage(InstallerContext* context);
+
+ Status process() override;
+
+ STEP_NAME(OptionalAcquireExternalStorage)
+};
+
+} // namespace filesystem
+} // namespace common_installer
+
+#endif // COMMON_STEP_FILESYSTEM_STEP_OPTIONAL_ACQUIRE_EXTERNAL_STORAGE_H_