bootstrap: Add feature to support extra data sets when app launch 13/261713/4 submit/tizen/20210723.091024
authorWoochanlee <wc0917.lee@samsung.com>
Fri, 23 Jul 2021 06:14:56 +0000 (15:14 +0900)
committerwoochan lee <wc0917.lee@samsung.com>
Fri, 23 Jul 2021 09:09:22 +0000 (09:09 +0000)
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
org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc
org.tizen.aurum-bootstrap/src/Runnable/LaunchAppRunnable.cc
protocol/aurum.proto

index 17f8e9b1c98e79870adb0f05684ee143d0cbd867..528467fcc8eb504767b808968b9689eb4518b8b6 100644 (file)
@@ -3,15 +3,15 @@
 #include <string>
 
 #include "Runnable.h"
+#include <aurum.grpc.pb.h>
 
 class LaunchAppRunnable : public Runnable {
 protected:
     std::string mPkg;
-    std::string mKey;
-    std::string mValue;
+    const google::protobuf::RepeatedPtrField<aurum::LaunchData>& mData;
 
 public:
-    LaunchAppRunnable(std::string pkg, std::string key, std::string value);
+    LaunchAppRunnable(std::string pkg, const google::protobuf::RepeatedPtrField<aurum::LaunchData>& data);
     std::string getPkgName();
     void run() const override;
 };
index d2aec28354462e5697e36cf43266c6ecbad2e338..1d138d404cde8ae73eafe45d9312624e304c8795 100644 (file)
@@ -16,7 +16,7 @@ LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp *request,
 ::grpc::Status LaunchAppCommand::execute()
 {
     LOGI("LaunchApp --------------- ");
-    std::unique_ptr<LaunchAppRunnable> cmd = std::make_unique<LaunchAppRunnable>(mRequest->packagename(), mRequest->key(), mRequest->value());
+    std::unique_ptr<LaunchAppRunnable> cmd = std::make_unique<LaunchAppRunnable>(mRequest->packagename(), mRequest->data());
     std::shared_ptr<UiDevice> obj = UiDevice::getInstance();
     obj->executeAndWaitForEvents(cmd.get(), A11yEvent::EVENT_WINDOW_ACTIVATE, WAIT_APP_LAUNCH);
 
index cea6b84ae6b9c591787ce24f55f4f371f9ca04b2..887a44ad25c0fbc3577c79d276f5c2d02c95f233 100644 (file)
@@ -7,8 +7,8 @@
 #include <app_control.h>
 #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<aurum::LaunchData>& 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) {
index 5d760d9f221e8f367f9ed44ed3b5d69d657a3270..0f4f93298a9e0b148aeb8d0b31d096b12d6e5e2d 100644 (file)
@@ -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;