From f9077f5573abee0fdba7053bcdfda0404169903e Mon Sep 17 00:00:00 2001 From: Woochanlee Date: Fri, 23 Jul 2021 15:14:56 +0900 Subject: [PATCH] bootstrap: Add feature to support extra data sets when app launch User may want to set various data set for launching app. after this implementation. user can do like below - python extraData1 = LaunchData() extraData1.key = 'Key1' extraData1.value = 'Value1' extraData2 = LaunchData() extraData2.key = 'Key2' extraData2.value = 'Value2' datas = [extraData1, extraData2] stub.launchApp(ReqLaunchApp(packageName='org.tizen.example.NUITizenGallery', data=datas)) Change-Id: Id7756a080acb9e940d0679a4ae0ae89ccc9fb57e --- org.tizen.aurum-bootstrap/inc/Runnable/LaunchAppRunnable.h | 6 +++--- org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc | 2 +- org.tizen.aurum-bootstrap/src/Runnable/LaunchAppRunnable.cc | 10 +++++----- protocol/aurum.proto | 8 ++++++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/org.tizen.aurum-bootstrap/inc/Runnable/LaunchAppRunnable.h b/org.tizen.aurum-bootstrap/inc/Runnable/LaunchAppRunnable.h index 17f8e9b..528467f 100644 --- a/org.tizen.aurum-bootstrap/inc/Runnable/LaunchAppRunnable.h +++ b/org.tizen.aurum-bootstrap/inc/Runnable/LaunchAppRunnable.h @@ -3,15 +3,15 @@ #include #include "Runnable.h" +#include class LaunchAppRunnable : public Runnable { protected: std::string mPkg; - std::string mKey; - std::string mValue; + const google::protobuf::RepeatedPtrField& mData; public: - LaunchAppRunnable(std::string pkg, std::string key, std::string value); + LaunchAppRunnable(std::string pkg, const google::protobuf::RepeatedPtrField& data); std::string getPkgName(); void run() const override; }; diff --git a/org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc index d2aec28..1d138d4 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc @@ -16,7 +16,7 @@ LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp *request, ::grpc::Status LaunchAppCommand::execute() { LOGI("LaunchApp --------------- "); - std::unique_ptr cmd = std::make_unique(mRequest->packagename(), mRequest->key(), mRequest->value()); + std::unique_ptr cmd = std::make_unique(mRequest->packagename(), mRequest->data()); std::shared_ptr obj = UiDevice::getInstance(); obj->executeAndWaitForEvents(cmd.get(), A11yEvent::EVENT_WINDOW_ACTIVATE, WAIT_APP_LAUNCH); diff --git a/org.tizen.aurum-bootstrap/src/Runnable/LaunchAppRunnable.cc b/org.tizen.aurum-bootstrap/src/Runnable/LaunchAppRunnable.cc index cea6b84..887a44a 100644 --- a/org.tizen.aurum-bootstrap/src/Runnable/LaunchAppRunnable.cc +++ b/org.tizen.aurum-bootstrap/src/Runnable/LaunchAppRunnable.cc @@ -7,8 +7,8 @@ #include #endif -LaunchAppRunnable::LaunchAppRunnable(std::string pkg, std::string key, std::string value) - : mPkg{pkg}, mKey{key}, mValue{value} +LaunchAppRunnable::LaunchAppRunnable(std::string pkg, const google::protobuf::RepeatedPtrField& data) + : mPkg{pkg}, mData(data) { } @@ -27,14 +27,14 @@ void LaunchAppRunnable::run() const return; } - if (!mKey.empty() && !mValue.empty()) { - ret = app_control_add_extra_data(appControl, mKey.c_str(), mValue.c_str()); + std::for_each(mData.begin(), mData.end(), [&](auto data){ + ret = app_control_add_extra_data(appControl, data.key().c_str(),data.value().c_str()); if (ret) { LOGE("Launch Failed(app_control_add_extra_data) Err Code : %ull", ret); app_control_destroy(appControl); return; } - } + }); ret = app_control_set_app_id(appControl, packageName.c_str()); if (ret) { diff --git a/protocol/aurum.proto b/protocol/aurum.proto index 5d760d9..0f4f932 100644 --- a/protocol/aurum.proto +++ b/protocol/aurum.proto @@ -88,6 +88,11 @@ message Rect { int32 height = 4; } +message LaunchData { + string key = 1; + string value = 2; +} + // ------------------------------------ // message ReqFindElement { @@ -323,8 +328,7 @@ message RspGetAppInfo { message ReqLaunchApp{ string packageName = 1; - string key = 2; - string value = 3; + repeated LaunchData data = 2; } message RspLaunchApp{ RspStatus status = 1; -- 2.7.4