From 6986e48ebb82dc6981ea08d9d472c01d903995e0 Mon Sep 17 00:00:00 2001 From: Woochanlee Date: Fri, 1 Oct 2021 11:13:27 +0900 Subject: [PATCH] aurum: Fix root permission not require in host 1. bootrap service app add in system 2. touch force enable by vconf API 3. Use sync API to avoid winfo command in host Change-Id: I72afd5f48677d5be7c4cc3114a8231c0d3950a67 --- libaurum/src/Impl/TizenDeviceImpl.cc | 4 +- org.tizen.aurum-bootstrap/meson.build | 1 + .../src/BootstrapServer.cc | 40 +++++++++++++++++-- packaging/aurum.spec | 11 +---- .../resources/python/mobile/mobileSetup.py | 1 - protocol/resources/python/tv/tvSetup.py | 7 ---- 6 files changed, 40 insertions(+), 24 deletions(-) diff --git a/libaurum/src/Impl/TizenDeviceImpl.cc b/libaurum/src/Impl/TizenDeviceImpl.cc index 96846e1..d966fc0 100644 --- a/libaurum/src/Impl/TizenDeviceImpl.cc +++ b/libaurum/src/Impl/TizenDeviceImpl.cc @@ -23,9 +23,9 @@ TizenDeviceImpl::TizenDeviceImpl() { LOGI("device implementation init"); TizenDeviceImpl *obj = static_cast(this); - obj->mFakeTouchHandle = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN); + obj->mFakeTouchHandle = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, NULL); obj->mFakeKeyboardHandle = - efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD); + efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD, NULL); int width = 0; int height = 0; diff --git a/org.tizen.aurum-bootstrap/meson.build b/org.tizen.aurum-bootstrap/meson.build index 8bb2b35..e27c68a 100644 --- a/org.tizen.aurum-bootstrap/meson.build +++ b/org.tizen.aurum-bootstrap/meson.build @@ -56,6 +56,7 @@ bootstrap_svr_dep += [ dependency('capi-appfw-service-application'), dependency('capi-system-system-settings'), dependency('capi-base-utils-i18n'), + dependency('vconf'), ] endif diff --git a/org.tizen.aurum-bootstrap/src/BootstrapServer.cc b/org.tizen.aurum-bootstrap/src/BootstrapServer.cc index 0ae861e..28b144a 100644 --- a/org.tizen.aurum-bootstrap/src/BootstrapServer.cc +++ b/org.tizen.aurum-bootstrap/src/BootstrapServer.cc @@ -1,13 +1,13 @@ #include -#include -#include "bootstrap.h" - #include - #include #include #include +#include +#include +#include +#include "bootstrap.h" #include "AurumServiceImpl.h" #include "config.h" @@ -15,14 +15,43 @@ using namespace grpc; typedef struct _ServiceContext { std::unique_ptr server; + bool forceTouchEnabled; } ServiceContext; +static void _vconf_force_enable_touch_set(void *data, bool enable) +{ + ServiceContext *ctx = (ServiceContext *)data; + int ret; + + if (ctx->forceTouchEnabled == enable) return; + + ret = vconf_set_bool("memory/window_system/input/force_enable_touch", enable); + if (ret != VCONF_OK) { + LOGE("Fail to set touch enable via vconf"); + return; + } + + ctx->forceTouchEnabled = enable; +} + static bool _service_app_create(void *data) { ServiceContext *ctx = (ServiceContext *)data; std::string binding("0.0.0.0:50051"); aurumServiceImpl service; ServerBuilder builder; + char *value; + int ret; + + ctx->forceTouchEnabled = false; + ret = system_info_get_platform_string("http://tizen.org/feature/profile", &value); + if (ret != SYSTEM_INFO_ERROR_NONE) LOGE("Fail to get system profile infomation"); + else { + if (!strncmp("tv", value, 2)) + _vconf_force_enable_touch_set(ctx, true); + + free(value); + } LOGI("[T] Server Listening on %s", binding.c_str()); builder.AddListeningPort(binding, grpc::InsecureServerCredentials()); @@ -36,6 +65,9 @@ static bool _service_app_create(void *data) static void _service_app_terminate(void *data) { ServiceContext *ctx = (ServiceContext *)data; + + if (ctx->forceTouchEnabled) + _vconf_force_enable_touch_set(ctx, false); ctx->server->Shutdown(); } diff --git a/packaging/aurum.spec b/packaging/aurum.spec index 181fddb..73a6a95 100644 --- a/packaging/aurum.spec +++ b/packaging/aurum.spec @@ -29,6 +29,7 @@ BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(capi-base-utils-i18n) +BuildRequires: pkgconfig(vconf) %if 0%{?gendoc:1} BuildRequires: doxygen @@ -38,18 +39,10 @@ BuildRequires: doxygen BuildRequires: lcov %endif -%if "%{?profile}" == "tv" - %define __hash_signing 0 -%else - %define __hash_signing 1 -%endif - -%if 0%{?__hash_signing} BuildRequires: hash-signer %if 0%{?sec_product_feature_profile_wearable} Requires(post): signing-client %endif -%endif %description aurum is a project for testing ui. @@ -152,13 +145,11 @@ ninja \ %install -%if 0%{?__hash_signing} %define tizen_sign 1 %define tizen_sign_base /usr/apps/org.tizen.aurum-bootstrap %define tizen_sign_level platform %define tizen_author_sign 1 %define tizen_dist_sign 1 -%endif export DESTDIR=%{buildroot} ninja -C gbsbuild install diff --git a/protocol/resources/python/mobile/mobileSetup.py b/protocol/resources/python/mobile/mobileSetup.py index ca22373..8df3cbe 100644 --- a/protocol/resources/python/mobile/mobileSetup.py +++ b/protocol/resources/python/mobile/mobileSetup.py @@ -9,7 +9,6 @@ def run_command(command): output = stream.read() # Start scrip here -run_command("sdb root on") run_command("sdb forward tcp:50051 tcp:50051") run_command("sdb shell app_launcher -s org.tizen.aurum-bootstrap") # Wait 1 sec till bootstrap launched diff --git a/protocol/resources/python/tv/tvSetup.py b/protocol/resources/python/tv/tvSetup.py index a888f48..8df3cbe 100644 --- a/protocol/resources/python/tv/tvSetup.py +++ b/protocol/resources/python/tv/tvSetup.py @@ -9,13 +9,6 @@ def run_command(command): output = stream.read() # Start scrip here -run_command("sdb root on") -# To run bootstrap as command -run_command("sdb shell tpk-backend -y org.tizen.aurum-bootstrap --preload") -# TV need to enable touch -run_command("sdb shell vconftool set -f -t bool memory/window_system/input/force_enable_touch 1") -# Dut to input generator issue, temporarily do below command -run_command("sdb shell winfo -init_device --type=touch") run_command("sdb forward tcp:50051 tcp:50051") run_command("sdb shell app_launcher -s org.tizen.aurum-bootstrap") # Wait 1 sec till bootstrap launched -- 2.34.1