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_configure.h>
11 #include <common/step/step_copy.h>
12 #include <common/step/step_copy_backup.h>
13 #include <common/step/step_create_icons.h>
14 #include <common/step/step_delta_patch.h>
15 #include <common/step/step_fail.h>
16 #include <common/step/step_kill_apps.h>
17 #include <common/step/step_old_manifest.h>
18 #include <common/step/step_parse.h>
19 #include <common/step/step_privilege_compatibility.h>
20 #include <common/step/step_register_app.h>
21 #include <common/step/step_register_security.h>
22 #include <common/step/step_remove_files.h>
23 #include <common/step/step_remove_icons.h>
24 #include <common/step/step_revoke_security.h>
25 #include <common/step/step_rollback_deinstallation_security.h>
26 #include <common/step/step_rollback_installation_security.h>
27 #include <common/step/step_unregister_app.h>
28 #include <common/step/step_unzip.h>
29 #include <common/step/step_update_app.h>
30 #include <common/step/step_update_security.h>
32 #include <tpk/step/step_create_symbolic_link.h>
33 #include <tpk/step/step_parse.h>
35 #include "hybrid/hybrid_backend_data.h"
36 #include "hybrid/step/step_encrypt_resources.h"
37 #include "hybrid/step/step_merge_tpk_config.h"
38 #include "hybrid/step/step_stash_tpk_config.h"
39 #include "hybrid/step/step_parse.h"
40 #include "wgt/step/step_check_settings_level.h"
41 #include "wgt/step/step_check_wgt_background_category.h"
42 #include "wgt/step/step_create_symbolic_link.h"
43 #include "wgt/step/step_generate_xml.h"
44 #include "wgt/step/step_remove_encryption_data.h"
45 #include "wgt/step/step_wgt_create_icons.h"
46 #include "wgt/step/step_wgt_create_storage_directories.h"
47 #include "wgt/step/step_wgt_copy_storage_directories.h"
49 namespace ci = common_installer;
53 HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
54 : AppInstaller("wgt", pkgmgr) {
55 context_->backend_data.set(new HybridBackendData());
57 switch (pkgmgr_->GetRequestType()) {
58 case ci::RequestType::Install:
59 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
60 AddStep<ci::filesystem::StepUnzip>();
61 AddStep<tpk::parse::StepParse>();
62 AddStep<hybrid::parse::StepStashTpkConfig>();
63 AddStep<hybrid::parse::StepParse>(true);
64 AddStep<hybrid::parse::StepMergeTpkConfig>();
65 AddStep<ci::security::StepCheckSignature>();
66 AddStep<ci::security::StepPrivilegeCompatibility>();
67 AddStep<wgt::security::StepCheckSettingsLevel>();
68 AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
69 AddStep<hybrid::encrypt::StepEncryptResources>();
70 AddStep<ci::security::StepRollbackInstallationSecurity>();
71 AddStep<ci::filesystem::StepCopy>();
72 AddStep<wgt::filesystem::StepWgtCreateStorageDirectories>();
73 AddStep<wgt::filesystem::StepCreateSymbolicLink>();
74 AddStep<tpk::filesystem::StepCreateSymbolicLink>();
75 AddStep<ci::filesystem::StepCreateIcons>();
76 AddStep<wgt::filesystem::StepWgtCreateIcons>();
77 AddStep<wgt::pkgmgr::StepGenerateXml>();
78 AddStep<ci::pkgmgr::StepRegisterApplication>();
79 AddStep<ci::security::StepRegisterSecurity>();
81 case ci::RequestType::Update:
82 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
83 AddStep<ci::filesystem::StepUnzip>();
84 AddStep<tpk::parse::StepParse>();
85 AddStep<hybrid::parse::StepStashTpkConfig>();
86 AddStep<hybrid::parse::StepParse>(true);
87 AddStep<hybrid::parse::StepMergeTpkConfig>();
88 AddStep<ci::security::StepCheckSignature>();
89 AddStep<ci::security::StepPrivilegeCompatibility>();
90 AddStep<wgt::security::StepCheckSettingsLevel>();
91 AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
92 AddStep<hybrid::encrypt::StepEncryptResources>();
93 AddStep<ci::security::StepRollbackInstallationSecurity>();
94 AddStep<ci::backup::StepOldManifest>();
95 AddStep<ci::pkgmgr::StepKillApps>();
96 AddStep<ci::backup::StepBackupManifest>();
97 AddStep<ci::backup::StepBackupIcons>();
98 AddStep<ci::backup::StepCopyBackup>();
99 AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
100 AddStep<wgt::filesystem::StepCreateSymbolicLink>();
101 AddStep<tpk::filesystem::StepCreateSymbolicLink>();
102 AddStep<ci::filesystem::StepCreateIcons>();
103 AddStep<wgt::filesystem::StepWgtCreateIcons>();
104 AddStep<ci::security::StepUpdateSecurity>();
105 AddStep<wgt::pkgmgr::StepGenerateXml>();
106 AddStep<ci::pkgmgr::StepUpdateApplication>();
108 case ci::RequestType::Uninstall:
109 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
110 // TODO(t.iwanek): this parses both configuration files
111 // tpk and wgt, removing pkgmgr-parser should change this code
112 // that it will still support parsing both files
113 AddStep<ci::parse::StepParse>();
114 AddStep<ci::pkgmgr::StepKillApps>();
115 AddStep<ci::backup::StepBackupManifest>();
116 AddStep<ci::pkgmgr::StepUnregisterApplication>();
117 AddStep<ci::security::StepRollbackDeinstallationSecurity>();
118 AddStep<ci::filesystem::StepRemoveFiles>();
119 AddStep<ci::filesystem::StepRemoveIcons>();
120 AddStep<wgt::encrypt::StepRemoveEncryptionData>();
121 AddStep<ci::security::StepRevokeSecurity>();
123 case ci::RequestType::Reinstall:
124 // RDS is not supported for hybrid apps
125 AddStep<ci::configuration::StepFail>();
127 case ci::RequestType::Delta:
128 AddStep<ci::configuration::StepConfigure>(pkgmgr_);
129 AddStep<ci::filesystem::StepUnzip>();
130 // TODO(t.iwanek): manifest is parsed twice...
131 AddStep<tpk::parse::StepParse>();
132 AddStep<hybrid::parse::StepStashTpkConfig>();
133 AddStep<hybrid::parse::StepParse>(false);
134 AddStep<hybrid::parse::StepMergeTpkConfig>();
135 AddStep<ci::filesystem::StepDeltaPatch>();
136 AddStep<wgt::parse::StepParse>(true);
137 AddStep<ci::security::StepCheckSignature>();
138 AddStep<ci::security::StepPrivilegeCompatibility>();
139 AddStep<wgt::security::StepCheckSettingsLevel>();
140 AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
141 AddStep<hybrid::encrypt::StepEncryptResources>();
142 AddStep<ci::security::StepRollbackInstallationSecurity>();
143 AddStep<ci::backup::StepOldManifest>();
144 AddStep<ci::pkgmgr::StepKillApps>();
145 AddStep<ci::backup::StepBackupManifest>();
146 AddStep<ci::backup::StepBackupIcons>();
147 AddStep<ci::backup::StepCopyBackup>();
148 AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
149 AddStep<wgt::filesystem::StepCreateSymbolicLink>();
150 AddStep<tpk::filesystem::StepCreateSymbolicLink>();
151 AddStep<ci::filesystem::StepCreateIcons>();
152 AddStep<wgt::filesystem::StepWgtCreateIcons>();
153 AddStep<ci::security::StepUpdateSecurity>();
154 AddStep<wgt::pkgmgr::StepGenerateXml>();
155 AddStep<ci::pkgmgr::StepUpdateApplication>();
157 case ci::RequestType::Recovery:
158 // TODO(t.iwanek): implement recovery for hybrid apps if possible
159 AddStep<ci::configuration::StepFail>();
162 AddStep<ci::configuration::StepFail>();
167 } // namespace hybrid