Implement StepRestoreWgtSymbolicLink
[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/configuration/step_fail.h>
9 #include <common/step/filesystem/step_create_storage_directories.h>
10 #include <common/step/filesystem/step_delta_patch.h>
11 #include <common/step/filesystem/step_remove_per_user_storage_directories.h>
12 #include <common/step/security/step_privilege_compatibility.h>
13 #include <common/step/security/step_recover_privilege_compatibility.h>
14
15 #include <tpk/step/filesystem/step_create_tpk_symbolic_link.h>
16 #include <tpk/step/filesystem/step_tpk_patch_icons.h>
17 #include <tpk/step/filesystem/step_tpk_prepare_package_directory.h>
18 #include <tpk/step/filesystem/step_tpk_update_package_directory.h>
19 #include <tpk/step/pkgmgr/step_manifest_adjustment.h>
20 #include <tpk/step/security/step_tpk_recover_signature.h>
21
22 #include "hybrid/hybrid_backend_data.h"
23 #include "hybrid/shared_dirs.h"
24 #include "hybrid/step/configuration/step_merge_tpk_config.h"
25 #include "hybrid/step/configuration/step_merge_tpk_privileges.h"
26 #include "hybrid/step/configuration/step_set_mainapp.h"
27 #include "hybrid/step/configuration/step_stash_tpk_config.h"
28 #include "hybrid/step/encryption/step_encrypt_hybrid_resources.h"
29 #include "hybrid/step/pkgmgr/step_merge_xml.h"
30 #include "lib/wgt_archive_info.h"
31 #include "wgt/step/configuration/step_parse.h"
32 #include "wgt/step/configuration/step_set_old_signature_files_location.h"
33 #include "wgt/step/encryption/step_remove_encryption_data.h"
34 #include "wgt/step/filesystem/step_copy_preview_icons.h"
35 #include "wgt/step/filesystem/step_create_wgt_symbolic_link.h"
36 #include "wgt/step/filesystem/step_restore_wgt_symbolic_link.h"
37 #include "wgt/step/filesystem/step_wgt_patch_icons.h"
38 #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
39 #include "wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h"
40 #include "wgt/step/pkgmgr/step_generate_xml.h"
41 #include "wgt/step/security/step_check_settings_level.h"
42 #include "wgt/step/security/step_check_wgt_background_category.h"
43 #include "wgt/step/security/step_check_wgt_notification_category.h"
44 #include "wgt/step/security/step_check_wgt_ime_privilege.h"
45
46 namespace ci = common_installer;
47
48 namespace hybrid {
49
50 HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
51     : AppInstaller("wgt", pkgmgr) {
52   context_->cross_app_rules.set(true);
53   context_->backend_data.set(new HybridBackendData());
54 }
55
56 std::unique_ptr<ci::ArchiveInfo> HybridInstaller::GetArchiveInfo() {
57   std::unique_ptr<WgtArchiveInfo> archive_info;
58   archive_info.reset(new WgtArchiveInfo(pkgmgr_->GetRequestInfo(GetIndex())));
59   return archive_info;
60 }
61
62 void HybridInstaller::InstallSteps() {
63   AppInstaller::InstallSteps();
64   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckInstallable");
65   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
66       wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
67   AddStepAfter<wgt::security::StepCheckSettingsLevel>("Signature");
68   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
69       "CheckSettingsLevel");
70   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
71       "CheckWgtBackgroundCategory");
72   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
73       "CheckWgtNotificationCategory");
74   AddStepAfter<hybrid::encryption::StepEncryptHybridResources>(
75       "CheckWgtImePrivilege");
76   AddStepAfter<tpk::filesystem::StepTpkPatchIcons>("CreateIcons");
77   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
78   AddStepAfter<wgt::filesystem::StepCopyPreviewIcons>("WgtPatchIcons");
79   AddStepAfter<wgt::filesystem::StepCreateWgtSymbolicLink>("CopyPreviewIcons");
80   AddStepAfter<tpk::filesystem::StepCreateTpkSymbolicLink>(
81       "CreateWgtSymbolicLink");
82   AddStepAfter<wgt::pkgmgr::StepGenerateXml>("CreateTpkSymbolicLink");
83   AddStepAfter<hybrid::pkgmgr::StepMergeXml>("GenerateXml");
84   AddStepAfter<tpk::pkgmgr::StepManifestAdjustment>("MergeXml");
85   AddStepAfter<hybrid::configuration::StepMergeTpkConfig>("ManifestAdjustment");
86   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
87   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
88       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
89   ReplaceStep<ci::filesystem::StepCreateStorageDirectories>(
90       "CreateStorageDirectories",
91       wgt::filesystem::HybridAdditionalSharedDirs);
92   AddStepAfter<wgt::filesystem::StepWgtPatchStorageDirectories>(
93       "CreateStorageDirectories");
94 }
95
96 void HybridInstaller::UpdateSteps() {
97   AppInstaller::UpdateSteps();
98   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckUpgradable");
99   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
100       wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
101   AddStepAfter<wgt::security::StepCheckSettingsLevel>("CheckOldCertificate");
102   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
103       "CheckSettingsLevel");
104   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
105       "CheckWgtBackgroundCategory");
106   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
107       "CheckWgtNotificationCategory");
108   AddStepAfter<hybrid::encryption::StepEncryptHybridResources>(
109       "CheckWgtImePrivilege");
110   AddStepAfter<tpk::filesystem::StepTpkPatchIcons>("CreateIcons");
111   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
112   AddStepAfter<wgt::filesystem::StepCopyPreviewIcons>("WgtPatchIcons");
113   AddStepAfter<wgt::filesystem::StepCreateWgtSymbolicLink>("CopyPreviewIcons");
114   AddStepAfter<tpk::filesystem::StepCreateTpkSymbolicLink>(
115       "CreateWgtSymbolicLink");
116   AddStepAfter<wgt::pkgmgr::StepGenerateXml>("CreateTpkSymbolicLink");
117   AddStepAfter<hybrid::pkgmgr::StepMergeXml>("GenerateXml");
118   AddStepAfter<tpk::pkgmgr::StepManifestAdjustment>("MergeXml");
119   AddStepAfter<hybrid::configuration::StepMergeTpkConfig>("ManifestAdjustment");
120   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
121   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
122       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
123   AddStepAfter<wgt::filesystem::StepWgtPatchStorageDirectories>(
124       "CopyStorageDirectories");
125 }
126
127 void HybridInstaller::UninstallSteps() {
128   AppInstaller::UninstallSteps();
129   ReplaceStep<ci::filesystem::StepRemovePerUserStorageDirectories>(
130       "RemovePerUserStorageDirectories",
131       wgt::filesystem::HybridAdditionalSharedDirs);
132   AddStepAfter<wgt::filesystem::StepRestoreWgtSymbolicLink>(
133       "RemovePerUserStorageDirectories");
134   AddStepAfter<wgt::encryption::StepRemoveEncryptionData>(
135       "RemovePerUserStorageDirectories");
136 }
137
138 void HybridInstaller::ReinstallSteps() {
139   // RDS is not supported for hybrid apps
140   AddStep<ci::configuration::StepFail>();
141 }
142
143 void HybridInstaller::DeltaSteps() {
144   AppInstaller::DeltaSteps();
145   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckUpgradable");
146   AddStepAfter<wgt::filesystem::StepWgtUndoPatchStorageDirectories>(
147       "EnableExternalMount");
148   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
149       wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, false);
150   AddStepAfter<wgt::security::StepCheckSettingsLevel>("CheckOldCertificate");
151   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
152       "CheckSettingsLevel");
153   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
154       "CheckWgtBackgroundCategory");
155   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
156       "CheckWgtNotificationCategory");
157   AddStepAfter<hybrid::encryption::StepEncryptHybridResources>(
158       "CheckWgtImePrivilege");
159   AddStepAfter<tpk::filesystem::StepTpkPatchIcons>("CreateIcons");
160   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
161   AddStepAfter<wgt::filesystem::StepCopyPreviewIcons>("WgtPatchIcons");
162   AddStepAfter<wgt::filesystem::StepCreateWgtSymbolicLink>("CopyPreviewIcons");
163   AddStepAfter<tpk::filesystem::StepCreateTpkSymbolicLink>(
164       "CreateWgtSymbolicLink");
165   AddStepAfter<wgt::pkgmgr::StepGenerateXml>("CreateTpkSymbolicLink");
166   AddStepAfter<hybrid::pkgmgr::StepMergeXml>("GenerateXml");
167   AddStepAfter<tpk::pkgmgr::StepManifestAdjustment>("MergeXml");
168   AddStepAfter<hybrid::configuration::StepMergeTpkConfig>("ManifestAdjustment");
169   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
170   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
171       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
172   AddStepAfter<wgt::filesystem::StepWgtPatchStorageDirectories>(
173       "CopyStorageDirectories");
174 }
175
176 void HybridInstaller::RecoverySteps() {
177   AppInstaller::RecoverySteps();
178   AddStepAfter<tpk::security::StepTpkRecoverSignature>("MountRecover");
179   AddStepAfter<ci::security::StepRecoverPrivilegeCompatibility>(
180       "TpkRecoverSignature",
181       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
182 }
183
184 void HybridInstaller::MountInstallSteps() {
185   AppInstaller::MountInstallSteps();
186   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckInstallable");
187   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
188       wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
189   AddStepAfter<wgt::security::StepCheckSettingsLevel>("Signature");
190   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
191       "CheckSettingsLevel");
192   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
193       "CheckWgtBackgroundCategory");
194   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
195       "CheckWgtNotificationCategory");
196   AddStepAfter<hybrid::encryption::StepEncryptHybridResources>(
197       "CheckWgtImePrivilege");
198   AddStepAfter<tpk::filesystem::StepTpkPreparePackageDirectory>("MountInstall");
199   AddStepAfter<tpk::filesystem::StepTpkPatchIcons>("CreateIcons");
200   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
201   AddStepAfter<wgt::filesystem::StepCopyPreviewIcons>("WgtPatchIcons");
202   AddStepAfter<wgt::filesystem::StepCreateWgtSymbolicLink>("CopyPreviewIcons");
203   AddStepAfter<tpk::filesystem::StepCreateTpkSymbolicLink>(
204       "CreateWgtSymbolicLink");
205   AddStepAfter<wgt::pkgmgr::StepGenerateXml>("CreateTpkSymbolicLink");
206   AddStepAfter<hybrid::pkgmgr::StepMergeXml>("GenerateXml");
207   AddStepAfter<tpk::pkgmgr::StepManifestAdjustment>("MergeXml");
208   AddStepAfter<hybrid::configuration::StepMergeTpkConfig>("ManifestAdjustment");
209   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
210   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
211       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
212   ReplaceStep<ci::filesystem::StepCreateStorageDirectories>(
213       "CreateStorageDirectories",
214       wgt::filesystem::HybridAdditionalSharedDirs);
215   AddStepAfter<wgt::filesystem::StepWgtPatchStorageDirectories>(
216       "CreateStorageDirectories");
217 }
218
219 void HybridInstaller::MountUpdateSteps() {
220   AppInstaller::MountUpdateSteps();
221   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckUpgradable");
222   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
223       wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
224   AddStepAfter<wgt::security::StepCheckSettingsLevel>("CheckOldCertificate");
225   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
226       "CheckSettingsLevel");
227   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
228       "CheckWgtBackgroundCategory");
229   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
230       "CheckWgtNotificationCategory");
231   AddStepAfter<hybrid::encryption::StepEncryptHybridResources>(
232       "CheckWgtImePrivilege");
233   AddStepAfter<tpk::filesystem::StepTpkUpdatePackageDirectory>("MountUpdate");
234   AddStepAfter<tpk::filesystem::StepTpkPatchIcons>("CreateIcons");
235   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
236   AddStepAfter<wgt::filesystem::StepCopyPreviewIcons>("WgtPatchIcons");
237   AddStepAfter<wgt::filesystem::StepCreateWgtSymbolicLink>("CopyPreviewIcons");
238   AddStepAfter<tpk::filesystem::StepCreateTpkSymbolicLink>(
239       "CreateWgtSymbolicLink");
240   AddStepAfter<wgt::pkgmgr::StepGenerateXml>("CreateTpkSymbolicLink");
241   AddStepAfter<hybrid::pkgmgr::StepMergeXml>("GenerateXml");
242   AddStepAfter<tpk::pkgmgr::StepManifestAdjustment>("MergeXml");
243   AddStepAfter<hybrid::configuration::StepMergeTpkConfig>("ManifestAdjustment");
244   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
245   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
246       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
247   AddStepAfter<wgt::filesystem::StepWgtPatchStorageDirectories>(
248       "UpdateStorageDirectories");
249 }
250
251 void HybridInstaller::ManifestDirectInstallSteps() {
252   AppInstaller::ManifestDirectInstallSteps();
253   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckInstallable");
254   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
255       wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
256   AddStepAfter<wgt::security::StepCheckSettingsLevel>("Signature");
257   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
258       "CheckSettingsLevel");
259   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
260       "CheckWgtBackgroundCategory");
261   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
262       "CheckWgtNotificationCategory");
263   AddStepAfter<tpk::filesystem::StepTpkPatchIcons>(
264       "RemoveGlobalAppSymlinks");
265   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
266   AddStepAfter<wgt::filesystem::StepCreateWgtSymbolicLink>("WgtPatchIcons");
267   AddStepAfter<tpk::filesystem::StepCreateTpkSymbolicLink>(
268       "CreateWgtSymbolicLink");
269   AddStepAfter<wgt::pkgmgr::StepGenerateXml>("CreateTpkSymbolicLink");
270   AddStepAfter<hybrid::pkgmgr::StepMergeXml>("GenerateXml");
271   AddStepAfter<tpk::pkgmgr::StepManifestAdjustment>("MergeXml");
272   AddStepAfter<hybrid::configuration::StepMergeTpkConfig>("ManifestAdjustment");
273   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
274   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
275       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
276   AddStepAfter<hybrid::configuration::StepSetMainapp>("PrivilegeCompatibility");
277   ReplaceStep<ci::filesystem::StepCreateStorageDirectories>(
278       "CreateStorageDirectories",
279       wgt::filesystem::HybridAdditionalSharedDirs);
280 }
281
282 void HybridInstaller::ManifestDirectUpdateSteps() {
283   AppInstaller::ManifestDirectUpdateSteps();
284   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckUpgradable");
285   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
286       wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
287   AddStepAfter<wgt::security::StepCheckSettingsLevel>("CheckOldCertificate");
288   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
289       "CheckSettingsLevel");
290   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
291       "CheckWgtBackgroundCategory");
292   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
293       "CheckWgtNotificationCategory");
294   AddStepAfter<tpk::filesystem::StepTpkPatchIcons>(
295       "RemoveGlobalAppSymlinks");
296   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
297   AddStepAfter<wgt::filesystem::StepCreateWgtSymbolicLink>("WgtPatchIcons");
298   AddStepAfter<tpk::filesystem::StepCreateTpkSymbolicLink>(
299       "CreateWgtSymbolicLink");
300   AddStepAfter<wgt::pkgmgr::StepGenerateXml>("CreateTpkSymbolicLink");
301   AddStepAfter<hybrid::pkgmgr::StepMergeXml>("GenerateXml");
302   AddStepAfter<tpk::pkgmgr::StepManifestAdjustment>("MergeXml");
303   AddStepAfter<hybrid::configuration::StepMergeTpkConfig>("ManifestAdjustment");
304   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
305   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
306       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
307   AddStepAfter<hybrid::configuration::StepSetMainapp>("PrivilegeCompatibility");
308 }
309
310 void HybridInstaller::ManifestPartialInstallSteps() {
311   AppInstaller::ManifestPartialInstallSteps();
312   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("ParseManifest");
313   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
314       wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
315   AddStepAfter<wgt::security::StepCheckSettingsLevel>("Signature");
316   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
317       "CheckSettingsLevel");
318   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
319       "CheckWgtBackgroundCategory");
320   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
321       "CheckWgtNotificationCategory");
322   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("RemoveGlobalAppSymlinks",
323       false);
324   ReplaceStep<ci::filesystem::StepCreateStorageDirectories>(
325       "CreateStorageDirectories",
326       wgt::filesystem::HybridAdditionalSharedDirs);
327   AddStepBefore<hybrid::configuration::StepMergeTpkConfig>(
328       "RegisterApplication");
329   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
330   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
331       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
332   AddStepAfter<hybrid::configuration::StepSetMainapp>("PrivilegeCompatibility");
333 }
334
335 void HybridInstaller::ManifestPartialUpdateSteps() {
336   AppInstaller::ManifestPartialUpdateSteps();
337   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("ParseManifest");
338   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
339       wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
340   AddStepAfter<wgt::security::StepCheckSettingsLevel>("CheckOldCertificate");
341   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
342       "CheckSettingsLevel");
343   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
344       "CheckWgtBackgroundCategory");
345   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
346       "CheckWgtNotificationCategory");
347   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("RemoveGlobalAppSymlinks",
348       false);
349   AddStepBefore<hybrid::configuration::StepMergeTpkConfig>("UpdateApplication");
350   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
351   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
352       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
353   AddStepAfter<hybrid::configuration::StepSetMainapp>("PrivilegeCompatibility");
354 }
355
356 void HybridInstaller::PartialUninstallSteps() {
357   AppInstaller::PartialUninstallSteps();
358   ReplaceStep<ci::filesystem::StepRemovePerUserStorageDirectories>(
359       "RemovePerUserStorageDirectories",
360       wgt::filesystem::HybridAdditionalSharedDirs);
361   AddStepAfter<wgt::filesystem::StepRestoreWgtSymbolicLink>(
362       "RemovePerUserStorageDirectories");
363   AddStepAfter<wgt::encryption::StepRemoveEncryptionData>(
364       "RemovePerUserStorageDirectories");
365 }
366
367 void HybridInstaller::ReadonlyUpdateInstallSteps() {
368   AppInstaller::ReadonlyUpdateInstallSteps();
369   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckUpgradable");
370   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
371       wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
372   AddStepAfter<wgt::security::StepCheckSettingsLevel>("CheckOldCertificate");
373   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
374       "CheckSettingsLevel");
375   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
376       "CheckWgtBackgroundCategory");
377   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
378       "CheckWgtNotificationCategory");
379   AddStepAfter<hybrid::encryption::StepEncryptHybridResources>(
380       "CheckWgtImePrivilege");
381   AddStepAfter<tpk::filesystem::StepTpkPatchIcons>("CreateIcons");
382   AddStepAfter<wgt::filesystem::StepWgtPatchIcons>("TpkPatchIcons", true);
383   AddStepAfter<wgt::filesystem::StepCopyPreviewIcons>("WgtPatchIcons");
384   AddStepAfter<wgt::filesystem::StepCreateWgtSymbolicLink>("CopyPreviewIcons");
385   AddStepAfter<tpk::filesystem::StepCreateTpkSymbolicLink>(
386       "CreateWgtSymbolicLink");
387   AddStepAfter<wgt::pkgmgr::StepGenerateXml>("CreateTpkSymbolicLink");
388   AddStepAfter<hybrid::pkgmgr::StepMergeXml>("GenerateXml");
389   AddStepAfter<tpk::pkgmgr::StepManifestAdjustment>("MergeXml");
390   AddStepAfter<hybrid::configuration::StepMergeTpkConfig>("ManifestAdjustment");
391   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
392   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
393       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
394   AddStepAfter<wgt::filesystem::StepWgtPatchStorageDirectories>(
395       "UpdateStorageDirectories");
396 }
397
398 void HybridInstaller::ReadonlyUpdateUninstallSteps() {
399   AppInstaller::ReadonlyUpdateUninstallSteps();
400   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckUpgradable");
401   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
402       wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
403   AddStepAfter<wgt::security::StepCheckSettingsLevel>("Signature");
404   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
405       "CheckSettingsLevel");
406   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
407       "CheckWgtBackgroundCategory");
408   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
409       "CheckWgtNotificationCategory");
410   AddStepBefore<hybrid::configuration::StepMergeTpkConfig>("UpdateApplication");
411   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
412   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
413       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
414   AddStepAfter<hybrid::configuration::StepSetMainapp>("PrivilegeCompatibility");
415 }
416
417 void HybridInstaller::EnablePkgSteps() {
418   AppInstaller::EnablePkgSteps();
419 }
420
421 void HybridInstaller::DisablePkgSteps() {
422   AppInstaller::DisablePkgSteps();
423 }
424
425 void HybridInstaller::MigrateExtImgSteps() {
426   AppInstaller::MigrateExtImgSteps();
427 }
428
429 void HybridInstaller::RecoverDBSteps() {
430   AppInstaller::RecoverDBSteps();
431   AddStepAfter<hybrid::configuration::StepStashTpkConfig>("CheckInstallable");
432   AddStepAfter<wgt::configuration::StepParse>("StashTpkConfig",
433       wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true);
434   AddStepAfter<wgt::security::StepCheckSettingsLevel>("GetPrivilegeLevel");
435   AddStepAfter<wgt::security::StepCheckWgtBackgroundCategory>(
436       "CheckSettingsLevel");
437   AddStepAfter<wgt::security::StepCheckWgtNotificationCategory>(
438       "CheckWgtBackgroundCategory");
439   AddStepAfter<wgt::security::StepCheckWgtImePrivilege>(
440       "CheckWgtNotificationCategory");
441   AddStepBefore<hybrid::configuration::StepMergeTpkConfig>(
442       "RegisterApplication");
443   AddStepAfter<hybrid::configuration::StepMergeTpkPrivileges>("MergeTpkConfig");
444   AddStepAfter<ci::security::StepPrivilegeCompatibility>("MergeTpkPrivileges",
445       ci::security::StepPrivilegeCompatibility::InternalPrivType::BOTH);
446   AddStepAfter<hybrid::configuration::StepSetMainapp>("PrivilegeCompatibility");
447 }
448
449 }  // namespace hybrid
450