From: Taehyub Kim Date: Tue, 9 Nov 2021 03:27:52 +0000 (+0900) Subject: Merge branch 'devel/master' into tizen X-Git-Tag: accepted/tizen/unified/20211111.120205~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=780fcb20f36c4bafeab8dbd2e2baf4ff5bea57fb;hp=cd004c16273a0ad03f62065bdf7d52f59cc21a04;p=platform%2Fcore%2Fuifw%2Fdali-demo.git Merge branch 'devel/master' into tizen Change-Id: Ideca62e338123ff5601b3ac7d9595eac2415dad4 --- diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index df31de6..e3bda7d 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -227,6 +227,19 @@ IF( ENABLE_PKG_CONFIGURE ) SET( ENABLE_SCENE_LOADER "ON" ) ENDIF() + + # if build as tizen platform, use capi-appfw-app-control + IF( TIZEN ) + pkg_check_modules(CAPI_APPFW_APP_CONTROL capi-appfw-app-control) + IF( CAPI_APPFW_APP_CONTROL_FOUND) + FOREACH(flag ${CAPI_APPFW_APP_CONTROL_CFLAGS}) + SET(REQUIRED_CFLAGS "${REQUIRED_CFLAGS} ${flag}") + ENDFOREACH(flag) + FOREACH(flag ${CAPI_APPFW_APP_CONTROL_LDFLAGS}) + SET(REQUIRED_PKGS_LDFLAGS "${REQUIRED_PKGS_LDFLAGS} ${flag}") + ENDFOREACH(flag) + ENDIF() + ENDIF() ENDIF() SET( VCPKG_INCLUDE_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") @@ -417,6 +430,18 @@ ADD_SUBDIRECTORY(examples-reel) ADD_SUBDIRECTORY(tests-reel) ADD_SUBDIRECTORY(builder) +# Setup CURRENT_BUILD_PLATFORM to use at message +IF(ANDROID) + SET(CURRENT_BUILD_PLATFORM "Android") +ELSEIF(WIN32) + SET(CURRENT_BUILD_PLATFORM "Windows") +ELSEIF(APPLE) + SET(CURRENT_BUILD_PLATFORM "MacOS") +ELSEIF(TIZEN) + SET(CURRENT_BUILD_PLATFORM "Tizen") +ELSE() + SET(CURRENT_BUILD_PLATFORM "Ubuntu") +ENDIF() MESSAGE( " Folder DEMO_IMAGE_DIR : [" ${DEMO_IMAGE_DIR} "]" ) MESSAGE( " Folder DEMO_STYLE_DIR : [" ${DEMO_STYLE_DIR} "]" ) @@ -429,4 +454,5 @@ MESSAGE( " Folder DEMO_SCRIPT_DIR : [" ${DEMO_SCRIPT_DIR} "]" ) MESSAGE( " Folder DEMO_LOCALE_DIR : [" ${DEMO_LOCALE_DIR} "]" ) MESSAGE( " Folder DEMO_EXAMPLE_BIN : [" ${DEMO_EXAMPLE_BIN} "]" ) MESSAGE( " Folder DEMO_LANG : [" ${DEMO_LANG} "]" ) +MESSAGE( " Current Build Platform : [" ${CURRENT_BUILD_PLATFORM} "]" ) MESSAGE( " Scene Loader Enabled : [" ${ENABLE_SCENE_LOADER} "]" ) diff --git a/build/tizen/demo/CMakeLists.txt b/build/tizen/demo/CMakeLists.txt index 855b82c..5368493 100644 --- a/build/tizen/demo/CMakeLists.txt +++ b/build/tizen/demo/CMakeLists.txt @@ -19,6 +19,11 @@ ELSEIF(ANDROID) ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/execute-process-android.cpp" ) +ELSEIF(TIZEN) + SET(DEMO_SRCS + ${DEMO_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-tizen.cpp" + ) ELSE() SET(DEMO_SRCS ${DEMO_SRCS} diff --git a/build/tizen/examples-reel/CMakeLists.txt b/build/tizen/examples-reel/CMakeLists.txt index 8b392e7..853e1c6 100644 --- a/build/tizen/examples-reel/CMakeLists.txt +++ b/build/tizen/examples-reel/CMakeLists.txt @@ -19,6 +19,11 @@ ELSEIF(ANDROID) ${EXAMPLES_REEL_SRCS} "${ROOT_SRC_DIR}/shared/execute-process-android.cpp" ) +ELSEIF(TIZEN) + SET(EXAMPLES_REEL_SRCS + ${EXAMPLES_REEL_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-tizen.cpp" + ) ELSE() SET(EXAMPLES_REEL_SRCS ${EXAMPLES_REEL_SRCS} diff --git a/build/tizen/tests-reel/CMakeLists.txt b/build/tizen/tests-reel/CMakeLists.txt index a4d0af8..a4a04d9 100644 --- a/build/tizen/tests-reel/CMakeLists.txt +++ b/build/tizen/tests-reel/CMakeLists.txt @@ -19,6 +19,11 @@ ELSEIF(ANDROID) ${TESTS_REEL_SRCS} "${ROOT_SRC_DIR}/shared/execute-process-android.cpp" ) +ELSEIF(TIZEN) + SET(TESTS_REEL_SRCS + ${TESTS_REEL_SRCS} + "${ROOT_SRC_DIR}/shared/execute-process-tizen.cpp" + ) ELSE() SET(TESTS_REEL_SRCS ${TESTS_REEL_SRCS} diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 2c46609..2876eef 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -344,6 +344,7 @@ + http://tizen.org/privilege/appmanager.launch http://tizen.org/privilege/mediastorage http://tizen.org/privilege/externalstorage http://tizen.org/privilege/externalstorage.appdata diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 6235223..3d2c1ed 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 2.0.50 +Version: 2.0.51 Release: 1 Group: System/Libraries License: Apache-2.0 @@ -15,6 +15,7 @@ Requires(postun): /sbin/ldconfig BuildRequires: cmake BuildRequires: pkgconfig BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-appfw-app-control) BuildRequires: pkgconfig(capi-media-player) BuildRequires: pkgconfig(dlog) BuildRequires: gettext-tools @@ -66,6 +67,7 @@ cmake -DDALI_APP_DIR=%{dali_app_ro_dir}/bin \ %endif -DLOCAL_STYLE_DIR=%{local_style_dir} \ -DINTERNATIONALIZATION:BOOL=OFF \ + -DTIZEN:BOOL=ON \ . make %{?jobs:-j%jobs} diff --git a/shared/execute-process-tizen.cpp b/shared/execute-process-tizen.cpp new file mode 100644 index 0000000..aa1c4b7 --- /dev/null +++ b/shared/execute-process-tizen.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2021 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. + * + */ + +// FILE HEADER +#include "execute-process.h" + +// EXTERNAL INCLUDES +#include +#include +#include + +namespace { + +#define MATCH_THEN_RETURN_ERROR_NAME(ret, error_type) \ +do \ +{ \ + if(ret == error_type) \ + { \ + return #error_type; \ + } \ +} while(0) + +const char* GetAppControlErrorName(int ret) +{ + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_NONE); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_INVALID_PARAMETER); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_OUT_OF_MEMORY); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_APP_NOT_FOUND); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_KEY_NOT_FOUND); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_KEY_REJECTED); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_INVALID_DATA_TYPE); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_LAUNCH_REJECTED); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_PERMISSION_DENIED); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_LAUNCH_FAILED); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_TIMED_OUT); + MATCH_THEN_RETURN_ERROR_NAME(ret, APP_CONTROL_ERROR_IO_ERROR); + return "Unknown error!"; +} + +} // unnamed namespace + +void ExecuteProcess(const std::string& processName, Dali::Application& application) +{ + app_control_h handle; + app_control_create(&handle); + app_control_set_app_id(handle, processName.c_str()); + + DALI_LOG_RELEASE_INFO("Try to launch app[%s]\n", processName.c_str()); + int ret = app_control_send_launch_request(handle, NULL, NULL); + if(ret == APP_CONTROL_ERROR_NONE) + { + DALI_LOG_RELEASE_INFO("Succeeded to launch app[%s]\n", processName.c_str()); + } + else + { + DALI_LOG_ERROR("Fail to launch app[%s] ret=%d(%s)\n",processName.c_str(), ret, GetAppControlErrorName(ret)); + DALI_ASSERT_ALWAYS(false && "Send launch request failed!"); + } + app_control_destroy(handle); +}