1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
5 #include "common/step/pkgmgr/step_recover_application.h"
7 #include <boost/filesystem.hpp>
9 #include "common/paths.h"
10 #include "common/pkgmgr_registration.h"
12 namespace bf = boost::filesystem;
14 namespace common_installer {
17 Step::Status StepRecoverApplication::RecoveryNew() {
20 if (context_->manifest_data.get())
21 UnregisterAppInPkgmgr(context_->manifest_data.get(),
22 context_->pkgid.get(),
24 context_->request_mode.get());
26 UnregisterAppInPkgmgrForPkgId(context_->pkgid.get(),
28 context_->request_mode.get());
32 Step::Status StepRecoverApplication::RecoveryUpdate() {
34 LOG(ERROR) << "Some parameters are lacking";
37 UnregisterAppInPkgmgr(context_->manifest_data.get(),
38 context_->pkgid.get(),
40 context_->request_mode.get());
41 if (!RegisterAppInPkgmgr(context_->manifest_data.get(),
42 context_->pkgid.get(),
43 context_->certificate_info.get(),
45 context_->request_mode.get())) {
46 LOG(ERROR) << "Unsuccessful app registration";
47 return Status::RECOVERY_ERROR;
52 bool StepRecoverApplication::SetXmlPaths() {
53 if (context_->pkgid.get().empty())
56 bf::path(getUserManifestPath(context_->uid.get(),
57 context_->is_readonly_package.get()))
58 / context_->pkgid.get();
60 context_->xml_path.set(xml_path);
61 context_->backup_xml_path.set(GetBackupPathForManifestFile(xml_path));
66 } // namespace common_installer