Add screen-connector-launcher-service C API 53/217453/5
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 12 Nov 2019 02:07:38 +0000 (11:07 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 13 Nov 2019 02:13:02 +0000 (11:13 +0900)
Adds:
 - screen_connector_launcher_service_create()
 - screen_connector_launcher_service_destroy()
 - screen_connector_launcher_service_set_ops()
 - screen_connector_launcher_service_launch()
 - screen_connector_launcher_service_launch_with_shared_widget()
 - screen_connector_launcher_service_launching()
 - screen_connector_launcher_service_launch_cancel()
 - screen_connector_launcher_service_launch_done()
 - screen_connector_launcher_service_image_get_direction()
 - screen_connector_launcher_service_image_get_type()
 - screen_connector_launcher_service_image_get_position_x()
 - screen_connector_launcher_service_image_get_position_y()
 - screen_connector_launcher_service_image_get_shared_widget_info()
 - screen_connector_launcher_service_image_get_tbm_surface_info()
 - screen_connector_launcher_service_image_get_image_file()
 - screen_connector_launcher_service_image_get_file_path()
 - screen_connector_launcher_service_image_get_file_group()

Change-Id: I71d7d98868e5d905a37221fbdc6aa59ebb1aa117
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
packaging/libscreen_connector.spec
screen_connector_common/wl_buffer.h
screen_connector_launcher_service/CMakeLists.txt
screen_connector_launcher_service/include/screen_connector_launcher_service.h [new file with mode: 0644]
screen_connector_launcher_service/screen_connector_launcher_service.pc.in
screen_connector_launcher_service/stub.cc [new file with mode: 0644]

index 795cb44..d9c240c 100644 (file)
@@ -24,6 +24,7 @@ BuildRequires: pkgconfig(wayland-client)
 BuildRequires: pkgconfig(ecore-wl2)
 BuildRequires: pkgconfig(gmock)
 BuildRequires: pkgconfig(tzsh-launcher-service)
+BuildRequires: pkgconfig(libtbm)
 
 %description
 API for creating a new instance of the widget and managing its life-cycle.
@@ -267,7 +268,7 @@ Header & package files to support development of the launcher applications.
 %license LICENSE
 
 %files -n %{name}_launcher_service-devel
-%{_includedir}/screen_connector_launcher_service/*.h
+%{_includedir}/screen_connector_launcher_service/*
 %{_libdir}/pkgconfig/screen_connector_launcher_service.pc
 %attr(0644,root,root) %{_libdir}/%{name}_launcher_service.so
 
index 32e3518..90c4085 100644 (file)
@@ -33,20 +33,44 @@ namespace screen_connector {
 class EXPORT WlBuffer : public Handle<struct wl_buffer*> {
  public:
   WlBuffer(struct wl_buffer* raw, struct tizen_remote_surface* trs)
-    : Handle<struct wl_buffer*>(raw, true), trs_(trs) { }
+    : Handle<struct wl_buffer*>(raw, true),
+      trs_(trs),
+      tbm_surface_info_(nullptr, std::free) { }
 
   virtual ~WlBuffer() {
     if (GetRaw() != nullptr) {
       tizen_remote_surface_release(trs_, GetRaw());
       tbm_surface_h tbm_surface = static_cast<tbm_surface_h>(
           wl_buffer_get_user_data(GetRaw()));
+
+      if (tbm_surface_info_.get() != nullptr)
+        tbm_surface_unmap(tbm_surface);
+
       tbm_surface_internal_unref(tbm_surface);
       wl_buffer_destroy(GetRaw());
     }
   }
 
+  tbm_surface_info_s* GetTbmSurfaceInfo() {
+    if (tbm_surface_info_ != nullptr)
+      return tbm_surface_info_.get();
+
+    tbm_surface_info_s* surface_info = static_cast<tbm_surface_info_s*>(
+        calloc(1, sizeof(tbm_surface_info_s)));
+    if (surface_info == nullptr)
+      return nullptr;
+
+    tbm_surface_h tbm_surface = static_cast<tbm_surface_h>(
+        wl_buffer_get_user_data(GetRaw()));
+    tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, surface_info);
+    tbm_surface_info_.reset(surface_info);
+
+    return tbm_surface_info_.get();
+  }
+
  private:
   struct tizen_remote_surface* trs_;
+  std::unique_ptr<tbm_surface_info_s, decltype(std::free)*> tbm_surface_info_;
 };
 
 }  // namespace screen_connector
index 3a182ff..ac0c8d6 100644 (file)
@@ -10,14 +10,15 @@ SET(VERSION "${FULLVER}")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(screen_connector_launcher_service REQUIRED
-       dlog
        aul
-       wayland-tbm-client
-       wayland-client
+       dlog
        ecore-wl2
+       glib-2.0
+       libtbm
        tizen-remote-surface-client
        tzsh-launcher-service
-       glib-2.0
+       wayland-client
+       wayland-tbm-client
 )
 
 FOREACH(flag ${screen_connector_launcher_service_CFLAGS})
@@ -30,6 +31,7 @@ SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
 ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
diff --git a/screen_connector_launcher_service/include/screen_connector_launcher_service.h b/screen_connector_launcher_service/include/screen_connector_launcher_service.h
new file mode 100644 (file)
index 0000000..ce433ee
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_LAUNCHER_SERVICE_INCLUDE_SCREEN_CONNECTOR_LAUNCHER_SERVICE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_INCLUDE_SCREEN_CONNECTOR_LAUNCHER_SERVICE_H_
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include <Ecore_Wl2.h>
+#include <tbm_surface.h>
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_NONE,
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_DISQUALIFIED,
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_WRONG_REQUEST,
+} screen_connector_launcher_service_error_e;
+
+typedef enum {
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_FORWARD,
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_BACKWARD,
+} screen_connector_launcher_service_direction_e;
+
+typedef enum {
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_REMOTE_SURFACE_TBM,
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_REMOTE_SURFACE_IMAGE_FILE,
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_SPLASH_SCREEN_IMAGE,
+  SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_SPLASH_SCREEN_EDJE,
+} screen_connector_launcher_service_image_type_e;
+
+typedef void* screen_connector_launcher_service_h;
+
+typedef void* screen_connector_launcher_service_image_h;
+
+typedef void (*screen_connector_launcher_service_prepare_cb)(
+  screen_connector_launcher_service_image_h image,
+  uint32_t serial,
+  void* user_data);
+
+typedef void (*screen_connector_launcher_service_stop_cb)(
+  uint32_t serial,
+  void* user_data);
+
+typedef void (*screen_connector_launcher_service_error_cb)(
+  screen_connector_launcher_service_error_e error,
+  uint32_t serial,
+  void* user_data);
+
+typedef void (*screen_connector_launcher_service_cleanup_cb)(
+  uint32_t serial,
+  void* user_data);
+
+typedef void (*screen_connector_launcher_service_reset_cb)(
+  uint32_t serial,
+  void* user_data);
+
+typedef struct {
+  screen_connector_launcher_service_prepare_cb prepare;
+  screen_connector_launcher_service_stop_cb stop;
+  screen_connector_launcher_service_error_cb error;
+  screen_connector_launcher_service_cleanup_cb cleanup;
+  screen_connector_launcher_service_reset_cb reset;
+} screen_connector_launcher_service_ops;
+
+int screen_connector_launcher_service_create(
+  Ecore_Wl2_Window* wl2_win,
+  screen_connector_launcher_service_h* handle);
+
+int screen_connector_launcher_service_destroy(
+  screen_connector_launcher_service_h handle);
+
+int screen_connector_launcher_service_set_ops(
+  screen_connector_launcher_service_h handle,
+  screen_connector_launcher_service_ops *ops,
+  void* user_data);
+
+int screen_connector_launcher_service_launch(
+  screen_connector_launcher_service_h handle,
+  const char* app_id,
+  const char* inst_id,
+  int pid,
+  uint32_t serial);
+
+int screen_connector_launcher_service_launch_with_shared_widget(
+  screen_connector_launcher_service_h handle,
+  const char* app_id,
+  const char* inst_id,
+  int pid,
+  uint32_t serial);
+
+int screen_connector_launcher_service_launching(
+  screen_connector_launcher_service_h handle,
+  uint32_t serial);
+
+int screen_connector_launcher_service_launch_cancel(
+  screen_connector_launcher_service_h handle,
+  uint32_t serial);
+
+int screen_connector_launcher_service_launch_done(
+  screen_connector_launcher_service_h handle,
+  uint32_t serial);
+
+int screen_connector_launcher_service_image_get_direction(
+  screen_connector_launcher_service_image_h handle,
+  screen_connector_launcher_service_direction_e* direction);
+
+int screen_connector_launcher_service_image_get_type(
+  screen_connector_launcher_service_image_h handle,
+  screen_connector_launcher_service_image_type_e *image_type);
+
+int screen_connector_launcher_service_image_get_position_x(
+  screen_connector_launcher_service_image_h handle,
+  int32_t* x);
+
+int screen_connector_launcher_service_image_get_position_y(
+  screen_connector_launcher_service_image_h handle,
+  int32_t* y);
+
+int screen_connector_launcher_service_image_get_shared_widget_info(
+  screen_connector_launcher_service_image_h handle,
+  char** shared_widget_info);
+
+int screen_connector_launcher_service_image_get_tbm_surface_info(
+  screen_connector_launcher_service_image_h handle,
+  tbm_surface_info_s** tbm_surface_info);
+
+int screen_connector_launcher_service_image_get_image_file(
+  screen_connector_launcher_service_image_h handle,
+  int32_t* fd, uint32_t* size);
+
+int screen_connector_launcher_service_image_get_file_path(
+  screen_connector_launcher_service_image_h handle,
+  char** file_path);
+
+int screen_connector_launcher_service_image_get_file_group(
+  screen_connector_launcher_service_image_h handle,
+  char** file_group);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // SCREEN_CONNECTOR_LAUNCHER_SERVICE_INCLUDE_SCREEN_CONNECTOR_LAUNCHER_SERVICE_H_
index 0c41770..93ce8ea 100644 (file)
@@ -6,7 +6,7 @@ includedir=@INCLUDEDIR@
 Name: screen_connector_launcher_service
 Description: Support development of the Screen Connector Launcher Service library
 Version: @VERSION@
-Requires: tzsh-launcher-service
+Requires: tzsh-launcher-service libtbm ecore-wl2
 Libs: -L${libdir} -lscreen_connector_launcher_service
-Cflags: -I${includedir}
+Cflags: -I${includedir} -I${includedir}/include
 cppflags: -I${includedir}
diff --git a/screen_connector_launcher_service/stub.cc b/screen_connector_launcher_service/stub.cc
new file mode 100644 (file)
index 0000000..d6d71f7
--- /dev/null
@@ -0,0 +1,426 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_launcher_service/include/screen_connector_launcher_service.h"
+#include "screen_connector_launcher_service/launcher_service.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace {
+
+static screen_connector_launcher_service_error_e __convert_error(
+    screen_connector::Error error) {
+  if (error == screen_connector::Error::Disqualified) {
+    return SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_DISQUALIFIED;
+  } else if (error == screen_connector::Error::WrongRequest) {
+    return SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_WRONG_REQUEST;
+  } else {
+    return SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_NONE;
+  }
+}
+
+static screen_connector_launcher_service_direction_e __convert_direction(
+    screen_connector::Direction direction) {
+  if (direction == screen_connector::Direction::Forward)
+    return SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_FORWARD;
+
+  return SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_BACKWARD;
+}
+
+static screen_connector_launcher_service_image_type_e __convert_image_type(
+    screen_connector::ImageType image_type) {
+  if (image_type == screen_connector::ImageType::RemoteSurfaceTBM) {
+    return SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_REMOTE_SURFACE_TBM;
+  } else if (image_type == screen_connector::ImageType::RemoteSurfaceImageFile) {
+    return SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_REMOTE_SURFACE_IMAGE_FILE;
+  } else if (image_type == screen_connector::ImageType::SplashScreenImage) {
+    return SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_SPLASH_SCREEN_IMAGE;
+  } else {
+    return SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_SPLASH_SCREEN_EDJE;
+  }
+}
+
+class LauncherServiceStub
+  : public screen_connector::LauncherService,
+    public screen_connector::LauncherService::IEventListener {
+ public:
+  LauncherServiceStub(std::shared_ptr<screen_connector::Wl2Window> wl2_win)
+    : screen_connector::LauncherService(std::move(wl2_win), this) {
+  }
+
+  void SetOps(screen_connector_launcher_service_ops* ops,
+              void* user_data) {
+    ops_ = *ops;
+    user_data_ = user_data;
+  }
+
+  void OnPrepareEvent(std::shared_ptr<screen_connector::RawImage> image,
+                      uint32_t serial) override {
+    raw_image_ = std::move(image);
+    if (ops_.prepare) {
+      ops_.prepare(reinterpret_cast<void*>(&raw_image_), serial, user_data_);
+    }
+  }
+
+  void OnStopEvent(uint32_t serial) override {
+    if (ops_.stop) {
+      ops_.stop(serial, user_data_);
+    }
+  }
+
+  void OnErrorEvent(screen_connector::Error error,
+                    uint32_t serial) override {
+    if (ops_.error) {
+      ops_.error(__convert_error(error), serial, user_data_);
+    }
+  }
+
+  void OnCleanUpEvent(uint32_t serial) override {
+    if (ops_.cleanup) {
+      ops_.cleanup(serial, user_data_);
+    }
+  }
+
+  void OnResetEvent(uint32_t serial) override {
+    if (ops_.reset) {
+      ops_.reset(serial, user_data_);
+    }
+    raw_image_.reset();
+  }
+
+ private:
+  screen_connector_launcher_service_ops ops_ = { 0, };
+  void* user_data_ = nullptr;
+  std::shared_ptr<screen_connector::RawImage> raw_image_;
+};
+
+}  // namespace
+
+extern "C" EXPORT int screen_connector_launcher_service_create(
+    Ecore_Wl2_Window* wl2_win,
+    screen_connector_launcher_service_h* handle) {
+  if (wl2_win == nullptr || handle == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto ls = new (std::nothrow) LauncherServiceStub(
+      std::shared_ptr<screen_connector::Wl2Window>(
+          new (std::nothrow) screen_connector::Wl2Window(wl2_win)));
+
+  *handle = static_cast<void*>(ls);
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_destroy(
+    screen_connector_launcher_service_h handle) {
+  if (handle == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto ls = static_cast<LauncherServiceStub*>(handle);
+  delete ls;
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_set_ops(
+    screen_connector_launcher_service_h handle,
+    screen_connector_launcher_service_ops* ops,
+    void* user_data) {
+  if (handle == nullptr || ops == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto ls = static_cast<LauncherServiceStub*>(handle);
+  ls->SetOps(ops, user_data);
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_launch(
+    screen_connector_launcher_service_h handle,
+    const char* app_id,
+    const char* inst_id,
+    int pid,
+    uint32_t serial) {
+ if (handle == nullptr || app_id == nullptr || pid < -1) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto ls = static_cast<LauncherServiceStub*>(handle);
+  return ls->Launch(app_id, inst_id, pid, serial);
+}
+
+extern "C" EXPORT int
+screen_connector_launcher_service_launch_with_shared_widget (
+    screen_connector_launcher_service_h handle,
+    const char* app_id,
+    const char* inst_id,
+    int pid,
+    uint32_t serial) {
+ if (handle == nullptr || app_id == nullptr || pid < -1) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto ls = static_cast<LauncherServiceStub*>(handle);
+  return ls->LaunchWithSharedWidget(app_id, inst_id, pid, serial);
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_launching(
+    screen_connector_launcher_service_h handle,
+    uint32_t serial) {
+  if (handle == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto ls = static_cast<LauncherServiceStub*>(handle);
+  return ls->Launching(serial);
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_launch_cancel(
+    screen_connector_launcher_service_h handle,
+    uint32_t serial) {
+  if (handle == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto ls = static_cast<LauncherServiceStub*>(handle);
+  return ls->LaunchCancel(serial);
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_launch_done(
+    screen_connector_launcher_service_h handle,
+    uint32_t serial) {
+  if (handle == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto ls = static_cast<LauncherServiceStub*>(handle);
+  return ls->LaunchDone(serial);
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_image_get_direction(
+    screen_connector_launcher_service_image_h handle,
+    screen_connector_launcher_service_direction_e* direction) {
+  if (handle == nullptr || direction == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+      reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *direction = __convert_direction(img->GetDirection());
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_image_get_type(
+    screen_connector_launcher_service_image_h handle,
+    screen_connector_launcher_service_image_type_e* image_type) {
+  if (handle == nullptr || image_type == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+      reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *image_type = __convert_image_type(img->GetImageType());
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_image_get_position_x(
+    screen_connector_launcher_service_image_h handle,
+    int32_t* x) {
+  if (handle == nullptr || x == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+      reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *x = img->GetPositionX();
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_image_get_position_y(
+  screen_connector_launcher_service_image_h handle,
+  int32_t* y) {
+  if (handle == nullptr || y == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+    reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *y = img->GetPositionY();
+
+  return 0;
+}
+
+extern "C" EXPORT int
+screen_connector_launcher_service_image_get_shared_widget_info(
+  screen_connector_launcher_service_image_h handle,
+  char** shared_widget_info) {
+  if (handle == nullptr || shared_widget_info == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+    reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *shared_widget_info = strdup(img->GetSharedWidgetInfo().c_str());
+  if (*shared_widget_info == nullptr) {
+    _E("Out of memory");
+    return -ENOMEM;
+  }
+
+  return 0;
+}
+
+extern "C" EXPORT int
+screen_connector_launcher_service_image_get_tbm_surface_info(
+  screen_connector_launcher_service_image_h handle,
+  tbm_surface_info_s** tbm_surface_info) {
+  if (handle == nullptr || tbm_surface_info == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+    reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *tbm_surface_info = img->GetWlBuffer()->GetTbmSurfaceInfo();
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_image_get_image_file(
+  screen_connector_launcher_service_image_h handle,
+  int32_t* fd, uint32_t* size) {
+  if (handle == nullptr || fd == nullptr || size == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+    reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *fd = img->GetImageFile()->GetRaw();
+  *size = img->GetImageFile()->GetSize();
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_image_get_file_path(
+  screen_connector_launcher_service_image_h handle,
+  char** file_path) {
+  if (handle == nullptr || file_path == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+    reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *file_path = strdup(img->GetFilePath().c_str());
+  if (*file_path == nullptr) {
+    _E("Out of memory");
+    return -ENOMEM;
+  }
+
+  return 0;
+}
+
+extern "C" EXPORT int screen_connector_launcher_service_image_get_file_group(
+  screen_connector_launcher_service_image_h handle,
+  char** file_group) {
+  if (handle == nullptr || file_group == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  auto img_ptr =
+    reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle);
+  auto img = img_ptr->get();
+  if (img == nullptr) {
+    _E("Invalid parameter");
+    return -EINVAL;
+  }
+
+  *file_group = strdup(img->GetFileGroup().c_str());
+  if (*file_group == nullptr) {
+    _E("Out of memory");
+    return -ENOMEM;
+  }
+
+  return 0;
+}