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