Fix Recovery of ReadonlyUpdateInstall package's update
[platform/core/appfw/app-installers.git] / src / common / step / pkgmgr / step_recover_application.h
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 #ifndef COMMON_STEP_PKGMGR_STEP_RECOVER_APPLICATION_H_
6 #define COMMON_STEP_PKGMGR_STEP_RECOVER_APPLICATION_H_
7
8 #include <manifest_parser/utils/logging.h>
9
10 #include "common/installer_context.h"
11 #include "common/step/recovery/step_recovery.h"
12
13 namespace common_installer {
14 namespace pkgmgr {
15
16 /**
17  * @brief recovers applications entries in pkgmgr
18  *
19  * Part of RecoveryMode. In case of partial installation
20  * app get unregistered with pkgmgr. In case of unsuccessful
21  * update app in state before update gets re-registered
22  */
23 class StepRecoverApplication : public recovery::StepRecovery {
24  public:
25   using StepRecovery::StepRecovery;
26   Status RecoveryNew() override;
27   Status RecoveryUpdate() override;
28   Status RecoveryReadonlyUpdateInstall() override;
29
30  private:
31   bool SetXmlPaths();
32   void SetExtAttrForPreloadPackage(bool is_updated, bool is_removable,
33       bool is_system);
34   bool UnregisterApplication();
35   bool RegisterApplication();
36
37   STEP_NAME(RecoverApplication)
38 };
39
40 }  // namespace pkgmgr
41 }  // namespace common_installer
42
43 #endif  // COMMON_STEP_PKGMGR_STEP_RECOVER_APPLICATION_H_