libaurum: add packageName to actionAndWaitEvent command 31/282531/2
authorChihun Jeong <chihun.jeong@samsung.com>
Wed, 5 Oct 2022 06:14:10 +0000 (15:14 +0900)
committerWonsik Jung <sidein@samsung.com>
Tue, 18 Oct 2022 07:03:00 +0000 (07:03 +0000)
Change-Id: I7d8e4699093ce98592fe6eab90e75a205a9c04d9

libaurum/inc/Accessibility/AccessibleWatcher.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleWatcher.h
libaurum/inc/Impl/Accessibility/MockAccessibleWatcher.h
libaurum/inc/UiDevice.h
libaurum/src/Impl/Accessibility/AtspiAccessibleWatcher.cc
libaurum/src/Impl/Accessibility/MockAccessibleWatcher.cc
libaurum/src/UiDevice.cc
org.tizen.aurum-bootstrap/src/Commands/ActionAndWaitEventCommand.cc
org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc
protocol/aurum.proto

index 227b0de446af9664f3d88dd9e8f87010c03dabd6..5f2c300629b8f9c75d842e3c26062654f7d15389 100644 (file)
@@ -108,7 +108,7 @@ public:
      *
      * @since_tizen 6.5
      */
-    virtual bool executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout) = 0;
+    virtual bool executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout, const std::string packageName) = 0;
 
     /**
      * @brief Gets active application map.
index e63bf03bf49e28905b74097ea83002006d03a2cf..9285e6ad5307833b3489e1d88d48529e8b36ddfd 100644 (file)
@@ -105,7 +105,7 @@ public:
     /**
      * @copydoc @AccessibleWatcher::executeAndWaitForEvents()
      */
-    virtual bool executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout) override;
+    virtual bool executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout, const std::string packageName) override;
 
     /**
      * @copydoc @AccessibleWatcher::getActiveAppMap()
index bf480cb3a5fb26841aa0ee0dc530c72c9bcffca5..0139365d95b3ac13246e84deb016ecacd0db4ba8 100644 (file)
@@ -71,7 +71,7 @@ public:
      * @brief TBD
      * @since_tizen 6.5
      */
-    virtual bool executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout) override;
+    virtual bool executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout, const std::string packageName) override;
 
     std::map<AtspiAccessible *, std::shared_ptr<AccessibleApplication>> getActiveAppMap(void);
 
index 7e89949c1c6877dfad1895576b4e2b3bcb67c7ee..fa4a22aaa311b714e563aafcf9c9dd52ddb4bd0a 100644 (file)
@@ -364,13 +364,14 @@ public:
      * @param[in] cmd @Runnable
      * @param[in] type one of @A11yEvent
      * @param[in] timeout time(millisecond) to wait event occur
+     * @param[in] packageName package name that event occurs
      *
      * @return true if event happened in time, otherwise false
      *
      * @since_tizen 6.5
      */
     bool executeAndWaitForEvents(
-        const Runnable *cmd, const A11yEvent type, const int timeout) const;
+        const Runnable *cmd, const A11yEvent type, const int timeout, const std::string packageName) const;
 public:
     /**
      * @brief Gets UiDevice instance.
index 8e918959b1f1c0f89f7c41244d5be059025ea2b1..f3d7d8eb64a8f2aa8389d61e02f78c42439ec92f 100644 (file)
@@ -306,7 +306,7 @@ std::vector<std::shared_ptr<AccessibleApplication>> AtspiAccessibleWatcher::getA
     return ret;
 }
 
-bool AtspiAccessibleWatcher::executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout)
+bool AtspiAccessibleWatcher::executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout, const std::string packageName)
 {
     mMutex.lock();
     mEventQueue.clear();
@@ -327,9 +327,9 @@ bool AtspiAccessibleWatcher::executeAndWaitForEvents(const Runnable *cmd, const
         if (!localEvents.empty())
         {
             for (const auto &event : localEvents) {
-                if (COMPARE(type, event->getEvent()))
+                if (COMPARE(type, event->getEvent()) && (packageName.empty() || packageName == event->getPkg()))
                 {
-                    LOGI("type %d == %d name %s pkg %s",static_cast<int>(type), static_cast<int>(event->getEvent()), event->getName().c_str(), event->getPkg().c_str()); 
+                    LOGI("type %d == %d name %s pkg %s",static_cast<int>(type), static_cast<int>(event->getEvent()), event->getName().c_str(), event->getPkg().c_str());
                     return true;
                 }
             }
index 2a218d1ce66bd66efbdc7c092e13ed13bd3a7508..4377d88843955e646b61a50abff76969169d290e 100644 (file)
@@ -68,7 +68,7 @@ std::shared_ptr<MockAccessibleApplication> MockAccessibleWatcher::addApplication
     return app;
 }
 
-bool MockAccessibleWatcher::executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout)
+bool MockAccessibleWatcher::executeAndWaitForEvents(const Runnable *cmd, const A11yEvent type, const int timeout, const std::string packageName)
 {
     return true;
 }
index 198dcd84c3008fc8747614e69d344f8983c81b10..eccd630e08565a8122576ba04046114aa874c6ee 100644 (file)
@@ -301,20 +301,20 @@ bool UiDevice::waitForIdle() const
 bool UiDevice::waitForEvents(
     const A11yEvent type, const int timeout) const
 {
-    return executeAndWaitForEvents(NULL, type, timeout);
+    return executeAndWaitForEvents(NULL, type, timeout, std::string());
 }
 
 bool UiDevice::executeAndWaitForEvents(
-    const Runnable *cmd, const A11yEvent type, const int timeout) const
+    const Runnable *cmd, const A11yEvent type, const int timeout, const std::string packageName) const
 {
-    return AccessibleWatcher::getInstance()->executeAndWaitForEvents(cmd, type, timeout);
+    return AccessibleWatcher::getInstance()->executeAndWaitForEvents(cmd, type, timeout, packageName);
 }
 
 bool UiDevice::sendKeyAndWaitForEvents(
     const std::string keycode, const A11yEvent type, const int timeout) const
 {
     std::unique_ptr<SendKeyRunnable> cmd = std::make_unique<SendKeyRunnable>(keycode);
-    return executeAndWaitForEvents(cmd.get(), type, timeout);
+    return executeAndWaitForEvents(cmd.get(), type, timeout, std::string());
 }
 
 bool UiDevice::click(const int x, const int y)
index 76d5e4b56f9c782d898b042475e004a0bc940f8f..4449c2f4f084ca75fbc0d6905d19ba14ed0dcb2a 100644 (file)
@@ -44,7 +44,7 @@ A11yEvent convertEventType(const ::aurum::ReqActionAndWaitEvent_EventType type)
     std::unique_ptr<ActionAndWaitEventRunnable> cmd = std::make_unique<ActionAndWaitEventRunnable>(
                                                       mRequest->type(), mRequest->elementid(), mRequest->xf86keycode());
     std::shared_ptr<UiDevice> obj = UiDevice::getInstance();
-    bool ret = obj->executeAndWaitForEvents(cmd.get(), convertEventType(mRequest->eventtype()), mRequest->timeoutms());
+    bool ret = obj->executeAndWaitForEvents(cmd.get(), convertEventType(mRequest->eventtype()), mRequest->timeoutms(), mRequest->packagename());
 
     if (ret) mResponse->set_status(::aurum::RspStatus::OK);
     else mResponse->set_status(::aurum::RspStatus::ERROR);
index 8f85d5bb55f62c0b6cde6a72df3d3b9711ed2aa0..401ac0a94c0c44cc7c5950c41a3c63ca9d429aa5 100644 (file)
@@ -35,7 +35,7 @@ LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp *request,
     LOGI("LaunchApp --------------- ");
     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);
+    obj->executeAndWaitForEvents(cmd.get(), A11yEvent::EVENT_WINDOW_ACTIVATE, WAIT_APP_LAUNCH, mRequest->packagename());
 
     return grpc::Status::OK;
 }
\ No newline at end of file
index 2240ae5a5b657560dbaa0e2dd9824befba2d3660..73ed266ac2ff3cee25d9b5e18afc3c8f2097ee63 100644 (file)
@@ -572,6 +572,7 @@ message ReqActionAndWaitEvent {
    }
    EventType eventType = 4;
    int32 timeoutMs = 5;
+   string packageName = 6;
 }
 
 message RspActionAndWaitEvent {