Modify setting AUL_APPID environment variable for multiple instance 18/296118/4
authorChanggyu Choi <changyu.choi@samsung.com>
Thu, 20 Jul 2023 05:09:24 +0000 (14:09 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Thu, 20 Jul 2023 05:29:42 +0000 (14:29 +0900)
When an app is launched as multiple instances, appid should include
instance id to distinguish them.
launchpad set AUL_APPID environment variable as original appid.

Change-Id: Ie0cae1d5d10d51024ea1bd25ca6299ea15e4fac8
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/lib/launchpad-common/aul_keys.hh
src/lib/launchpad-glib/util.cc

index 82fb1db..6b478f1 100644 (file)
@@ -51,6 +51,7 @@ constexpr const char kAulMountGlobalResDir[] =  "__AUL_MOUNT_GLOBAL_RES_DIR__";
 constexpr const char kAulMountAllowedResDir[] = "__AUL_MOUNT_ALLOWED_RES_DIR__";
 constexpr const char kAulEnabledLightUser[] = "__AUL_ENABLED_LIGHT_USER__";
 constexpr const char kAulMountResPkgIds[] = "__AUL_MOUNT_RES_PKGIDS__";
+constexpr const char kAulOrgAppId[] = "__AUL_ORG_APPID__";
 
 }  // namespace launchpad
 
index f2588be..08b6518 100644 (file)
@@ -342,8 +342,13 @@ void Util::SetEnvironments(const AppInfo* app_info) {
   if (!app_info->GetRootPath().empty())
     setenv("AUL_ROOT_PATH", app_info->GetRootPath().c_str(), 1);
 
-  if (!app_info->GetAppId().empty())
-    setenv("AUL_APPID", app_info->GetAppId().c_str(), 1);
+  if (!app_info->GetAppId().empty()) {
+    auto org_app_id = b.GetString(kAulOrgAppId);
+    if (!org_app_id.empty())
+      setenv("AUL_APPID", org_app_id.c_str(), 1);
+    else
+      setenv("AUL_APPID", app_info->GetAppId().c_str(), 1);
+  }
 
   if (!app_info->GetPkgId().empty())
     setenv("AUL_PKGID", app_info->GetPkgId().c_str(), 1);