Set appinfo for display server 47/314047/2
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 4 Jul 2024 10:21:10 +0000 (19:21 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 4 Jul 2024 10:26:41 +0000 (19:26 +0900)
To solve the timing issue, this patch adds to set the launch appinfo for
display-server.

Change-Id: Ie386d938f5e4cdec2134227bc3d9ec2e002fe458
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
CMakeLists.txt
packaging/app-core.spec
tizen-cpp/app-core-ui-cpp/CMakeLists.txt
tizen-cpp/app-core-ui-cpp/app_core_ui_base.cc
tizen-cpp/app-core-ui-cpp/wayland_handler_private.cc
tizen-cpp/app-core-ui-cpp/wayland_handler_private.hh
unittests/CMakeLists.txt

index c52b31b22bb1e5bd91f201d4288d0e65e15a3c2f..b930e837406c766da6cb8bcaa446cd5b46a9aac4 100644 (file)
@@ -45,6 +45,7 @@ PKG_CHECK_MODULES(GOBJECT_2_DEPS REQUIRED gobject-2.0)
 PKG_CHECK_MODULES(PKGMGR_INFO_DEPS REQUIRED pkgmgr-info)
 PKG_CHECK_MODULES(SENSOR_DEPS REQUIRED sensor)
 PKG_CHECK_MODULES(TIZEN_EXTENSION_CLIENT_DEPS REQUIRED tizen-extension-client)
+PKG_CHECK_MODULES(TIZEN_LAUNCH_CLIENT_DEPS REQUIRED tizen-launch-client)
 PKG_CHECK_MODULES(TIZEN_SHARED_QUEUE_DEPS REQUIRED tizen-shared-queue)
 PKG_CHECK_MODULES(TTRACE_DEPS REQUIRED ttrace)
 PKG_CHECK_MODULES(VCONF_DEPS REQUIRED vconf)
index cec16b5ee6be0cbe19ffa19669709da3798108c7..e201ec106433ff9be30aef4be6d277b5208d17a8 100644 (file)
@@ -22,6 +22,7 @@ BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(sensor)
 BuildRequires:  pkgconfig(tizen-extension-client)
 BuildRequires:  pkgconfig(tizen-shared-queue)
+BuildRequires:  pkgconfig(tizen-launch-client)
 BuildRequires:  pkgconfig(ttrace)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(wayland-client)
index 2e5fa178b7b4efe4f322fd57ba4b56ef9cd4de42..e9e7bc9ce76d977e5a038e151311f0fdaeb68307 100644 (file)
@@ -32,6 +32,7 @@ APPLY_PKG_CONFIG(${TARGET_APP_CORE_UI_CPP} PUBLIC
   GOBJECT_2_DEPS
   PKGMGR_INFO_DEPS
   TIZEN_EXTENSION_CLIENT_DEPS
+  TIZEN_LAUNCH_CLIENT_DEPS
   TIZEN_SHARED_QUEUE_DEPS
   TTRACE_DEPS
   WAYLAND_CLIENT_DEPS
index beeef295c50b54b3ac62995abdac90f67aafc490..347f7fcdf16347004703abcdb24039bb87fe4380 100644 (file)
@@ -126,6 +126,7 @@ class AppCoreUiBase::Impl : public AppCoreRotation::IEventListener {
   void RotationInit();
   void RotationShutdown();
   void OnRotationChanged(int degree) override;
+  void SetAppInfo();
 
   std::list<std::shared_ptr<WinNode>> winnode_list_;
   unsigned int hint_;
@@ -284,6 +285,12 @@ void AppCoreUiBase::Impl::SetAppId() {
   wl_handler_->SetAppId(appid_);
 }
 
+void AppCoreUiBase::Impl::SetAppInfo() {
+  if (wl_handler_->Init() < 0) return;
+
+  wl_handler_->SetAppInfo(appid_);
+}
+
 void AppCoreUiBase::Impl::PluginInit(int argc, char** argv) {
   LogTracer tracer("AppCoreUiBase::Impl::PluginInit()");
   plugin_.reset(AppCoreUiPlugin::Load());
@@ -509,6 +516,7 @@ void AppCoreUiBase::DoRun(int argc, char** argv) {
   if (impl_->hint_ & HINT_WINDOW_ID_CONTROL)
     impl_->SetAppId();
 
+  impl_->SetAppInfo();
   AppCoreBase::Run(argc, argv);
 }
 
index e1d3ff6dc05df96b44e312e35435b8630d163320..b0a3b2ed8cb3ddbf7310330063ec362f0163939d 100644 (file)
@@ -55,7 +55,7 @@ int WaylandHandler::Init() {
   wl_registry_add_listener(reg_, &reg_listener_, this);
   wl_display_roundtrip(dsp_);
 
-  if (tz_policy_ == nullptr) {
+  if (tz_policy_ == nullptr || launch_appinfo_ == nullptr) {
     _E("Failed to get tizen policy interface");
     Fini();
     return -1;
@@ -110,14 +110,32 @@ void WaylandHandler::SetAppId(const std::string& app_id) {
   _D("Set AppId: %s", app_id.c_str());
 }
 
+void WaylandHandler::SetAppInfo(const std::string& app_id) {
+  if (!initialized_) return;
+
+  tizen_launch_appinfo_set_pid(launch_appinfo_, app_id.c_str(),
+                               static_cast<uint32_t>(getpid()));
+  tizen_launch_appinfo_ready_metadata(launch_appinfo_, app_id.c_str(),
+                                      static_cast<uint32_t>(getpid()));
+  wl_display_flush(dsp_);
+  _W("appid=%s, pid=%d", app_id.c_str(), getpid());
+}
+
 void WaylandHandler::WlListenerCb(void* data, struct wl_registry* reg,
-    uint32_t id, const char* interface, uint32_t ver) {
+                                  uint32_t id, const char* interface,
+                                  uint32_t ver) {
+  auto* handle = static_cast<WaylandHandler*>(data);
   if (interface && !strcmp(interface, "tizen_policy")) {
-    auto* handle = static_cast<WaylandHandler*>(data);
     if (handle->tz_policy_ == nullptr) {
-      handle->tz_policy_ = reinterpret_cast<struct tizen_policy*>(
-          wl_registry_bind(reinterpret_cast<struct wl_registry*>(handle->reg_),
-            id, &tizen_policy_interface, 7));
+      handle->tz_policy_ = reinterpret_cast<tizen_policy*>(
+          wl_registry_bind(reinterpret_cast<wl_registry*>(handle->reg_),
+                           id, &tizen_policy_interface, 7));
+    }
+  } else if (interface && !strcmp(interface, "tizen_launch_appinfo")) {
+    if (handle->launch_appinfo_ == nullptr) {
+      handle->launch_appinfo_ = reinterpret_cast<tizen_launch_appinfo*>(
+          wl_registry_bind(reinterpret_cast<wl_registry*>(handle->reg_), id,
+                           &tizen_launch_appinfo_interface, 2));
     }
   }
 }
index 16dbe67cd3998696c2a85ea9dfe701237d07081e..43c1dabd87ae00f747c5f616bb8758aa71a3ffec 100644 (file)
@@ -18,6 +18,7 @@
 #define TIZEN_CPP_APP_CORE_UI_CPP_WAYLAND_HANDLER_PRIVATE_HH_
 
 #include <tizen-extension-client-protocol.h>
+#include <tizen-launch-client-protocol.h>
 #include <wayland-client.h>
 #include <wayland-tbm-client.h>
 
@@ -35,6 +36,7 @@ class WaylandHandler {
   void SetBgState();
   void UnsetBgState();
   void SetAppId(const std::string& app_id);
+  void SetAppInfo(const std::string& app_id);
 
  private:
   static void WlListenerCb(void* data, struct wl_registry* reg,
@@ -47,6 +49,7 @@ class WaylandHandler {
   struct wl_display* dsp_ = nullptr;
   struct wl_registry* reg_ = nullptr;
   struct tizen_policy* tz_policy_ = nullptr;
+  tizen_launch_appinfo* launch_appinfo_ = nullptr;
 
   const struct wl_registry_listener reg_listener_ = {
     WlListenerCb,
index fa272bf5892047ba2a4fbac24c15e9c379c50537..c7aef408873c0dc6eff43793eb1b0bbeac8e34b0 100644 (file)
@@ -50,6 +50,7 @@ APPLY_PKG_CONFIG(${TARGET_UNIT_TEST} PUBLIC
   PKGMGR_INFO_DEPS
   SENSOR_DEPS
   TIZEN_EXTENSION_CLIENT_DEPS
+  TIZEN_LAUNCH_CLIENT_DEPS
   TIZEN_SHARED_QUEUE_DEPS
   TTRACE_DEPS
   VCONF_DEPS