summaryrefslogtreecommitdiff
path: root/screen_connector_launcher_service
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2019-08-25 16:31:09 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2019-10-14 13:11:27 +0900
commit6c772a24d250f0e2df09b2a703d892daef40e26c (patch)
treebdbef32140ab9713cbee8b47088c3ec3f3cf0d6e /screen_connector_launcher_service
parent1d19cd8369ceee600f626d7f4ab70e830ad67516 (diff)
downloadscreen-connector-6c772a24d250f0e2df09b2a703d892daef40e26c.tar.gz
screen-connector-6c772a24d250f0e2df09b2a703d892daef40e26c.tar.bz2
screen-connector-6c772a24d250f0e2df09b2a703d892daef40e26c.zip
Support Seamless Effect
Adds: - screen_connector_launcher_service - screen_connector_launcher_service_evas - screen_connector_shared_widget_launch Requires: - https://review.tizen.org/gerrit/#/c/platform/core/appfw/amd/+/212912/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-core/+/215390/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/aul-1/+/212287/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/screen-connector/+/212645/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/widget-viewer/+/213445/ Change-Id: Iadf0983dd75a3f3c3b21e8eac1e3b9bceb306b5e Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
Diffstat (limited to 'screen_connector_launcher_service')
-rw-r--r--screen_connector_launcher_service/CMakeLists.txt53
-rw-r--r--screen_connector_launcher_service/LICENSE204
-rw-r--r--screen_connector_launcher_service/direction.h37
-rw-r--r--screen_connector_launcher_service/error.h38
-rw-r--r--screen_connector_launcher_service/image_file.h48
-rw-r--r--screen_connector_launcher_service/image_type.h39
-rw-r--r--screen_connector_launcher_service/launcher_service.cc203
-rw-r--r--screen_connector_launcher_service/launcher_service.h66
-rw-r--r--screen_connector_launcher_service/launcher_service_implementation.h108
-rw-r--r--screen_connector_launcher_service/log_internal.h48
-rw-r--r--screen_connector_launcher_service/raw_image.cc106
-rw-r--r--screen_connector_launcher_service/raw_image.h78
-rw-r--r--screen_connector_launcher_service/screen_connector_launcher_service.pc.in12
-rw-r--r--screen_connector_launcher_service/tizen_remote_surface_internal.cc125
-rw-r--r--screen_connector_launcher_service/tizen_remote_surface_internal.h104
-rw-r--r--screen_connector_launcher_service/tizen_remote_surface_manager_internal.cc85
-rw-r--r--screen_connector_launcher_service/tizen_remote_surface_manager_internal.h52
-rw-r--r--screen_connector_launcher_service/tzsh_launcher_service_internal.cc127
-rw-r--r--screen_connector_launcher_service/tzsh_launcher_service_internal.h99
19 files changed, 1632 insertions, 0 deletions
diff --git a/screen_connector_launcher_service/CMakeLists.txt b/screen_connector_launcher_service/CMakeLists.txt
new file mode 100644
index 0000000..3a182ff
--- /dev/null
+++ b/screen_connector_launcher_service/CMakeLists.txt
@@ -0,0 +1,53 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(screen_connector_launcher_service CXX)
+
+SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR "${MAJORVER}")
+SET(VERSION "${FULLVER}")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(screen_connector_launcher_service REQUIRED
+ dlog
+ aul
+ wayland-tbm-client
+ wayland-client
+ ecore-wl2
+ tizen-remote-surface-client
+ tzsh-launcher-service
+ glib-2.0
+)
+
+FOREACH(flag ${screen_connector_launcher_service_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
+ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${screen_connector_launcher_service_LDFLAGS} "-lpthread")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(TARGETS ${PROJECT_NAME}
+ DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ DESTINATION include/${PROJECT_NAME}
+ FILES_MATCHING PATTERN "*.h"
+ PATTERN "*_internal.h" EXCLUDE
+ PATTERN "*_implementation.h" EXCLUDE)
diff --git a/screen_connector_launcher_service/LICENSE b/screen_connector_launcher_service/LICENSE
new file mode 100644
index 0000000..ea408f9
--- /dev/null
+++ b/screen_connector_launcher_service/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
diff --git a/screen_connector_launcher_service/direction.h b/screen_connector_launcher_service/direction.h
new file mode 100644
index 0000000..2e5df5b
--- /dev/null
+++ b/screen_connector_launcher_service/direction.h
@@ -0,0 +1,37 @@
+/*
+ * 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_DIRECTION_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+
+namespace screen_connector {
+
+enum class EXPORT Direction {
+ Forward = TZSH_LAUNCHER_SERVICE_DIRECTION_FORWARD,
+ Backward = TZSH_LAUNCHER_SERVICE_DIRECTION_BACKWARD,
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_DIRECTION_H_
diff --git a/screen_connector_launcher_service/error.h b/screen_connector_launcher_service/error.h
new file mode 100644
index 0000000..0b34d0d
--- /dev/null
+++ b/screen_connector_launcher_service/error.h
@@ -0,0 +1,38 @@
+/*
+ * 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_ERROR_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+
+namespace screen_connector {
+
+enum class EXPORT Error {
+ None = TZSH_LAUNCHER_SERVICE_ERROR_NONE,
+ Disqualified = TZSH_LAUNCHER_SERVICE_ERROR_DISQUALIFIED,
+ WrongRequest = TZSH_LAUNCHER_SERVICE_ERROR_WRONG_REQUEST,
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_ERROR_H_
diff --git a/screen_connector_launcher_service/image_file.h b/screen_connector_launcher_service/image_file.h
new file mode 100644
index 0000000..6545fa2
--- /dev/null
+++ b/screen_connector_launcher_service/image_file.h
@@ -0,0 +1,48 @@
+/*
+ * 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_IMAGE_FILE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_FILE_H_
+
+#include <stdint.h>
+#include <unistd.h>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/handle.h"
+
+namespace screen_connector {
+
+class EXPORT ImageFile : public Handle<int32_t> {
+ public:
+ ImageFile(int32_t fd, uint32_t size)
+ : Handle<int32_t>(fd, true), size_(size) { }
+
+ virtual ~ImageFile() {
+ if (GetRaw() > 0)
+ close(GetRaw());
+ }
+
+ uint32_t GetSize() const {
+ return size_;
+ }
+
+ private:
+ uint32_t size_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_FILE_H_
diff --git a/screen_connector_launcher_service/image_type.h b/screen_connector_launcher_service/image_type.h
new file mode 100644
index 0000000..595b906
--- /dev/null
+++ b/screen_connector_launcher_service/image_type.h
@@ -0,0 +1,39 @@
+/*
+ * 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_IMAGE_TYPE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+
+namespace screen_connector {
+
+enum class EXPORT ImageType {
+ RemoteSurfaceTBM,
+ RemoteSurfaceImageFile,
+ SplashScreenImage,
+ SplashScreenEdje,
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_IMAGE_TYPE_H_
diff --git a/screen_connector_launcher_service/launcher_service.cc b/screen_connector_launcher_service/launcher_service.cc
new file mode 100644
index 0000000..82eaae9
--- /dev/null
+++ b/screen_connector_launcher_service/launcher_service.cc
@@ -0,0 +1,203 @@
+/*
+ * 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_launcher_service/launcher_service.h"
+#include "screen_connector_launcher_service/launcher_service_implementation.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace screen_connector {
+
+LauncherService::Impl::Impl(LauncherService* parent,
+ std::shared_ptr<Wl2Window> wl2_win,
+ LauncherService::IEventListener* listener)
+ : parent_(parent),
+ wl2_win_(std::move(wl2_win)),
+ listener_(listener),
+ trs_mgr_(new TizenRemoteSurfaceManager()),
+ tzsh_(new Tzsh(tzsh_create(TZSH_TOOLKIT_TYPE_EFL))) {
+ auto win_id = ecore_wl2_window_id_get(wl2_win_->GetRaw());
+ tls_ = std::unique_ptr<TzshLauncherService>(new TzshLauncherService(
+ tzsh_launcher_service_create(tzsh_->GetRaw(),
+ static_cast<tzsh_window>(win_id))));
+ tls_->SetListener(this);
+
+ auto surface = ecore_wl2_window_surface_get(wl2_win_->GetRaw());
+ wl_surface_ = std::shared_ptr<WlSurface>(new WlSurface(surface));
+}
+
+int LauncherService::Impl::Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return tls_->Launch(app_id, inst_id, pid, serial);
+}
+
+int LauncherService::Impl::LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return tls_->LaunchWithSharedWidget(app_id, inst_id, pid, serial);
+}
+
+int LauncherService::Impl::Launching(uint32_t serial) {
+ return tls_->Launching(serial);
+}
+
+int LauncherService::Impl::LaunchCancel(uint32_t serial) {
+ int ret = tls_->LaunchCancel(serial);
+ done_ = true;
+ return ret;
+}
+
+int LauncherService::Impl::LaunchDone(uint32_t serial) {
+ int ret = tls_->LaunchDone(serial);
+ done_ = true;
+ return ret;
+}
+
+void LauncherService::Impl::OnRawBufferUpdated(
+ std::shared_ptr<WlBuffer> wl_buffer,
+ uint32_t time,
+ uint32_t serial) {
+}
+
+void LauncherService::Impl::OnRawBufferMissing(uint32_t serial) {
+}
+
+void LauncherService::Impl::OnRawBufferChanged(uint32_t type,
+ std::shared_ptr<WlBuffer> wl_buffer,
+ int32_t fd,
+ uint32_t size,
+ uint32_t time,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) {
+
+ if (done_) {
+ _W("Skip");
+ return;
+ }
+
+ if (type == TIZEN_REMOTE_SURFACE_BUFFER_TYPE_TBM) {
+ raw_image_ = std::shared_ptr<RawImage>(new RawImage(direction, x, y,
+ shared_widget_info, wl_buffer));
+ listener_->OnPrepareEvent(raw_image_, serial);
+ } else if (type == TIZEN_REMOTE_SURFACE_BUFFER_TYPE_IMAGE_FILE) {
+ raw_image_ = std::shared_ptr<RawImage>(new RawImage(direction, x, y,
+ shared_widget_info,
+ std::shared_ptr<ImageFile>(new ImageFile(fd, size))));
+ listener_->OnPrepareEvent(raw_image_, serial);
+ } else {
+ _W("Unknown type(%u)", type);
+ }
+}
+
+void LauncherService::Impl::OnInputFilterChanged(uint32_t event_filter,
+ uint32_t serial) {
+}
+
+void LauncherService::Impl::OnPrepareEvent(uint32_t target_type,
+ uint32_t target_res_id,
+ const std::string& file_path,
+ const std::string& file_group,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) {
+ if (target_type == TZSH_LAUNCHER_SERVICE_TARGET_TYPE_REMOTE_SURFACE) {
+ done_ = false;
+ listener_->OnResetEvent(serial);
+ raw_image_.reset();
+ trs_.reset(trs_mgr_->CreateTizenRemoteSurface(target_res_id,
+ wl_surface_, direction, x, y, shared_widget_info, serial));
+ trs_->AddListener(this);
+ trs_->Redirect();
+ } else if (target_type == TZSH_LAUNCHER_SERVICE_TARGET_TYPE_IMAGE) {
+ raw_image_ = std::shared_ptr<RawImage>(new RawImage(direction, x, y,
+ shared_widget_info, file_path));
+ listener_->OnPrepareEvent(raw_image_, serial);
+ } else if (target_type == TZSH_LAUNCHER_SERVICE_TARGET_TYPE_EDJE) {
+ raw_image_ = std::shared_ptr<RawImage>(
+ new RawImage(direction, x, y, shared_widget_info,
+ file_path, file_group));
+ listener_->OnPrepareEvent(raw_image_, serial);
+ } else {
+ _W("Unknown target type(%u)", target_type);
+ listener_->OnErrorEvent(Error::WrongRequest, serial);
+ }
+}
+
+void LauncherService::Impl::OnStopEvent(uint32_t serial) {
+ listener_->OnStopEvent(serial);
+ listener_->OnResetEvent(serial);
+ raw_image_.reset();
+ trs_.reset();
+}
+
+void LauncherService::Impl::OnErrorEvent(Error error, uint32_t serial) {
+ if (error == Error::None)
+ return;
+
+ if (error == Error::Disqualified) {
+ _E("Launcher has to clear LauncherService");
+ listener_->OnErrorEvent(error, serial);
+ } else {
+ _W("Wrong request");
+ listener_->OnErrorEvent(error, serial);
+ }
+}
+
+void LauncherService::Impl::OnCleanupEvent(uint32_t serial) {
+ listener_->OnCleanUpEvent(serial);
+}
+
+LauncherService::LauncherService(std::shared_ptr<Wl2Window> wl2_win,
+ IEventListener* listener)
+ : impl_(new Impl(this, std::move(wl2_win), listener)) {
+}
+
+LauncherService::~LauncherService() = default;
+
+int LauncherService::Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return impl_->Launch(app_id, inst_id, pid, serial);
+}
+
+int LauncherService::LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return impl_->LaunchWithSharedWidget(app_id, inst_id, pid, serial);
+}
+
+int LauncherService::Launching(uint32_t serial) {
+ return impl_->Launching(serial);
+}
+
+int LauncherService::LaunchCancel(uint32_t serial) {
+ return impl_->LaunchCancel(serial);
+}
+
+int LauncherService::LaunchDone(uint32_t serial) {
+ return impl_->LaunchDone(serial);
+}
+
+} // namespace screen_connector
diff --git a/screen_connector_launcher_service/launcher_service.h b/screen_connector_launcher_service/launcher_service.h
new file mode 100644
index 0000000..3ef2c3a
--- /dev/null
+++ b/screen_connector_launcher_service/launcher_service.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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_LAUNCHER_SERVICE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_H_
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/export.h"
+#include "screen_connector_common/wl2_window.h"
+#include "screen_connector_launcher_service/error.h"
+#include "screen_connector_launcher_service/raw_image.h"
+
+namespace screen_connector {
+
+class EXPORT LauncherService {
+ public:
+ class EXPORT IEventListener {
+ public:
+ virtual void OnPrepareEvent(std::shared_ptr<RawImage> raw_image,
+ uint32_t serial) = 0;
+ virtual void OnStopEvent(uint32_t serial) = 0;
+ virtual void OnErrorEvent(Error error,
+ uint32_t serial) = 0;
+ virtual void OnCleanUpEvent(uint32_t serial) = 0;
+ virtual void OnResetEvent(uint32_t serial) = 0;
+ };
+
+ LauncherService(std::shared_ptr<Wl2Window> wl2_win,
+ IEventListener* listener);
+ virtual ~LauncherService();
+
+ int Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int Launching(uint32_t serial);
+ int LaunchCancel(uint32_t serial);
+ int LaunchDone(uint32_t serial);
+
+ private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_H_
diff --git a/screen_connector_launcher_service/launcher_service_implementation.h b/screen_connector_launcher_service/launcher_service_implementation.h
new file mode 100644
index 0000000..0afd237
--- /dev/null
+++ b/screen_connector_launcher_service/launcher_service_implementation.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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_LAUNCHER_SERVICE_IMPLEMENTATION_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_IMPLEMENTATION_H_
+
+#include <stdint.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_common/tzsh.h"
+#include "screen_connector_common/wl_buffer.h"
+#include "screen_connector_common/wl_surface.h"
+#include "screen_connector_launcher_service/launcher_service.h"
+#include "screen_connector_launcher_service/tizen_remote_surface_internal.h"
+#include "screen_connector_launcher_service/tizen_remote_surface_manager_internal.h"
+#include "screen_connector_launcher_service/tzsh_launcher_service_internal.h"
+
+namespace screen_connector {
+
+class LauncherService::Impl : TizenRemoteSurface::IEventListener,
+ TzshLauncherService::IEventListener {
+ public:
+ // TizenRemoteSurface::IEventListener
+ void OnRawBufferUpdated(std::shared_ptr<WlBuffer> wl_buffer,
+ uint32_t time,
+ uint32_t serial) override;
+ void OnRawBufferMissing(uint32_t serial) override;
+ void OnRawBufferChanged(uint32_t type,
+ std::shared_ptr<WlBuffer> wl_buffer,
+ int32_t fd,
+ uint32_t size,
+ uint32_t time,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) override;
+ void OnInputFilterChanged(uint32_t event_filter,
+ uint32_t serial) override;
+
+ // TzshLauncherService::IEventListener
+ void OnPrepareEvent(uint32_t target_type,
+ uint32_t target_res_id,
+ const std::string& file_path,
+ const std::string& file_group,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) override;
+ void OnStopEvent(uint32_t serial) override;
+ void OnErrorEvent(Error error,
+ uint32_t serial) override;
+ void OnCleanupEvent(uint32_t serial) override;
+
+ virtual ~Impl() = default;
+
+ int Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int Launching(uint32_t serial);
+ int LaunchCancel(uint32_t serial);
+ int LaunchDone(uint32_t serial);
+
+ private:
+ friend class LauncherService;
+
+ Impl(LauncherService* parent,
+ std::shared_ptr<Wl2Window> wl2_win,
+ LauncherService::IEventListener* listener);
+
+ private:
+ LauncherService* parent_;
+ std::shared_ptr<Wl2Window> wl2_win_;
+ LauncherService::IEventListener* listener_;
+ std::unique_ptr<TizenRemoteSurfaceManager> trs_mgr_;
+ std::unique_ptr<Tzsh> tzsh_;
+ std::unique_ptr<TzshLauncherService> tls_;
+ std::shared_ptr<WlSurface> wl_surface_;
+ std::unique_ptr<TizenRemoteSurface> trs_;
+ std::shared_ptr<RawImage> raw_image_;
+ bool done_ = false;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_LAUNCHER_SERVICE_IMPLEMENTATION_H_
diff --git a/screen_connector_launcher_service/log_internal.h b/screen_connector_launcher_service/log_internal.h
new file mode 100644
index 0000000..01db3c7
--- /dev/null
+++ b/screen_connector_launcher_service/log_internal.h
@@ -0,0 +1,48 @@
+/*
+ * 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_LOG_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_LOG_INTERNAL_H_
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "SCLS"
+
+#ifdef _E
+#undef _E
+#endif
+#define _E LOGE
+
+#ifdef _W
+#undef _W
+#endif
+#define _W LOGW
+
+#ifdef _I
+#undef _I
+#endif
+#define _I LOGI
+
+#ifdef _D
+#undef _D
+#endif
+#define _D LOGD
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_LOG_INTERNAL_H_
diff --git a/screen_connector_launcher_service/raw_image.cc b/screen_connector_launcher_service/raw_image.cc
new file mode 100644
index 0000000..4edaa3b
--- /dev/null
+++ b/screen_connector_launcher_service/raw_image.cc
@@ -0,0 +1,106 @@
+/*
+ * 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_launcher_service/raw_image.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace screen_connector {
+
+RawImage::RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::shared_ptr<ImageFile> image_file)
+ : image_type_(ImageType::RemoteSurfaceImageFile),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)) {
+ image_file_ = std::move(image_file);
+}
+
+RawImage::RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::shared_ptr<WlBuffer> wl_buffer)
+ : image_type_(ImageType::RemoteSurfaceTBM),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)) {
+ wl_buffer_ = std::move(wl_buffer);
+}
+
+RawImage::RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::string file_path)
+ : image_type_(ImageType::SplashScreenImage),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)) {
+ file_path_ = std::move(file_path);
+}
+
+RawImage::RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::string file_path,
+ std::string file_group)
+ : image_type_(ImageType::SplashScreenEdje),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)) {
+ file_path_ = std::move(file_path);
+ file_group_ = std::move(file_group);
+}
+
+RawImage::~RawImage() = default;
+
+ImageType RawImage::GetImageType() const {
+ return image_type_;
+}
+
+Direction RawImage::GetDirection() const {
+ return direction_;
+}
+
+int32_t RawImage::GetPositionX() const {
+ return x_;
+}
+
+int32_t RawImage::GetPositionY() const {
+ return y_;
+}
+
+std::string RawImage::GetSharedWidgetInfo() const {
+ return shared_widget_info_;
+}
+
+std::shared_ptr<WlBuffer> RawImage::GetWlBuffer() const {
+ return wl_buffer_;
+}
+
+std::shared_ptr<ImageFile> RawImage::GetImageFile() const {
+ return image_file_;
+}
+
+std::string RawImage::GetFilePath() const {
+ return file_path_;
+}
+
+std::string RawImage::GetFileGroup() const {
+ return file_group_;
+}
+
+} // namespace screen_connector
diff --git a/screen_connector_launcher_service/raw_image.h b/screen_connector_launcher_service/raw_image.h
new file mode 100644
index 0000000..2f7e743
--- /dev/null
+++ b/screen_connector_launcher_service/raw_image.h
@@ -0,0 +1,78 @@
+/*
+ * 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_RAW_IMAGE_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_RAW_IMAGE_H_
+
+#include <stdint.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_common/wl_buffer.h"
+#include "screen_connector_launcher_service/direction.h"
+#include "screen_connector_launcher_service/image_file.h"
+#include "screen_connector_launcher_service/image_type.h"
+
+namespace screen_connector {
+
+class EXPORT RawImage {
+ public:
+ RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::shared_ptr<ImageFile> image_file);
+ RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::shared_ptr<WlBuffer> wl_buffer);
+ RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::string file_path);
+ RawImage(Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ std::string file_path,
+ std::string file_group);
+ virtual ~RawImage();
+
+ Direction GetDirection() const;
+ ImageType GetImageType() const;
+ int32_t GetPositionX() const;
+ int32_t GetPositionY() const;
+ std::string GetSharedWidgetInfo() const;
+ std::shared_ptr<ImageFile> GetImageFile() const;
+ std::shared_ptr<WlBuffer> GetWlBuffer() const;
+ std::string GetFileGroup() const;
+ std::string GetFilePath() const;
+
+ private:
+ ImageType image_type_;
+ Direction direction_;
+ int32_t x_;
+ int32_t y_;
+ std::string shared_widget_info_;
+ std::shared_ptr<WlBuffer> wl_buffer_;
+ std::shared_ptr<ImageFile> image_file_;
+ std::string file_path_;
+ std::string file_group_;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_RAW_IMAGE_H_
diff --git a/screen_connector_launcher_service/screen_connector_launcher_service.pc.in b/screen_connector_launcher_service/screen_connector_launcher_service.pc.in
new file mode 100644
index 0000000..0c41770
--- /dev/null
+++ b/screen_connector_launcher_service/screen_connector_launcher_service.pc.in
@@ -0,0 +1,12 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: screen_connector_launcher_service
+Description: Support development of the Screen Connector Launcher Service library
+Version: @VERSION@
+Requires: tzsh-launcher-service
+Libs: -L${libdir} -lscreen_connector_launcher_service
+Cflags: -I${includedir}
+cppflags: -I${includedir}
diff --git a/screen_connector_launcher_service/tizen_remote_surface_internal.cc b/screen_connector_launcher_service/tizen_remote_surface_internal.cc
new file mode 100644
index 0000000..5a6d15e
--- /dev/null
+++ b/screen_connector_launcher_service/tizen_remote_surface_internal.cc
@@ -0,0 +1,125 @@
+/*
+ * 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_launcher_service/tizen_remote_surface_internal.h"
+
+namespace screen_connector {
+
+TizenRemoteSurface::TizenRemoteSurface(struct tizen_remote_surface* raw,
+ Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ uint32_t serial)
+ : Handle<struct tizen_remote_surface*>(raw, true),
+ direction_(direction),
+ x_(x), y_(y),
+ shared_widget_info_(std::move(shared_widget_info)),
+ serial_(serial) {
+}
+
+TizenRemoteSurface::~TizenRemoteSurface() {
+ if (GetRaw() != nullptr) {
+ tizen_remote_surface_set_user_data(GetRaw(), NULL);
+ tizen_remote_surface_unredirect(GetRaw());
+ tizen_remote_surface_destroy(GetRaw());
+ }
+}
+
+struct tizen_remote_surface* TizenRemoteSurface::GetHandle() const {
+ return GetRaw();
+ }
+
+void TizenRemoteSurface::AddListener(IEventListener* listener) {
+ static const struct tizen_remote_surface_listener rs_Listener = {
+ BufferUpdatedCB,
+ BufferMissingCB,
+ BufferChangedCB,
+ InputEventFilterCB,
+ };
+
+ listener_ = listener;
+ tizen_remote_surface_add_listener(GetRaw(), &rs_Listener, this);
+}
+
+TizenRemoteSurface::IEventListener* TizenRemoteSurface::GetListener() {
+ return listener_;
+}
+
+Direction TizenRemoteSurface::GetDirection() const {
+ return direction_;
+}
+
+int32_t TizenRemoteSurface::GetPositionX() const {
+ return x_;
+}
+
+int32_t TizenRemoteSurface::GetPositionY() const {
+ return y_;
+}
+
+const std::string& TizenRemoteSurface::GetSharedWidgetInfo() const {
+ return shared_widget_info_;
+}
+
+uint32_t TizenRemoteSurface::GetSerial() const {
+ return serial_;
+}
+
+void TizenRemoteSurface::Redirect() {
+ tizen_remote_surface_redirect(GetRaw());
+}
+
+void TizenRemoteSurface::BufferUpdatedCB(void* data,
+ struct tizen_remote_surface* trs,
+ struct wl_buffer* buffer,
+ uint32_t time) {
+}
+
+void TizenRemoteSurface::BufferMissingCB(void* data,
+ struct tizen_remote_surface* trs) {
+ TizenRemoteSurface* rs = static_cast<TizenRemoteSurface*>(data);
+ IEventListener* l = rs->GetListener();
+ l->OnRawBufferMissing(rs->GetSerial());
+}
+
+void TizenRemoteSurface::BufferChangedCB(void* data,
+ struct tizen_remote_surface* trs,
+ uint32_t type,
+ struct wl_buffer* tbm,
+ int32_t img_fd,
+ uint32_t img_file_size,
+ uint32_t time,
+ struct wl_array* keys) {
+ TizenRemoteSurface* rs = static_cast<TizenRemoteSurface*>(data);
+ IEventListener* l = rs->GetListener();
+ l->OnRawBufferChanged(type, std::make_shared<WlBuffer>(tbm, trs),
+ img_fd, img_file_size, time,
+ rs->GetDirection(),
+ rs->GetPositionX(),
+ rs->GetPositionY(),
+ rs->GetSharedWidgetInfo(),
+ rs->GetSerial());
+}
+
+void TizenRemoteSurface::InputEventFilterCB(void* data,
+ struct tizen_remote_surface* trs,
+ uint32_t event_filter) {
+ TizenRemoteSurface* rs = static_cast<TizenRemoteSurface*>(data);
+ IEventListener* l = rs->GetListener();
+ l->OnInputFilterChanged(event_filter, rs->GetSerial());
+}
+
+} // namespace screen_connector
diff --git a/screen_connector_launcher_service/tizen_remote_surface_internal.h b/screen_connector_launcher_service/tizen_remote_surface_internal.h
new file mode 100644
index 0000000..2448ecc
--- /dev/null
+++ b/screen_connector_launcher_service/tizen_remote_surface_internal.h
@@ -0,0 +1,104 @@
+/*
+ * 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_TIZEN_REMOTE_SURFACE_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_INTERNAL_H_
+
+#include <stdint.h>
+#include <tizen-remote-surface-client-protocol.h>
+#include <unistd.h>
+
+#include <string>
+#include <memory>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_common/wl_buffer.h"
+#include "screen_connector_launcher_service/direction.h"
+
+namespace screen_connector {
+
+class TizenRemoteSurface : public Handle<struct tizen_remote_surface*> {
+ public:
+ class IEventListener {
+ public:
+ virtual void OnRawBufferUpdated(std::shared_ptr<WlBuffer> wl_buffer,
+ uint32_t time,
+ uint32_t serial) = 0;
+ virtual void OnRawBufferMissing(uint32_t serial) = 0;
+ virtual void OnRawBufferChanged(uint32_t type,
+ std::shared_ptr<WlBuffer> wl_buffer,
+ int32_t fd,
+ uint32_t size,
+ uint32_t time,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) = 0;
+ virtual void OnInputFilterChanged(uint32_t event_filter,
+ uint32_t serial) = 0;
+ };
+
+ TizenRemoteSurface(struct tizen_remote_surface* raw,
+ Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ uint32_t serial);
+ virtual ~TizenRemoteSurface();
+
+ struct tizen_remote_surface* GetHandle() const;
+
+ void AddListener(IEventListener* listener);
+ IEventListener* GetListener();
+
+ Direction GetDirection() const;
+ int32_t GetPositionX() const;
+ int32_t GetPositionY() const;
+ const std::string& GetSharedWidgetInfo() const;
+ uint32_t GetSerial() const;
+ void Redirect();
+
+ private:
+ static void BufferUpdatedCB(void* data,
+ struct tizen_remote_surface* trs,
+ struct wl_buffer* buffer,
+ uint32_t time);
+ static void BufferMissingCB(void* data,
+ struct tizen_remote_surface* trs);
+ static void BufferChangedCB(void* data,
+ struct tizen_remote_surface* trs,
+ uint32_t type,
+ struct wl_buffer* tbm,
+ int32_t img_fd,
+ uint32_t img_file_size,
+ uint32_t time,
+ struct wl_array* keys);
+ static void InputEventFilterCB(void* data,
+ struct tizen_remote_surface* trs,
+ uint32_t event_filter);
+
+ private:
+ Direction direction_;
+ int32_t x_;
+ int32_t y_;
+ std::string shared_widget_info_;
+ uint32_t serial_;
+ IEventListener* listener_ = nullptr;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_INTERNAL_H_
diff --git a/screen_connector_launcher_service/tizen_remote_surface_manager_internal.cc b/screen_connector_launcher_service/tizen_remote_surface_manager_internal.cc
new file mode 100644
index 0000000..61b8cc2
--- /dev/null
+++ b/screen_connector_launcher_service/tizen_remote_surface_manager_internal.cc
@@ -0,0 +1,85 @@
+/*
+ * 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 <Ecore_Wl2.h>
+#include <tbm_surface.h>
+#include <tbm_surface_internal.h>
+#include <wayland-client.h>
+#include <wayland-extension/tizen-extension-client-protocol.h>
+
+#include "screen_connector_launcher_service/tizen_remote_surface_manager_internal.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace screen_connector {
+
+TizenRemoteSurfaceManager::TizenRemoteSurfaceManager() {
+ if (!ecore_wl2_init()) {
+ _E("ecore_wl2_init() is failed");
+ return;
+ }
+
+ Ecore_Wl2_Display* wl2_dpy = ecore_wl2_connected_display_get(NULL);
+ if (wl2_dpy == nullptr)
+ wl2_dpy = ecore_wl2_display_connect(NULL);
+
+ struct wl_display* wl_dpy = ecore_wl2_display_get(wl2_dpy);
+ tbm_client_ = wayland_tbm_client_init(wl_dpy);
+ tbm_ = wayland_tbm_client_get_wl_tbm(tbm_client_);
+
+ struct wl_registry* registry = ecore_wl2_display_registry_get(wl2_dpy);
+ Eina_Iterator* iter = ecore_wl2_display_globals_get(wl2_dpy);
+
+ Ecore_Wl2_Global* global = nullptr;
+ EINA_ITERATOR_FOREACH(iter, global) {
+ if (!strcmp(global->interface, "tizen_remote_surface_manager")) {
+ tzrs_mgr_ = static_cast<struct tizen_remote_surface_manager*>(
+ wl_registry_bind(registry, global->id,
+ &tizen_remote_surface_manager_interface, global->version));
+ if (tzrs_mgr_)
+ break;
+ }
+ }
+ eina_iterator_free(iter);
+}
+
+TizenRemoteSurfaceManager::~TizenRemoteSurfaceManager() {
+ if (tzrs_mgr_) {
+ tizen_remote_surface_manager_destroy(tzrs_mgr_);
+ }
+
+ if (tbm_client_) {
+ wayland_tbm_client_deinit(tbm_client_);
+ }
+
+ ecore_wl2_display_disconnect(ecore_wl2_connected_display_get(NULL));
+ ecore_wl2_shutdown();
+}
+
+TizenRemoteSurface* TizenRemoteSurfaceManager::CreateTizenRemoteSurface(
+ uint32_t res,
+ std::shared_ptr<WlSurface> surface,
+ Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ uint32_t serial) {
+ struct tizen_remote_surface* tzrs =
+ tizen_remote_surface_manager_create_surface_with_wl_surface(tzrs_mgr_,
+ res, tbm_, surface->GetRaw());
+ return new (std::nothrow) TizenRemoteSurface(tzrs, direction, x, y,
+ std::move(shared_widget_info), serial);
+}
+
+} // namespace screen_connector
diff --git a/screen_connector_launcher_service/tizen_remote_surface_manager_internal.h b/screen_connector_launcher_service/tizen_remote_surface_manager_internal.h
new file mode 100644
index 0000000..3aeb193
--- /dev/null
+++ b/screen_connector_launcher_service/tizen_remote_surface_manager_internal.h
@@ -0,0 +1,52 @@
+/*
+ * 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_TIZEN_REMOTE_SURFACE_MANAGER_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_MANAGER_INTERNAL_H_
+
+#include <stdint.h>
+#include <tbm_surface.h>
+#include <tizen-remote-surface-client-protocol.h>
+#include <wayland-extension/tizen-extension-client-protocol.h>
+#include <wayland-tbm-client.h>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_common/wl_surface.h"
+#include "screen_connector_launcher_service/tizen_remote_surface_internal.h"
+
+namespace screen_connector {
+
+class TizenRemoteSurfaceManager {
+ public:
+ TizenRemoteSurfaceManager();
+ virtual ~TizenRemoteSurfaceManager();
+
+ TizenRemoteSurface* CreateTizenRemoteSurface(uint32_t res,
+ std::shared_ptr<WlSurface> surface,
+ Direction direction,
+ int32_t x, int32_t y,
+ std::string shared_widget_info,
+ uint32_t serial);
+
+ private:
+ struct tizen_remote_surface_manager* tzrs_mgr_ = nullptr;
+ struct wayland_tbm_client* tbm_client_ = nullptr;
+ struct wl_tbm* tbm_ = nullptr;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_TIZEN_REMOTE_SURFACE_MANAGER_INTERNAL_H_
diff --git a/screen_connector_launcher_service/tzsh_launcher_service_internal.cc b/screen_connector_launcher_service/tzsh_launcher_service_internal.cc
new file mode 100644
index 0000000..7858f97
--- /dev/null
+++ b/screen_connector_launcher_service/tzsh_launcher_service_internal.cc
@@ -0,0 +1,127 @@
+/*
+ * 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/handle.h"
+#include "screen_connector_launcher_service/tzsh_launcher_service_internal.h"
+#include "screen_connector_launcher_service/log_internal.h"
+
+namespace screen_connector {
+
+TzshLauncherService::TzshLauncherService(tzsh_launcher_service_h raw)
+ : Handle<tzsh_launcher_service_h>(raw, true) {
+}
+
+TzshLauncherService::~TzshLauncherService() {
+ tzsh_launcher_service_destroy(GetRaw());
+}
+
+tzsh_launcher_service_h TzshLauncherService::GetHandle() const {
+ return GetRaw();
+}
+
+void TzshLauncherService::SetListener(IEventListener* listener) {
+ listener_ = listener;
+
+ int ret = tzsh_launcher_service_prepare_cb_set(GetRaw(), PrepareCB,
+ listener_);
+ if (ret != TZSH_ERROR_NONE)
+ _E("Failed to set prepare callback. error(%d)", ret);
+
+ ret = tzsh_launcher_service_stop_cb_set(GetRaw(), StopCB, listener_);
+ if (ret != TZSH_ERROR_NONE)
+ _E("Failed to set stop callback. error(%d)", ret);
+
+ ret = tzsh_launcher_service_error_cb_set(GetRaw(), ErrorCB, listener_);
+ if (ret != TZSH_ERROR_NONE)
+ _E("Failed to set error callback. error(%d)", ret);
+
+ ret = tzsh_launcher_service_cleanup_cb_set(GetRaw(), CleanupCB, listener_);
+ if (ret != TZSH_ERROR_NONE)
+ _E("Failed to set cleanup callback. error(%d)", ret);
+}
+
+int TzshLauncherService::Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return tzsh_launcher_service_launch(GetRaw(), app_id.c_str(),
+ inst_id.c_str(), pid, serial);
+}
+
+int TzshLauncherService::LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial) {
+ return tzsh_launcher_service_launch_with_shared_widget(GetRaw(),
+ app_id.c_str(), inst_id.c_str(), pid, serial);
+}
+
+int TzshLauncherService::Launching(uint32_t serial) {
+ return tzsh_launcher_service_launching(GetRaw(), serial);
+}
+
+int TzshLauncherService::LaunchCancel(uint32_t serial) {
+ return tzsh_launcher_service_launch_cancel(GetRaw(), serial);
+}
+
+int TzshLauncherService::LaunchDone(uint32_t serial) {
+ return tzsh_launcher_service_launch_done(GetRaw(), serial);
+}
+
+void TzshLauncherService::PrepareCB(void* data,
+ tzsh_launcher_service_h service,
+ tzsh_launcher_service_target_type_e target_type,
+ uint32_t target_res_id,
+ const char* target_path,
+ const char* target_group,
+ tzsh_launcher_service_direction_e direction,
+ int32_t x,
+ int32_t y,
+ const char* target_widget_info,
+ uint32_t serial) {
+ IEventListener* listener = static_cast<IEventListener*>(data);
+ std::string file_path(target_path ? target_path : "");
+ std::string file_group(target_group ? target_group : "");
+ std::string shared_widget_info(target_widget_info ? target_widget_info : "");
+ listener->OnPrepareEvent(static_cast<uint32_t>(target_type),
+ target_res_id, file_path, file_group,
+ static_cast<Direction>(direction), x, y,
+ shared_widget_info, serial);
+}
+
+void TzshLauncherService::StopCB(void* data,
+ tzsh_launcher_service_h service,
+ uint32_t serial) {
+ IEventListener* listener = static_cast<IEventListener*>(data);
+ listener->OnStopEvent(serial);
+}
+
+void TzshLauncherService::ErrorCB(void* data,
+ tzsh_launcher_service_h service,
+ tzsh_launcher_service_error_e error,
+ uint32_t serial) {
+ IEventListener* listener = static_cast<IEventListener*>(data);
+ listener->OnErrorEvent(static_cast<Error>(error), serial);
+}
+
+void TzshLauncherService::CleanupCB(void* data,
+ tzsh_launcher_service_h service,
+ uint32_t serial) {
+ IEventListener* listener = static_cast<IEventListener*>(data);
+ listener->OnCleanupEvent(serial);
+}
+
+} // namespace screen_connector
diff --git a/screen_connector_launcher_service/tzsh_launcher_service_internal.h b/screen_connector_launcher_service/tzsh_launcher_service_internal.h
new file mode 100644
index 0000000..158df11
--- /dev/null
+++ b/screen_connector_launcher_service/tzsh_launcher_service_internal.h
@@ -0,0 +1,99 @@
+/*
+ * 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_TZSH_LAUNCHER_SERVICE_INTERNAL_H_
+#define SCREEN_CONNECTOR_LAUNCHER_SERVICE_TZSH_LAUNCHER_SERVICE_INTERNAL_H_
+
+#include <stdint.h>
+#include <tzsh_launcher_service.h>
+#include <unistd.h>
+
+#include <memory>
+#include <string>
+
+#include "screen_connector_common/handle.h"
+#include "screen_connector_launcher_service/direction.h"
+#include "screen_connector_launcher_service/error.h"
+
+namespace screen_connector {
+
+class TzshLauncherService : public Handle<tzsh_launcher_service_h> {
+ public:
+ class IEventListener {
+ public:
+ virtual void OnPrepareEvent(uint32_t target_type,
+ uint32_t target_res_id,
+ const std::string& file_path,
+ const std::string& file_group,
+ Direction direction,
+ int32_t x,
+ int32_t y,
+ const std::string& shared_widget_info,
+ uint32_t serial) = 0;
+ virtual void OnStopEvent(uint32_t serial) = 0;
+ virtual void OnErrorEvent(Error error,
+ uint32_t serial) = 0;
+ virtual void OnCleanupEvent(uint32_t serial) = 0;
+ };
+
+ explicit TzshLauncherService(tzsh_launcher_service_h raw);
+ virtual ~TzshLauncherService();
+
+ tzsh_launcher_service_h GetHandle() const;
+ void SetListener(IEventListener* listener);
+
+ int Launch(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int LaunchWithSharedWidget(const std::string& app_id,
+ const std::string& inst_id,
+ int pid,
+ uint32_t serial);
+ int Launching(uint32_t serial);
+ int LaunchCancel(uint32_t serial);
+ int LaunchDone(uint32_t serial);
+
+ private:
+ static void PrepareCB(void* data,
+ tzsh_launcher_service_h service,
+ tzsh_launcher_service_target_type_e target_type,
+ uint32_t target_res_id,
+ const char* target_path,
+ const char* target_group,
+ tzsh_launcher_service_direction_e direction,
+ int32_t x,
+ int32_t y,
+ const char* shared_widget_info,
+ uint32_t serial);
+ static void StopCB(void* data,
+ tzsh_launcher_service_h service,
+ uint32_t serial);
+ static void ErrorCB(void* data,
+ tzsh_launcher_service_h service,
+ tzsh_launcher_service_error_e error,
+ uint32_t serial);
+ static void CleanupCB(void* data,
+ tzsh_launcher_service_h service,
+ uint32_t serial);
+
+ private:
+ IEventListener* listener_ = nullptr;
+};
+
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_LAUNCHER_SERVICE_TZSH_LAUNCHER_SERVICE_INTERNAL_H_