Fix a bug about restarting apps 46/302046/2
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 30 Nov 2023 04:29:51 +0000 (13:29 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 30 Nov 2023 04:51:04 +0000 (13:51 +0900)
After updating the package, the application was not restarted by amd.
Because, if the application has the on-boot="true" option in
the tizen-manifest.xm, amd does not check whether the application is
able to restart or not.
If the api-version is greater than 7, amd must check whether the application
should be restarted or not.
This patch checks the api version to restart apps.

Change-Id: Ibfe8245782cd5b0d5b6dc3bd7eda3363379c85b7
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/app_info/app_info_manager.cc
src/lib/boot_sequencer/boot_sequencer.cc

index 10e1d00..f0586b9 100644 (file)
@@ -894,7 +894,8 @@ int AppInfoManager::PkgmgrEventUpdateHandler(const pkgmgrinfo_appinfo_h handle,
     return -1;
   }
 
-  if (app_info->GetOnboot() == "false")
+  if (app_info->GetOnboot() == "false" ||
+      strverscmp(app_info->GetApiVersion().c_str(), "7") >= 0)
     _restart_manager_restart_app(chunk->GetUid(), appid);
 
   return 0;
index 4864af1..63a87f1 100644 (file)
@@ -52,7 +52,6 @@ constexpr const char TAG_INFO_PATH_EXISTS[] = "INFO:PATH_EXISTS";
 constexpr const char TAG_INFO_TIMEOUT[] = "INFO:TIMEOUT";
 
 constexpr const char REQUIRED_API_VERSION[] = "7";
-constexpr const char REQUIRED_DOTNET_API_VERSION[] = "10";
 
 }  // namespace
 
@@ -542,13 +541,7 @@ void BootSequencer::StartLegacyOnbootApp(const char* appid, uid_t uid) {
     return;
 
   _D("%s : %u", appid, uid);
-  const char* required_api_version;
-  if (app_info->GetApptype().find("dotnet") != std::string::npos)
-    required_api_version = REQUIRED_DOTNET_API_VERSION;
-  else
-    required_api_version = REQUIRED_API_VERSION;
-
-  if (strverscmp(required_api_version, app_info->GetApiVersion().c_str()) > 0) {
+  if (strverscmp(REQUIRED_API_VERSION, app_info->GetApiVersion().c_str()) > 0) {
     int ret = _launch_start_onboot_app_local(uid, appid, app_info.get());
     _W("%s : %u : %d", appid, uid, ret);
   }