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 "hybrid/hybrid_installer.h"
7 #include <common/step/step_check_signature.h>
8 #include <common/step/step_backup_icons.h>
9 #include <common/step/step_backup_manifest.h>
10 #include <common/step/step_check_removable.h>
11 #include <common/step/step_configure.h>
12 #include <common/step/step_copy.h>
13 #include <common/step/step_copy_backup.h>
14 #include <common/step/step_copy_storage_directories.h>
15 #include <common/step/step_clear_data.h>
16 #include <common/step/step_create_icons.h>
17 #include <common/step/step_create_storage_directories.h>
18 #include <common/step/step_create_per_user_storage_directories.h>
19 #include <common/step/step_delta_patch.h>
20 #include <common/step/step_fail.h>
21 #include <common/step/step_kill_apps.h>
22 #include <common/step/step_parse_manifest.h>
23 #include <common/step/step_privilege_compatibility.h>
24 #include <common/step/step_register_app.h>
25 #include <common/step/step_register_security.h>
26 #include <common/step/step_remove_files.h>
27 #include <common/step/step_remove_icons.h>
28 #include <common/step/step_revoke_security.h>
29 #include <common/step/step_open_recovery_file.h>
30 #include <common/step/step_recover_application.h>
31 #include <common/step/step_recover_files.h>
32 #include <common/step/step_recover_icons.h>
33 #include <common/step/step_recover_manifest.h>
34 #include <common/step/step_recover_security.h>
35 #include <common/step/step_recover_storage_directories.h>
36 #include <common/step/step_remove_temporary_directory.h>
37 #include <common/step/step_remove_per_user_storage_directories.h>
38 #include <common/step/step_rollback_deinstallation_security.h>
39 #include <common/step/step_rollback_installation_security.h>
40 #include <common/step/step_run_parser_plugins.h>
41 #include <common/step/step_unregister_app.h>
42 #include <common/step/step_unzip.h>
43 #include <common/step/step_update_app.h>
44 #include <common/step/step_update_security.h>
45 #include <common/step/step_remove_manifest.h>
47 #include <tpk/step/step_create_symbolic_link.h>
48 #include <tpk/step/step_tpk_patch_icons.h>
50 #include "hybrid/hybrid_backend_data.h"
51 #include "hybrid/step/step_encrypt_resources.h"
52 #include "hybrid/step/step_merge_tpk_config.h"
53 #include "hybrid/step/step_stash_tpk_config.h"
54 #include "hybrid/step/step_parse.h"
55 #include "wgt/step/step_check_settings_level.h"
56 #include "wgt/step/step_check_wgt_background_category.h"
57 #include "wgt/step/step_create_symbolic_link.h"
58 #include "wgt/step/step_generate_xml.h"
59 #include "wgt/step/step_parse_recovery.h"
60 #include "wgt/step/step_remove_encryption_data.h"
61 #include "wgt/step/step_wgt_patch_icons.h"
62 #include "wgt/step/step_wgt_patch_storage_directories.h"
64 namespace ci = common_installer;
68 HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
69 : AppInstaller("wgt", pkgmgr) {
70 context_->backend_data.set(new HybridBackendData());
72 switch (pkgmgr_->GetRequestType()) {
73 case ci::RequestType::Install:
74 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
75 AddStep<ci::filesystem::StepUnzip>();
76 AddStep<ci::parse::StepParseManifest>(
77 ci::parse::StepParseManifest::ManifestLocation::PACKAGE,
78 ci::parse::StepParseManifest::StoreLocation::NORMAL);
79 AddStep<hybrid::parse::StepStashTpkConfig>();
80 AddStep<hybrid::parse::StepParse>(true);
81 AddStep<hybrid::parse::StepMergeTpkConfig>();
82 AddStep<ci::security::StepCheckSignature>();
83 AddStep<ci::security::StepPrivilegeCompatibility>();
84 AddStep<wgt::security::StepCheckSettingsLevel>();
85 AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
86 AddStep<hybrid::encrypt::StepEncryptResources>();
87 AddStep<ci::security::StepRollbackInstallationSecurity>();
88 AddStep<ci::filesystem::StepCopy>();
89 AddStep<tpk::filesystem::StepTpkPatchIcons>();
90 AddStep<wgt::filesystem::StepWgtPatchIcons>();
91 AddStep<ci::filesystem::StepCreateIcons>();
92 AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
93 AddStep<ci::filesystem::StepCreateStorageDirectories>();
94 AddStep<wgt::filesystem::StepCreateSymbolicLink>();
95 AddStep<tpk::filesystem::StepCreateSymbolicLink>();
96 AddStep<wgt::pkgmgr::StepGenerateXml>();
97 AddStep<ci::pkgmgr::StepRunParserPlugin>(
98 ci::Plugin::ActionType::Install);
99 AddStep<ci::pkgmgr::StepRegisterApplication>();
100 AddStep<ci::security::StepRegisterSecurity>();
101 AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
103 case ci::RequestType::Update:
104 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
105 AddStep<ci::filesystem::StepUnzip>();
106 AddStep<ci::parse::StepParseManifest>(
107 ci::parse::StepParseManifest::ManifestLocation::PACKAGE,
108 ci::parse::StepParseManifest::StoreLocation::NORMAL);
109 AddStep<hybrid::parse::StepStashTpkConfig>();
110 AddStep<hybrid::parse::StepParse>(true);
111 AddStep<hybrid::parse::StepMergeTpkConfig>();
112 AddStep<ci::security::StepCheckSignature>();
113 AddStep<ci::security::StepPrivilegeCompatibility>();
114 AddStep<wgt::security::StepCheckSettingsLevel>();
115 AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
116 AddStep<hybrid::encrypt::StepEncryptResources>();
117 AddStep<ci::security::StepRollbackInstallationSecurity>();
118 AddStep<ci::parse::StepParseManifest>(
119 ci::parse::StepParseManifest::ManifestLocation::INSTALLED,
120 ci::parse::StepParseManifest::StoreLocation::BACKUP);
121 AddStep<ci::pkgmgr::StepKillApps>();
122 AddStep<ci::backup::StepBackupManifest>();
123 AddStep<ci::backup::StepBackupIcons>();
124 AddStep<ci::backup::StepCopyBackup>();
125 AddStep<tpk::filesystem::StepTpkPatchIcons>();
126 AddStep<wgt::filesystem::StepWgtPatchIcons>();
127 AddStep<ci::filesystem::StepCreateIcons>();
128 AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
129 AddStep<ci::filesystem::StepCopyStorageDirectories>();
130 AddStep<wgt::filesystem::StepCreateSymbolicLink>();
131 AddStep<tpk::filesystem::StepCreateSymbolicLink>();
132 AddStep<ci::security::StepUpdateSecurity>();
133 AddStep<wgt::pkgmgr::StepGenerateXml>();
134 AddStep<ci::pkgmgr::StepUpdateApplication>();
135 AddStep<ci::pkgmgr::StepRunParserPlugin>(
136 ci::Plugin::ActionType::Upgrade);
138 case ci::RequestType::Uninstall:
139 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
140 AddStep<ci::pkgmgr::StepCheckRemovable>();
141 AddStep<ci::parse::StepParseManifest>(
142 ci::parse::StepParseManifest::ManifestLocation::INSTALLED,
143 ci::parse::StepParseManifest::StoreLocation::NORMAL);
144 AddStep<ci::pkgmgr::StepRunParserPlugin>(
145 ci::Plugin::ActionType::Uninstall);
146 AddStep<ci::pkgmgr::StepKillApps>();
147 AddStep<ci::filesystem::StepRemovePerUserStorageDirectories>();
148 AddStep<ci::pkgmgr::StepUnregisterApplication>();
149 AddStep<ci::security::StepRollbackDeinstallationSecurity>();
150 AddStep<ci::filesystem::StepRemoveFiles>();
151 AddStep<ci::filesystem::StepRemoveIcons>();
152 AddStep<wgt::encrypt::StepRemoveEncryptionData>();
153 AddStep<ci::security::StepRevokeSecurity>();
154 AddStep<ci::pkgmgr::StepRemoveManifest>();
156 case ci::RequestType::Reinstall:
157 // RDS is not supported for hybrid apps
158 AddStep<ci::configuration::StepFail>();
160 case ci::RequestType::Delta:
161 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
162 AddStep<ci::filesystem::StepUnzip>();
163 AddStep<ci::parse::StepParseManifest>(
164 ci::parse::StepParseManifest::ManifestLocation::PACKAGE,
165 ci::parse::StepParseManifest::StoreLocation::NORMAL);
166 AddStep<ci::filesystem::StepDeltaPatch>();
167 AddStep<hybrid::parse::StepStashTpkConfig>();
168 AddStep<hybrid::parse::StepParse>(true);
169 AddStep<hybrid::parse::StepMergeTpkConfig>();
170 AddStep<ci::security::StepCheckSignature>();
171 AddStep<ci::security::StepPrivilegeCompatibility>();
172 AddStep<wgt::security::StepCheckSettingsLevel>();
173 AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
174 AddStep<hybrid::encrypt::StepEncryptResources>();
175 AddStep<ci::security::StepRollbackInstallationSecurity>();
176 AddStep<ci::parse::StepParseManifest>(
177 ci::parse::StepParseManifest::ManifestLocation::INSTALLED,
178 ci::parse::StepParseManifest::StoreLocation::BACKUP);
179 AddStep<ci::pkgmgr::StepKillApps>();
180 AddStep<ci::backup::StepBackupManifest>();
181 AddStep<ci::backup::StepBackupIcons>();
182 AddStep<ci::backup::StepCopyBackup>();
183 AddStep<tpk::filesystem::StepTpkPatchIcons>();
184 AddStep<wgt::filesystem::StepWgtPatchIcons>();
185 AddStep<ci::filesystem::StepCreateIcons>();
186 AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
187 AddStep<ci::filesystem::StepCopyStorageDirectories>();
188 AddStep<wgt::filesystem::StepCreateSymbolicLink>();
189 AddStep<tpk::filesystem::StepCreateSymbolicLink>();
190 AddStep<ci::security::StepUpdateSecurity>();
191 AddStep<wgt::pkgmgr::StepGenerateXml>();
192 AddStep<ci::pkgmgr::StepUpdateApplication>();
193 AddStep<ci::pkgmgr::StepRunParserPlugin>(
194 ci::Plugin::ActionType::Upgrade);
196 case ci::RequestType::Recovery:
197 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
198 AddStep<ci::recovery::StepOpenRecoveryFile>();
199 AddStep<ci::parse::StepParseManifest>(
200 ci::parse::StepParseManifest::ManifestLocation::RECOVERY,
201 ci::parse::StepParseManifest::StoreLocation::NORMAL);
202 AddStep<hybrid::parse::StepStashTpkConfig>();
203 AddStep<wgt::parse::StepParseRecovery>();
204 AddStep<hybrid::parse::StepMergeTpkConfig>();
205 AddStep<ci::pkgmgr::StepRecoverApplication>();
206 AddStep<ci::filesystem::StepRemoveTemporaryDirectory>();
207 AddStep<ci::filesystem::StepRecoverIcons>();
208 AddStep<ci::filesystem::StepRecoverManifest>();
209 AddStep<ci::filesystem::StepRecoverStorageDirectories>();
210 AddStep<ci::filesystem::StepRecoverFiles>();
211 AddStep<ci::security::StepRecoverSecurity>();
213 case ci::RequestType::Clear:
214 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
215 AddStep<ci::filesystem::StepClearData>();
218 AddStep<ci::configuration::StepFail>();
223 } // namespace hybrid