libaurum: Introduce new setIncludeHidden/getIncludeHidden 20/320320/4
authorHosang Kim <hosang12.kim@samsung.com>
Wed, 13 Nov 2024 06:31:18 +0000 (15:31 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Wed, 27 Nov 2024 04:31:35 +0000 (13:31 +0900)
Change-Id: I25ca1289128ad1a16b5079aadb8e7c8ec9d45d0b

18 files changed:
libaurum/inc/Accessibility/AccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiWrapper.h
libaurum/inc/Impl/Accessibility/MockAccessibleNode.h
libaurum/inc/UiObject.h
libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc
libaurum/src/Impl/Accessibility/AtspiWrapper.cc
libaurum/src/Impl/Accessibility/MockAccessibleNode.cc
libaurum/src/UiObject.cc
org.tizen.aurum-bootstrap/inc/AurumServiceImpl.h
org.tizen.aurum-bootstrap/inc/Commands/Commands.h
org.tizen.aurum-bootstrap/inc/Commands/GetIncludeHiddenCommand.h [new file with mode: 0644]
org.tizen.aurum-bootstrap/inc/Commands/SetIncludeHiddenCommand.h [new file with mode: 0644]
org.tizen.aurum-bootstrap/meson.build
org.tizen.aurum-bootstrap/src/AurumServiceImpl.cc
org.tizen.aurum-bootstrap/src/Commands/GetIncludeHiddenCommand.cc [new file with mode: 0644]
org.tizen.aurum-bootstrap/src/Commands/SetIncludeHiddenCommand.cc [new file with mode: 0644]
protocol/aurum.proto

index bee5e665107c472b278edfb91c86255ed7617e01..c9524f97ff5937aa2658c21565d3401e5d0d0c3f 100644 (file)
@@ -558,6 +558,16 @@ public:
      */
     virtual bool isValid() const;
 
+    /**
+     * @copydoc UIObject::setIncludeHidden()
+     */
+    virtual void setIncludeHidden(bool enabled) const = 0;
+
+    /**
+     * @copydoc UIObject::getIncludeHidden()
+     */
+    virtual bool getIncludeHidden() const = 0;
+
 public:
     /**
      * @brief Check Node support given interface or not.
index 98b1bf7839bf536e7f031379b409bb3aaaf8ad58..0834e2e2c9ad79370597e614829bc1391eb3a2df 100644 (file)
@@ -211,6 +211,16 @@ public:
      */
     bool setValue(double value) override;
 
+    /**
+     * @copydoc AccessibleNode::setIncludeHidden()
+     */
+    void setIncludeHidden(bool enabled) const override;
+
+    /**
+     * @copydoc AccessibleNode::getIncludeHidden()
+     */
+    bool getIncludeHidden() const override;
+
 private:
     using AccessibleNode::setFeatureProperty;
 
index 764c7d3e5fedd5e351f6791f10b36e4c4a1c00a9..8a54e26c65ab1da3d61bf7c10d269ad8fbd65cb2 100644 (file)
@@ -79,6 +79,8 @@ public:
     static AtspiAccessibleNodeInfo *Atspi_accessible_get_node_info(AtspiAccessible *obj, GError **error);
     static void Atspi_accessible_free_node_info(AtspiAccessibleNodeInfo *node_info);
     static AtspiAccessible *Atspi_accessible_get_neighbor(AtspiAccessible *root, AtspiAccessible *start, AtspiNeighborSearchDirection direction, GError **error);
+    static void Atspi_accessible_set_include_hidden(AtspiAccessible *obj, gboolean enabled, GError **error);
+    static gboolean Atspi_accessible_get_include_hidden(AtspiAccessible *obj, GError **error);
 
 private:
     static std::recursive_mutex mMutex;
index 3a0714a444040cb7e3ff2e15292f8ede8f10cf72..bd73f29743e9b79cae56685e4434f1b6e6592a34 100644 (file)
@@ -225,6 +225,18 @@ public:
      */
     bool setValue(double value) override;
 
+    /**
+     * @brief TBD
+     * @since_tizen 9.0
+     */
+    void setIncludeHidden(bool enabled) const override;
+
+    /**
+     * @brief TBD
+     * @since_tizen 9.0
+     */
+    bool getIncludeHidden() const override;
+
 public:
     using AccessibleNode::setFeatureProperty;
     /**
index a3d19620d7094b22919def8f77ed91cf7ec9c744..79681554b8f9ade291b566567ca583c3018b3ef8 100644 (file)
@@ -759,6 +759,20 @@ public:
      */
     std::shared_ptr<UiObject> last() const;
 
+    /**
+     * @brief Sets object's include hidden flag.
+     *
+     * @since_tizen 9.0
+     */
+    void setIncludeHidden(bool enabled) const;
+
+    /**
+     * @brief Gets object's include hidden flag.
+     *
+     * @since_tizen 9.0
+     */
+    bool getIncludeHidden() const;
+
 private:
     std::shared_ptr<UiDevice> mDevice;
     std::shared_ptr<UiSelector>  mSelector;
index 4f110229f59561387a706e3c45deb6136a959999..b82f0a6689a525017b653c51b8c71303d113002c 100644 (file)
@@ -752,4 +752,31 @@ std::shared_ptr<AccessibleNode> AtspiAccessibleNode::last() const
     }
 
     return nullptr;
+}
+
+void AtspiAccessibleNode::setIncludeHidden(bool enabled) const
+{
+    if (!isValid()) {
+        return;
+    }
+    AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(mNode, NULL);
+    if (app) {
+        AtspiWrapper::Atspi_accessible_set_include_hidden(app, enabled, NULL);
+        g_object_unref(app);
+    }
+}
+
+bool AtspiAccessibleNode::getIncludeHidden() const
+{
+    if (!isValid()) {
+        return false;
+    }
+    AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(mNode, NULL);
+    if (app) {
+        bool ret = AtspiWrapper::Atspi_accessible_get_include_hidden(app, NULL);
+        g_object_unref(app);
+        return ret;
+    }
+
+    return false;
 }
\ No newline at end of file
index 4b06ccb911b4305a1902a58a83b6e586d18808fe..4b3955bcf20ac9241a93fcb21396d9f145a1a34d 100644 (file)
@@ -285,3 +285,14 @@ AtspiAccessible *AtspiWrapper::Atspi_accessible_get_neighbor(AtspiAccessible *ro
     return atspi_accessible_get_neighbor(root, start, direction, error);
 }
 
+void AtspiWrapper::Atspi_accessible_set_include_hidden(AtspiAccessible *obj, gboolean enabled, GError **error)
+{
+    std::unique_lock<std::recursive_mutex> lock(mMutex);
+    atspi_accessible_set_include_hidden(obj, enabled, error);
+}
+
+gboolean AtspiWrapper::Atspi_accessible_get_include_hidden(AtspiAccessible *obj, GError **error)
+{
+    std::unique_lock<std::recursive_mutex> lock(mMutex);
+    return atspi_accessible_get_include_hidden(obj, error);
+}
index aa136cfc33dc73767731684cf60acbd7591d2369..4cc25b495b9b3e0690b3a0720a49574b766f6698 100644 (file)
@@ -335,4 +335,14 @@ std::shared_ptr<AccessibleNode> MockAccessibleNode::first() const
 std::shared_ptr<AccessibleNode> MockAccessibleNode::last() const
 {
     return nullptr;
+}
+
+void MockAccessibleNode::setIncludeHidden(bool enabled) const
+{
+    return;
+}
+
+bool MockAccessibleNode::getIncludeHidden() const
+{
+    return false;
 }
\ No newline at end of file
index d8b3ab4313b33788810c067dd45f1598ae1bbeb8..b15f2d9ff60fa9f6d946ec9a698023c8f7350813 100644 (file)
@@ -525,4 +525,12 @@ std::shared_ptr<UiObject> UiObject::last() const {
         return std::make_shared<UiObject>(mDevice, mSelector, lastNode);
     }
     return nullptr;
+}
+
+void UiObject::setIncludeHidden(bool enabled) const {
+    mNode->setIncludeHidden(enabled);
+}
+
+bool UiObject::getIncludeHidden() const {
+    return mNode->getIncludeHidden();
 }
\ No newline at end of file
index b46f12c56d3aac964f458ae81eb9b15f8c081e99..85fb4aa76712e3970c9f90c0d767cf0130c5bef4 100644 (file)
@@ -159,6 +159,12 @@ public:
     ::grpc::Status mouseMove(::grpc::ServerContext *context,
                              const ::aurum::ReqMouseMove *request,
                              ::aurum::RspMouseMove *response) override;
+    ::grpc::Status setIncludeHidden(::grpc::ServerContext *context,
+                             const ::aurum::ReqSetIncludeHidden *request,
+                             ::aurum::RspSetIncludeHidden *response) override;
+    ::grpc::Status getIncludeHidden(::grpc::ServerContext *context,
+                             const ::aurum::ReqGetIncludeHidden *request,
+                             ::aurum::RspGetIncludeHidden *response) override;
 public:
     int WAIT_TIMEOUT_MS;
 };
index 9d41566fb610d41976c8ef2201271d80028952c7..5ecac85a032bb6ece7b67b90f1f4c3c79a3f278b 100644 (file)
@@ -55,3 +55,5 @@
 #include "Commands/MouseDownCommand.h"
 #include "Commands/MouseMoveCommand.h"
 #include "Commands/MouseUpCommand.h"
+#include "Commands/SetIncludeHiddenCommand.h"
+#include "Commands/GetIncludeHiddenCommand.h"
diff --git a/org.tizen.aurum-bootstrap/inc/Commands/GetIncludeHiddenCommand.h b/org.tizen.aurum-bootstrap/inc/Commands/GetIncludeHiddenCommand.h
new file mode 100644 (file)
index 0000000..4af0a07
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "bootstrap.h"
+
+class GetIncludeHiddenCommand : public Command {
+private:
+    const ::aurum::ReqGetIncludeHidden *mRequest;
+    ::aurum::RspGetIncludeHidden *mResponse;
+
+public:
+    GetIncludeHiddenCommand(const ::aurum::ReqGetIncludeHidden *request,
+                   ::aurum::RspGetIncludeHidden *response);
+    ::grpc::Status execute() override;
+};
diff --git a/org.tizen.aurum-bootstrap/inc/Commands/SetIncludeHiddenCommand.h b/org.tizen.aurum-bootstrap/inc/Commands/SetIncludeHiddenCommand.h
new file mode 100644 (file)
index 0000000..959065e
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "bootstrap.h"
+
+class SetIncludeHiddenCommand : public Command {
+private:
+    const ::aurum::ReqSetIncludeHidden *mRequest;
+    ::aurum::RspSetIncludeHidden *mResponse;
+
+public:
+    SetIncludeHiddenCommand(const ::aurum::ReqSetIncludeHidden *request,
+                   ::aurum::RspSetIncludeHidden *response);
+    ::grpc::Status execute() override;
+};
index 315b844c7d2c8a90d5152161bfcd7b27a17532f5..4025cb457518fb9ced8d82887bddf629225eeaf1 100644 (file)
@@ -58,6 +58,8 @@ bootstrap_svr_src += [
    files('src/Commands/MouseDownCommand.cc'),
    files('src/Commands/MouseMoveCommand.cc'),
    files('src/Commands/MouseUpCommand.cc'),
+   files('src/Commands/SetIncludeHiddenCommand.cc'),
+   files('src/Commands/GetIncludeHiddenCommand.cc'),
 ]
 
 bootstrap_svr_dep = [
index a8642cc0262b49b31329caf934ea26f8ec81fdf3..b504ec4e21421df02eefb6da551fc9bcfb8c9aa5 100644 (file)
@@ -374,4 +374,20 @@ aurumServiceImpl::~aurumServiceImpl()
 {
     std::unique_ptr<MouseMoveCommand> cmd = std::make_unique<MouseMoveCommand>(request, response);
     return execute(cmd.get(), false);
+}
+
+::grpc::Status aurumServiceImpl::setIncludeHidden(::grpc::ServerContext *context,
+                                                  const ::aurum::ReqSetIncludeHidden *request,
+                                                  ::aurum::RspSetIncludeHidden *response)
+{
+    std::unique_ptr<SetIncludeHiddenCommand> cmd = std::make_unique<SetIncludeHiddenCommand>(request, response);
+    return execute(cmd.get(), false);
+}
+
+::grpc::Status aurumServiceImpl::getIncludeHidden(::grpc::ServerContext *context,
+                                                  const ::aurum::ReqGetIncludeHidden *request,
+                                                  ::aurum::RspGetIncludeHidden *response)
+{
+    std::unique_ptr<GetIncludeHiddenCommand> cmd = std::make_unique<GetIncludeHiddenCommand>(request, response);
+    return execute(cmd.get(), false);
 }
\ No newline at end of file
diff --git a/org.tizen.aurum-bootstrap/src/Commands/GetIncludeHiddenCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/GetIncludeHiddenCommand.cc
new file mode 100644 (file)
index 0000000..09a1acb
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "GetIncludeHiddenCommand.h"
+#include "UiObject.h"
+
+GetIncludeHiddenCommand::GetIncludeHiddenCommand(const ::aurum::ReqGetIncludeHidden *request,
+                               ::aurum::RspGetIncludeHidden *response)
+    : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status GetIncludeHiddenCommand::execute()
+{
+    LOGI("GetIncludeHidden--------------- ");
+
+    ObjectMapper *mObjMap = ObjectMapper::getInstance();
+    std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
+    if (obj) {
+        mResponse->set_enabled(obj->getIncludeHidden());
+        mResponse->set_status(::aurum::RspStatus::OK);
+    } else {
+        mResponse->set_status(::aurum::RspStatus::ERROR);
+    }
+
+    return grpc::Status::OK;
+}
diff --git a/org.tizen.aurum-bootstrap/src/Commands/SetIncludeHiddenCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/SetIncludeHiddenCommand.cc
new file mode 100644 (file)
index 0000000..b065758
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "SetIncludeHiddenCommand.h"
+#include "UiObject.h"
+
+SetIncludeHiddenCommand::SetIncludeHiddenCommand(const ::aurum::ReqSetIncludeHidden *request,
+                               ::aurum::RspSetIncludeHidden *response)
+    : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status SetIncludeHiddenCommand::execute()
+{
+    LOGI("SetIncludeHidden--------------- ");
+
+    ObjectMapper *mObjMap = ObjectMapper::getInstance();
+    std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
+    if (obj) obj->setIncludeHidden(mRequest->enabled());
+
+    mResponse->set_status(::aurum::RspStatus::OK);
+
+    return grpc::Status::OK;
+}
index 9dc8fb60d55689be431b9f7bd425cd232ade193e..1ecdafae6b027a2a1c3f436eccce8cd5d3f1e613 100644 (file)
@@ -47,6 +47,8 @@ service Bootstrap {
    rpc mouseDown(ReqMouseDown) returns (RspMouseDown) {}
    rpc mouseMove(ReqMouseMove) returns (RspMouseMove) {}
    rpc mouseUp(ReqMouseUp) returns (RspMouseUp) {}
+   rpc setIncludeHidden(ReqSetIncludeHidden) returns (RspSetIncludeHidden) {}
+   rpc getIncludeHidden(ReqGetIncludeHidden) returns (RspGetIncludeHidden) {}
 }
 
 // ------------------------------------ //
@@ -760,3 +762,21 @@ message RspGetParent {
    RspStatus status = 1;
    Element element = 2;
 }
+
+message ReqSetIncludeHidden {
+   string elementId = 1;
+   bool enabled = 2;
+}
+
+message RspSetIncludeHidden {
+   RspStatus status = 1;
+}
+
+message ReqGetIncludeHidden {
+   string elementId = 1;
+}
+
+message RspGetIncludeHidden {
+   RspStatus status = 1;
+   bool enabled = 2;
+}