bootstrap: Add feature to send additional data to app_control 89/261389/2
authorWoochanlee <wc0917.lee@samsung.com>
Fri, 16 Jul 2021 08:54:52 +0000 (17:54 +0900)
committerWoochanlee <wc0917.lee@samsung.com>
Tue, 20 Jul 2021 05:38:20 +0000 (14:38 +0900)
Add app_control_add_extra_data() wrapper.

Change-Id: I934968c149cd9d9f0745ffb8ae83f7bd5aba17f8

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 0fe4ca2..17f8e9b 100644 (file)
@@ -7,9 +7,11 @@
 class LaunchAppRunnable : public Runnable {
 protected:
     std::string mPkg;
+    std::string mKey;
+    std::string mValue;
 
 public:
-    LaunchAppRunnable(std::string pkg);
+    LaunchAppRunnable(std::string pkg, std::string key, std::string value);
     std::string getPkgName();
     void run() const override;
 };
index f695723..d2aec28 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());
+    std::unique_ptr<LaunchAppRunnable> cmd = std::make_unique<LaunchAppRunnable>(mRequest->packagename(), mRequest->key(), mRequest->value());
     std::shared_ptr<UiDevice> obj = UiDevice::getInstance();
     obj->executeAndWaitForEvents(cmd.get(), A11yEvent::EVENT_WINDOW_ACTIVATE, WAIT_APP_LAUNCH);
 
index cafa48b..cea6b84 100644 (file)
@@ -7,8 +7,8 @@
 #include <app_control.h>
 #endif
 
-LaunchAppRunnable::LaunchAppRunnable(std::string pkg)
-    : mPkg{pkg}
+LaunchAppRunnable::LaunchAppRunnable(std::string pkg, std::string key, std::string value)
+    : mPkg{pkg}, mKey{key}, mValue{value}
 {
 }
 
@@ -27,6 +27,15 @@ void LaunchAppRunnable::run() const
         return;
     }
 
+    if (!mKey.empty() && !mValue.empty()) {
+        ret = app_control_add_extra_data(appControl, mKey.c_str(), mValue.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) {
         LOGE("Launch Failed(app_control_set_app_id) Err Code : %ull", ret);
@@ -48,4 +57,4 @@ void LaunchAppRunnable::run() const
 std::string LaunchAppRunnable::getPkgName()
 {
     return mPkg;
-}
\ No newline at end of file
+}
index 639bed7..a1c1c15 100644 (file)
@@ -316,6 +316,8 @@ message RspGetAppInfo {
 
 message ReqLaunchApp{
    string packageName = 1;
+   string key = 2;
+   string value = 3;
 }
 message RspLaunchApp{
    RspStatus status = 1;