Fix Recovery of ReadonlyUpdateInstall package's update 77/282777/2 tizen_3.0
authorIlho Kim <ilho159.kim@samsung.com>
Wed, 21 Sep 2022 10:35:03 +0000 (19:35 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Tue, 11 Oct 2022 09:10:31 +0000 (18:10 +0900)
Fix that the package system attribute is changed
when recovery is performed becuase the installer is terminated during
the update of the ReadonlyUpdateInstalled package

Change-Id: I23d2afb9a73864f0da286bdb430cd792f583b833
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
(cherry picked from commit 68bf3d4069fb9bd6f139e2e0e993264541076636)

src/common/step/pkgmgr/step_recover_application.cc
src/common/step/pkgmgr/step_recover_application.h

index 9df6a220905b48da0ea7825f2e0680f14b82efe9..e7054663deb8c0db3f83d9026bfefd13cb09a669 100644 (file)
@@ -30,7 +30,8 @@ Step::Status StepRecoverApplication::RecoveryUpdate() {
   if (QueryIsPreloadPackage(context_->pkgid.get(), context_->uid.get()))
     SetExtAttrForPreloadPackage(
         QueryIsUpdatedPackage(context_->pkgid.get(), context_->uid.get()),
-        QueryIsRemovablePackage(context_->pkgid.get(), context_->uid.get()));
+        QueryIsRemovablePackage(context_->pkgid.get(), context_->uid.get()),
+        QueryIsSystemPackage(context_->pkgid.get(), context_->uid.get()));
   UnregisterApplication();
   if (!RegisterApplication()) {
     LOG(ERROR) << "Unsuccessful app registration";
@@ -44,7 +45,7 @@ Step::Status StepRecoverApplication::RecoveryReadonlyUpdateInstall() {
     LOG(ERROR) << "Some parameters are lacking";
     return Status::ERROR;
   }
-  SetExtAttrForPreloadPackage(false, false);
+  SetExtAttrForPreloadPackage(false, false, true);
   UnregisterApplication();
   if (!RegisterApplication()) {
     LOG(ERROR) << "Unsuccessful app registration";
@@ -67,14 +68,14 @@ bool StepRecoverApplication::SetXmlPaths() {
 }
 
 void StepRecoverApplication::SetExtAttrForPreloadPackage(
-    bool is_updated, bool is_removable) {
+    bool is_updated, bool is_removable, bool is_system) {
   manifest_x* manifest_data = context_->manifest_data.get();
   free(manifest_data->preload);
   manifest_data->preload = strdup("true");
   free(manifest_data->update);
   manifest_data->update = strdup(is_updated ? "true" : "false");
   free(manifest_data->system);
-  manifest_data->system = strdup(is_removable ? "false" : "true");
+  manifest_data->system = strdup(is_system ? "true" : "false");
   free(manifest_data->readonly);
   manifest_data->readonly = strdup(is_removable ? "false" : "true");
   free(manifest_data->removable);
index 6cd40e6be1275b0953608f33a9f8473d307c0a33..b4fadd157e739132ee51c6038f098b894e8339c6 100644 (file)
@@ -29,7 +29,8 @@ class StepRecoverApplication : public recovery::StepRecovery {
 
  private:
   bool SetXmlPaths();
-  void SetExtAttrForPreloadPackage(bool is_updated, bool is_removable);
+  void SetExtAttrForPreloadPackage(bool is_updated, bool is_removable,
+      bool is_system);
   bool UnregisterApplication();
   bool RegisterApplication();