Reworked sharing of widget's shared/res directory.
[platform/core/appfw/wgt-backend.git] / src / hybrid / hybrid_installer.cc
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.
4
5 #include "hybrid/hybrid_installer.h"
6
7 #include <common/privileges.h>
8 #include <common/step/backup/step_backup_icons.h>
9 #include <common/step/backup/step_backup_manifest.h>
10 #include <common/step/backup/step_copy_backup.h>
11 #include <common/step/configuration/step_block_cross_update.h>
12 #include <common/step/configuration/step_check_tizen_version.h>
13 #include <common/step/configuration/step_configure.h>
14 #include <common/step/configuration/step_fail.h>
15 #include <common/step/configuration/step_parse_manifest.h>
16 #include <common/step/configuration/step_parse_preload.h>
17 #include <common/step/filesystem/step_acquire_external_storage.h>
18 #include <common/step/filesystem/step_optional_acquire_external_storage.h>
19 #include <common/step/filesystem/step_change_ownership_and_permission.h>
20 #include <common/step/filesystem/step_copy.h>
21 #include <common/step/filesystem/step_copy_storage_directories.h>
22 #include <common/step/filesystem/step_copy_tep.h>
23 #include <common/step/filesystem/step_create_icons.h>
24 #include <common/step/filesystem/step_create_globalapp_symlinks.h>
25 #include <common/step/filesystem/step_create_per_user_storage_directories.h>
26 #include <common/step/filesystem/step_create_storage_directories.h>
27 #include <common/step/filesystem/step_delta_patch.h>
28 #include <common/step/filesystem/step_disable_external_mount.h>
29 #include <common/step/filesystem/step_enable_external_mount.h>
30 #include <common/step/filesystem/step_migrate_legacy_external_image.h>
31 #include <common/step/filesystem/step_recover_change_owner.h>
32 #include <common/step/filesystem/step_recover_files.h>
33 #include <common/step/filesystem/step_recover_icons.h>
34 #include <common/step/filesystem/step_recover_manifest.h>
35 #include <common/step/filesystem/step_recover_external_storage.h>
36 #include <common/step/filesystem/step_recover_storage_directories.h>
37 #include <common/step/filesystem/step_remove_files.h>
38 #include <common/step/filesystem/step_remove_icons.h>
39 #include <common/step/filesystem/step_remove_globalapp_symlinks.h>
40 #include <common/step/filesystem/step_remove_per_user_storage_directories.h>
41 #include <common/step/filesystem/step_remove_temporary_directory.h>
42 #include <common/step/filesystem/step_remove_zip_image.h>
43 #include <common/step/filesystem/step_remove_tep.h>
44 #include <common/step/filesystem/step_unzip.h>
45 #include <common/step/filesystem/step_update_tep.h>
46 #include <common/step/mount/step_mount_install.h>
47 #include <common/step/mount/step_mount_unpacked.h>
48 #include <common/step/mount/step_mount_recover.h>
49 #include <common/step/mount/step_mount_update.h>
50 #include <common/step/pkgmgr/step_check_force_clean.h>
51 #include <common/step/pkgmgr/step_check_installable.h>
52 #include <common/step/pkgmgr/step_check_removable.h>
53 #include <common/step/pkgmgr/step_check_restriction.h>
54 #include <common/step/pkgmgr/step_kill_apps.h>
55 #include <common/step/pkgmgr/step_recover_application.h>
56 #include <common/step/pkgmgr/step_register_app.h>
57 #include <common/step/pkgmgr/step_remove_manifest.h>
58 #include <common/step/pkgmgr/step_run_parser_plugins.h>
59 #include <common/step/pkgmgr/step_unregister_app.h>
60 #include <common/step/pkgmgr/step_update_app.h>
61 #include <common/step/pkgmgr/step_update_pkg_disable_info.h>
62 #include <common/step/recovery/step_open_recovery_file.h>
63 #include <common/step/security/step_check_signature.h>
64 #include <common/step/security/step_privilege_compatibility.h>
65 #include <common/step/security/step_recover_security.h>
66 #include <common/step/security/step_register_security.h>
67 #include <common/step/security/step_revoke_security.h>
68 #include <common/step/security/step_rollback_deinstallation_security.h>
69 #include <common/step/security/step_rollback_installation_security.h>
70 #include <common/step/security/step_update_security.h>
71
72 #include <tpk/step/filesystem/step_create_symbolic_link.h>
73 #include <tpk/step/filesystem/step_tpk_patch_icons.h>
74 #include <tpk/step/filesystem/step_tpk_prepare_package_directory.h>
75 #include <tpk/step/filesystem/step_tpk_update_package_directory.h>
76 #include <tpk/step/pkgmgr/step_manifest_adjustment.h>
77 #include <tpk/step/security/step_tpk_recover_signature.h>
78
79 #include "hybrid/hybrid_backend_data.h"
80 #include "hybrid/shared_dirs.h"
81 #include "hybrid/step/configuration/step_merge_tpk_config.h"
82 #include "hybrid/step/configuration/step_merge_tpk_privileges.h"
83 #include "hybrid/step/configuration/step_stash_tpk_config.h"
84 #include "hybrid/step/encryption/step_encrypt_resources.h"
85 #include "hybrid/step/pkgmgr/step_generate_xml.h"
86 #include "wgt/step/configuration/step_parse.h"
87 #include "wgt/step/encryption/step_remove_encryption_data.h"
88 #include "wgt/step/filesystem/step_copy_preview_icons.h"
89 #include "wgt/step/filesystem/step_create_symbolic_link.h"
90 #include "wgt/step/filesystem/step_wgt_patch_icons.h"
91 #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
92 #include "wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h"
93 #include "wgt/step/pkgmgr/step_generate_xml.h"
94 #include "wgt/step/security/step_check_settings_level.h"
95 #include "wgt/step/security/step_check_wgt_background_category.h"
96 #include "wgt/step/security/step_check_wgt_notification_category.h"
97 #include "wgt/step/security/step_check_wgt_ime_privilege.h"
98
99 namespace ci = common_installer;
100
101 namespace hybrid {
102
103 HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
104     : AppInstaller("wgt", pkgmgr) {
105   context_->cross_app_rules.set(true);
106   context_->backend_data.set(new HybridBackendData());
107
108   switch (pkgmgr_->GetRequestType()) {
109     case ci::RequestType::Install:
110       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
111       AddStep<ci::filesystem::StepUnzip>();
112       AddStep<ci::configuration::StepParseManifest>(
113           ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
114           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
115       AddStep<ci::pkgmgr::StepCheckInstallable>();
116       AddStep<hybrid::configuration::StepStashTpkConfig>();
117       AddStep<wgt::configuration::StepParse>(
118           wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
119       AddStep<ci::configuration::StepParsePreload>();
120       AddStep<ci::pkgmgr::StepCheckRestriction>();
121       AddStep<ci::configuration::StepCheckTizenVersion>();
122       AddStep<ci::security::StepCheckSignature>();
123       AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
124       AddStep<ci::security::StepPrivilegeCompatibility>(
125           ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
126       AddStep<wgt::security::StepCheckSettingsLevel>();
127       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
128       AddStep<wgt::security::StepCheckWgtNotificationCategory>();
129       AddStep<wgt::security::StepCheckWgtImePrivilege>();
130       AddStep<hybrid::encryption::StepEncryptResources>();
131       AddStep<ci::security::StepRollbackInstallationSecurity>();
132       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
133       AddStep<ci::filesystem::StepAcquireExternalStorage>(false);
134       AddStep<ci::filesystem::StepCopy>();
135       AddStep<ci::filesystem::StepCopyTep>();
136       AddStep<tpk::filesystem::StepTpkPatchIcons>();
137       AddStep<wgt::filesystem::StepWgtPatchIcons>();
138       AddStep<ci::filesystem::StepCreateIcons>();
139       AddStep<wgt::filesystem::StepCopyPreviewIcons>();
140       AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
141       AddStep<ci::filesystem::StepCreateStorageDirectories>();
142       AddStep<wgt::pkgmgr::StepGenerateXml>();
143       AddStep<hybrid::pkgmgr::StepGenerateXml>();
144       AddStep<tpk::pkgmgr::StepManifestAdjustment>();
145       AddStep<hybrid::configuration::StepMergeTpkConfig>();
146       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
147       AddStep<tpk::filesystem::StepCreateSymbolicLink>();
148       AddStep<ci::security::StepRegisterSecurity>();
149       AddStep<ci::pkgmgr::StepRegisterApplication>();
150       AddStep<ci::pkgmgr::StepRunParserPlugin>(
151           ci::Plugin::ActionType::Install);
152       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
153           wgt::filesystem::HybridAdditionalSharedDirs);
154       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
155       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
156       break;
157     case ci::RequestType::Update:
158       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
159       AddStep<ci::filesystem::StepUnzip>();
160       AddStep<ci::configuration::StepParseManifest>(
161           ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
162           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
163       AddStep<hybrid::configuration::StepStashTpkConfig>();
164       AddStep<wgt::configuration::StepParse>(
165           wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
166       AddStep<ci::configuration::StepParsePreload>();
167       AddStep<ci::configuration::StepCheckTizenVersion>();
168       AddStep<ci::security::StepCheckSignature>();
169       AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
170       AddStep<ci::security::StepPrivilegeCompatibility>(
171           ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
172       AddStep<wgt::security::StepCheckSettingsLevel>();
173       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
174       AddStep<wgt::security::StepCheckWgtNotificationCategory>();
175       AddStep<wgt::security::StepCheckWgtImePrivilege>();
176       AddStep<hybrid::encryption::StepEncryptResources>();
177       AddStep<ci::configuration::StepParseManifest>(
178           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
179           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
180       AddStep<ci::configuration::StepBlockCrossUpdate>();
181       AddStep<ci::pkgmgr::StepKillApps>();
182       AddStep<ci::backup::StepBackupManifest>();
183       AddStep<ci::backup::StepBackupIcons>();
184       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
185       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
186       AddStep<ci::backup::StepCopyBackup>();
187       AddStep<ci::filesystem::StepUpdateTep>();
188       AddStep<tpk::filesystem::StepTpkPatchIcons>();
189       AddStep<wgt::filesystem::StepWgtPatchIcons>();
190       AddStep<ci::filesystem::StepCreateIcons>();
191       AddStep<wgt::filesystem::StepCopyPreviewIcons>();
192       AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
193       AddStep<ci::filesystem::StepCopyStorageDirectories>();
194       AddStep<ci::security::StepUpdateSecurity>();
195       AddStep<wgt::pkgmgr::StepGenerateXml>();
196       AddStep<hybrid::pkgmgr::StepGenerateXml>();
197       AddStep<tpk::pkgmgr::StepManifestAdjustment>();
198       AddStep<hybrid::configuration::StepMergeTpkConfig>();
199       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
200       AddStep<tpk::filesystem::StepCreateSymbolicLink>();
201       AddStep<ci::pkgmgr::StepUpdateApplication>();
202       AddStep<ci::pkgmgr::StepRunParserPlugin>(
203           ci::Plugin::ActionType::Upgrade);
204       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
205       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
206       break;
207     case ci::RequestType::Uninstall:
208       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
209       AddStep<ci::pkgmgr::StepCheckRestriction>();
210       AddStep<ci::pkgmgr::StepCheckRemovable>();
211       AddStep<ci::pkgmgr::StepCheckForceClean>();
212       AddStep<ci::configuration::StepParseManifest>(
213           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
214           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
215       AddStep<ci::pkgmgr::StepRunParserPlugin>(
216           ci::Plugin::ActionType::Uninstall);
217       AddStep<ci::pkgmgr::StepKillApps>();
218       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
219       AddStep<ci::filesystem::StepOptionalAcquireExternalStorage>();
220       AddStep<ci::filesystem::StepRemovePerUserStorageDirectories>();
221       AddStep<ci::pkgmgr::StepUnregisterApplication>();
222       AddStep<ci::security::StepRollbackDeinstallationSecurity>();
223       AddStep<ci::filesystem::StepRemoveTep>();
224       AddStep<ci::filesystem::StepRemoveFiles>();
225       AddStep<ci::filesystem::StepRemoveZipImage>();
226       AddStep<ci::filesystem::StepRemoveIcons>();
227       AddStep<wgt::encryption::StepRemoveEncryptionData>();
228       AddStep<ci::security::StepRevokeSecurity>();
229       AddStep<ci::pkgmgr::StepRemoveManifest>();
230       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
231       break;
232     case ci::RequestType::Reinstall:
233       // RDS is not supported for hybrid apps
234       AddStep<ci::configuration::StepFail>();
235       break;
236     case ci::RequestType::Delta:
237       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
238       AddStep<ci::filesystem::StepUnzip>();
239       AddStep<ci::configuration::StepParseManifest>(
240           ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
241           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
242       AddStep<wgt::filesystem::StepWgtUndoPatchStorageDirectories>();
243       AddStep<hybrid::configuration::StepStashTpkConfig>();
244       AddStep<ci::configuration::StepParseManifest>(
245           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
246           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
247       AddStep<ci::filesystem::StepEnableExternalMount>();
248       AddStep<ci::filesystem::StepDeltaPatch>();
249       AddStep<ci::filesystem::StepDisableExternalMount>();
250       AddStep<wgt::configuration::StepParse>(
251           wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
252       AddStep<ci::configuration::StepParsePreload>();
253       AddStep<ci::configuration::StepCheckTizenVersion>();
254       AddStep<ci::security::StepCheckSignature>();
255       AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
256       AddStep<ci::security::StepPrivilegeCompatibility>(
257           ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
258       AddStep<wgt::security::StepCheckSettingsLevel>();
259       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
260       AddStep<wgt::security::StepCheckWgtNotificationCategory>();
261       AddStep<wgt::security::StepCheckWgtImePrivilege>();
262       AddStep<hybrid::encryption::StepEncryptResources>();
263       AddStep<ci::configuration::StepBlockCrossUpdate>();
264       AddStep<ci::pkgmgr::StepKillApps>();
265       AddStep<ci::backup::StepBackupManifest>();
266       AddStep<ci::backup::StepBackupIcons>();
267       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
268       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
269       AddStep<ci::backup::StepCopyBackup>();
270       AddStep<ci::filesystem::StepUpdateTep>();
271       AddStep<tpk::filesystem::StepTpkPatchIcons>();
272       AddStep<wgt::filesystem::StepWgtPatchIcons>();
273       AddStep<ci::filesystem::StepCreateIcons>();
274       AddStep<wgt::filesystem::StepCopyPreviewIcons>();
275       AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
276       AddStep<ci::filesystem::StepCopyStorageDirectories>();
277       AddStep<ci::security::StepUpdateSecurity>();
278       AddStep<wgt::pkgmgr::StepGenerateXml>();
279       AddStep<hybrid::pkgmgr::StepGenerateXml>();
280       AddStep<tpk::pkgmgr::StepManifestAdjustment>();
281       AddStep<hybrid::configuration::StepMergeTpkConfig>();
282       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
283       AddStep<tpk::filesystem::StepCreateSymbolicLink>();
284       AddStep<ci::pkgmgr::StepUpdateApplication>();
285       AddStep<ci::pkgmgr::StepRunParserPlugin>(
286           ci::Plugin::ActionType::Upgrade);
287       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
288       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
289       break;
290     case ci::RequestType::Recovery:
291       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
292       AddStep<ci::recovery::StepOpenRecoveryFile>();
293       AddStep<ci::configuration::StepParseManifest>(
294           ci::configuration::StepParseManifest::ManifestLocation::RECOVERY,
295           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
296       AddStep<ci::filesystem::StepRemoveTemporaryDirectory>();
297       AddStep<ci::filesystem::StepRecoverIcons>();
298       AddStep<ci::filesystem::StepRecoverManifest>();
299       AddStep<ci::filesystem::StepRecoverExternalStorage>();
300       AddStep<ci::filesystem::StepRecoverStorageDirectories>();
301       AddStep<ci::filesystem::StepRecoverFiles>();
302       AddStep<ci::mount::StepMountRecover>();
303       AddStep<tpk::security::StepTpkRecoverSignature>();
304       AddStep<ci::pkgmgr::StepRecoverApplication>();
305       AddStep<ci::filesystem::StepRecoverChangeOwner>();
306       AddStep<ci::security::StepRecoverSecurity>();
307       break;
308     case ci::RequestType::MountInstall:
309       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
310       AddStep<ci::mount::StepMountUnpacked>();
311       AddStep<ci::configuration::StepParseManifest>(
312           ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
313           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
314       AddStep<ci::pkgmgr::StepCheckInstallable>();
315       AddStep<hybrid::configuration::StepStashTpkConfig>();
316       AddStep<wgt::configuration::StepParse>(
317           wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
318       AddStep<ci::configuration::StepParsePreload>();
319       AddStep<ci::pkgmgr::StepCheckRestriction>();
320       AddStep<ci::configuration::StepCheckTizenVersion>();
321       AddStep<ci::security::StepCheckSignature>();
322       AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
323       AddStep<ci::security::StepPrivilegeCompatibility>(
324           ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
325       AddStep<wgt::security::StepCheckSettingsLevel>();
326       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
327       AddStep<wgt::security::StepCheckWgtNotificationCategory>();
328       AddStep<wgt::security::StepCheckWgtImePrivilege>();
329       AddStep<hybrid::encryption::StepEncryptResources>();
330       AddStep<ci::security::StepRollbackInstallationSecurity>();
331       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
332       AddStep<ci::mount::StepMountInstall>();
333       AddStep<tpk::filesystem::StepTpkPreparePackageDirectory>();
334       AddStep<ci::filesystem::StepCopyTep>();
335       AddStep<tpk::filesystem::StepTpkPatchIcons>();
336       AddStep<wgt::filesystem::StepWgtPatchIcons>();
337       AddStep<ci::filesystem::StepCreateIcons>();
338       AddStep<wgt::filesystem::StepCopyPreviewIcons>();
339       AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
340       AddStep<ci::filesystem::StepCreateStorageDirectories>();
341       AddStep<wgt::pkgmgr::StepGenerateXml>();
342       AddStep<hybrid::pkgmgr::StepGenerateXml>();
343       AddStep<tpk::pkgmgr::StepManifestAdjustment>();
344       AddStep<hybrid::configuration::StepMergeTpkConfig>();
345       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
346       AddStep<tpk::filesystem::StepCreateSymbolicLink>();
347       AddStep<ci::security::StepRegisterSecurity>();
348       AddStep<ci::pkgmgr::StepRegisterApplication>();
349       AddStep<ci::pkgmgr::StepRunParserPlugin>(
350           ci::Plugin::ActionType::Install);
351       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
352           wgt::filesystem::HybridAdditionalSharedDirs);
353       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
354       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
355       break;
356     case ci::RequestType::MountUpdate:
357       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
358       AddStep<ci::mount::StepMountUnpacked>();
359       AddStep<ci::configuration::StepParseManifest>(
360           ci::configuration::StepParseManifest::ManifestLocation::PACKAGE,
361           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
362       AddStep<hybrid::configuration::StepStashTpkConfig>();
363       AddStep<wgt::configuration::StepParse>(
364           wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
365       AddStep<ci::configuration::StepParsePreload>();
366       AddStep<ci::configuration::StepCheckTizenVersion>();
367       AddStep<ci::security::StepCheckSignature>();
368       AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
369       AddStep<ci::security::StepPrivilegeCompatibility>(
370           ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
371       AddStep<wgt::security::StepCheckSettingsLevel>();
372       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
373       AddStep<wgt::security::StepCheckWgtNotificationCategory>();
374       AddStep<wgt::security::StepCheckWgtImePrivilege>();
375       AddStep<hybrid::encryption::StepEncryptResources>();
376       AddStep<ci::configuration::StepParseManifest>(
377           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
378           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
379       AddStep<ci::configuration::StepBlockCrossUpdate>();
380       AddStep<ci::pkgmgr::StepKillApps>();
381       AddStep<ci::backup::StepBackupManifest>();
382       AddStep<ci::backup::StepBackupIcons>();
383       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
384       AddStep<ci::mount::StepMountUpdate>();
385       AddStep<tpk::filesystem::StepTpkUpdatePackageDirectory>();
386       AddStep<ci::filesystem::StepUpdateTep>();
387       AddStep<tpk::filesystem::StepTpkPatchIcons>();
388       AddStep<wgt::filesystem::StepWgtPatchIcons>();
389       AddStep<ci::filesystem::StepCreateIcons>();
390       AddStep<wgt::filesystem::StepCopyPreviewIcons>();
391       AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
392       AddStep<ci::security::StepUpdateSecurity>();
393       AddStep<wgt::pkgmgr::StepGenerateXml>();
394       AddStep<hybrid::pkgmgr::StepGenerateXml>();
395       AddStep<tpk::pkgmgr::StepManifestAdjustment>();
396       AddStep<hybrid::configuration::StepMergeTpkConfig>();
397       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
398       AddStep<tpk::filesystem::StepCreateSymbolicLink>();
399       AddStep<ci::pkgmgr::StepUpdateApplication>();
400       AddStep<ci::pkgmgr::StepRunParserPlugin>(
401           ci::Plugin::ActionType::Upgrade);
402       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
403       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
404       break;
405     case ci::RequestType::ManifestDirectInstall:
406       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
407       AddStep<ci::configuration::StepParseManifest>(
408           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
409           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
410       AddStep<ci::pkgmgr::StepCheckInstallable>();
411       AddStep<hybrid::configuration::StepStashTpkConfig>();
412       AddStep<wgt::configuration::StepParse>(
413           wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
414       AddStep<ci::configuration::StepParsePreload>();
415       AddStep<ci::configuration::StepCheckTizenVersion>();
416       AddStep<ci::security::StepCheckSignature>();
417       AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
418       AddStep<ci::security::StepPrivilegeCompatibility>(
419           ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
420       AddStep<wgt::security::StepCheckSettingsLevel>();
421       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
422       AddStep<ci::security::StepRollbackInstallationSecurity>();
423       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
424       AddStep<wgt::pkgmgr::StepGenerateXml>();
425       AddStep<hybrid::pkgmgr::StepGenerateXml>();
426       AddStep<tpk::pkgmgr::StepManifestAdjustment>();
427       AddStep<hybrid::configuration::StepMergeTpkConfig>();
428       AddStep<ci::security::StepRegisterSecurity>();
429       AddStep<ci::pkgmgr::StepRegisterApplication>();
430       AddStep<ci::pkgmgr::StepRunParserPlugin>(
431           ci::Plugin::ActionType::Install);
432       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
433           wgt::filesystem::HybridAdditionalSharedDirs);
434       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
435       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
436       break;
437     case ci::RequestType::ManifestDirectUpdate:
438       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
439       AddStep<ci::configuration::StepParseManifest>(
440           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
441           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
442       AddStep<hybrid::configuration::StepStashTpkConfig>();
443       AddStep<wgt::configuration::StepParse>(
444           wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
445       AddStep<ci::configuration::StepParsePreload>();
446       AddStep<ci::configuration::StepCheckTizenVersion>();
447       AddStep<ci::security::StepCheckSignature>();
448       AddStep<hybrid::configuration::StepMergeTpkPrivileges>();
449       AddStep<ci::security::StepPrivilegeCompatibility>(
450           ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
451       AddStep<wgt::security::StepCheckSettingsLevel>();
452       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
453       AddStep<ci::configuration::StepParseManifest>(
454           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
455           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
456       AddStep<ci::pkgmgr::StepKillApps>();
457       AddStep<ci::security::StepUpdateSecurity>();
458       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
459       AddStep<wgt::pkgmgr::StepGenerateXml>();
460       AddStep<hybrid::pkgmgr::StepGenerateXml>();
461       AddStep<tpk::pkgmgr::StepManifestAdjustment>();
462       AddStep<hybrid::configuration::StepMergeTpkConfig>();
463       AddStep<ci::pkgmgr::StepUpdateApplication>();
464       AddStep<ci::pkgmgr::StepRunParserPlugin>(
465           ci::Plugin::ActionType::Upgrade);
466       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
467       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
468       break;
469     case ci::RequestType::ManifestPartialInstall: {
470       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
471       AddStep<ci::configuration::StepParseManifest>(
472           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
473           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
474       AddStep<hybrid::configuration::StepStashTpkConfig>();
475       AddStep<wgt::configuration::StepParse>(
476           wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
477       AddStep<hybrid::configuration::StepMergeTpkConfig>();
478       AddStep<ci::configuration::StepParsePreload>();
479       AddStep<ci::security::StepCheckSignature>();
480       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
481       AddStep<ci::security::StepRegisterSecurity>();
482       AddStep<ci::pkgmgr::StepRegisterApplication>();
483       AddStep<ci::pkgmgr::StepRunParserPlugin>(
484           ci::Plugin::ActionType::Install);
485       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
486           wgt::filesystem::HybridAdditionalSharedDirs);
487       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
488       break;
489     }
490     case ci::RequestType::ManifestPartialUpdate: {
491       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
492       AddStep<ci::configuration::StepParseManifest>(
493           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
494           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
495       AddStep<hybrid::configuration::StepStashTpkConfig>();
496       AddStep<wgt::configuration::StepParse>(
497           wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
498       AddStep<hybrid::configuration::StepMergeTpkConfig>();
499       AddStep<ci::configuration::StepParsePreload>();
500       AddStep<ci::security::StepCheckSignature>();
501       AddStep<ci::configuration::StepParseManifest>(
502           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
503           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
504       AddStep<ci::pkgmgr::StepKillApps>();
505       AddStep<ci::security::StepUpdateSecurity>();
506       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
507       AddStep<ci::pkgmgr::StepUpdateApplication>();
508       AddStep<ci::pkgmgr::StepRunParserPlugin>(
509           ci::Plugin::ActionType::Upgrade);
510       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
511       break;
512     }
513     case ci::RequestType::PartialUninstall: {
514       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
515       AddStep<ci::pkgmgr::StepCheckRestriction>();
516       AddStep<ci::pkgmgr::StepCheckRemovable>();
517       AddStep<ci::pkgmgr::StepCheckForceClean>();
518       AddStep<ci::configuration::StepParseManifest>(
519           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
520           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
521       AddStep<ci::pkgmgr::StepRunParserPlugin>(
522           ci::Plugin::ActionType::Uninstall);
523       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
524       AddStep<ci::filesystem::StepOptionalAcquireExternalStorage>();
525       AddStep<ci::filesystem::StepRemovePerUserStorageDirectories>();
526       AddStep<ci::pkgmgr::StepUnregisterApplication>();
527       AddStep<wgt::encryption::StepRemoveEncryptionData>();
528       AddStep<ci::security::StepRevokeSecurity>();
529       break;
530     }
531     case ci::RequestType::EnablePkg:
532       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
533       AddStep<ci::configuration::StepParseManifest>(
534           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
535           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
536       AddStep<ci::pkgmgr::StepKillApps>();
537       AddStep<ci::pkgmgr::StepUpdatePkgDisableInfo>(
538         ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Enable);
539       AddStep<ci::pkgmgr::StepRunParserPlugin>(
540         ci::Plugin::ActionType::Uninstall);
541       break;
542     case ci::RequestType::DisablePkg:
543       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
544       AddStep<ci::configuration::StepParseManifest>(
545           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
546           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
547       AddStep<ci::pkgmgr::StepKillApps>();
548       AddStep<ci::pkgmgr::StepUpdatePkgDisableInfo>(
549         ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Disable);
550       AddStep<ci::pkgmgr::StepRunParserPlugin>(
551         ci::Plugin::ActionType::Uninstall);
552       break;
553     case ci::RequestType::MigrateExtImg: {
554       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
555       AddStep<ci::security::StepMigrateLegacyExtImage>();
556       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
557       break;
558     }
559     default:
560       AddStep<ci::configuration::StepFail>();
561       break;
562   }
563 }
564
565 }  // namespace hybrid
566