[M108 Migration][a11y] Handled a11y for aurum case 62/314862/2 accepted/tizen_8.0_unified accepted/tizen/8.0/unified/20240802.160822
authorMayank Kumar <mayank.k@samsung.com>
Wed, 17 Jul 2024 10:15:01 +0000 (15:45 +0530)
committerBot Blink <blinkbot@samsung.com>
Mon, 22 Jul 2024 08:38:25 +0000 (08:38 +0000)
Accessibility flags include a vconf value and an "IsEnabled" value
from DBUS "org.a11y.Status". Aurum operates when "IsEnabled" is true,
regardless of the screen reader vconf value. The platform team
suggests enabling a11y if either the screen reader vconf or the DBUS
"org.a11y.Status" is enabled.

This patch includes the follwing changes:

1) Caches the "IsEnabled" value from AtSpiClientEnabledGet and
A11yPropertyChangedCb
2) Modifies the implementation of EWebAccessibilityUtil::
ToggleBrowserAccessibility to accept vconf as well as dbus values
3) Removes the useless result value check in EWebAccessibilityUtil
::Deactivate before ToggleBrowserAccessibility function call

Reference: https://review.tizen.org/gerrit/314688

Change-Id: I9cdb100097d1ec88ae976d806a5a8653e15a77a5
Signed-off-by: Mayank Kumar <mayank.k@samsung.com>
tizen_src/ewk/efl_integration/eweb_accessibility_util.cc
tizen_src/ewk/efl_integration/eweb_accessibility_util.h

index 2cfdcc76b6bd00e7a45d9636914b2145af3e4119..5d37d466a6e98e2635e0d44dc5968fd78008d509 100644 (file)
@@ -114,11 +114,8 @@ static void PropertyChangedCb(keynode_t* keynodeName, void* data) {
         << "Could not read VCONFKEY_SETAPPL_ACCESSIBILITY_TTS key value.";
     return;
   }
-#if defined(TIZEN_ATK_FEATURE_VD)
-  obj->ToggleBrowserAccessibility(result && !obj->IsDeactivatedByApp());
-#else
-  obj->ToggleBrowserAccessibility(result);
-#endif
+
+  obj->ToggleBrowserAccessibility(result, std::nullopt);
 }
 
 static void A11yPropertyChangedCb(void* data,
@@ -147,7 +144,7 @@ static void A11yPropertyChangedCb(void* data,
       return;
     }
 
-    obj->ToggleBrowserAccessibility(result);
+    obj->ToggleBrowserAccessibility(std::nullopt, result);
   }
 }
 /* LCOV_EXCL_STOP */
@@ -186,7 +183,7 @@ static void AtSpiClientEnabledGet(void* data,
     /* LCOV_EXCL_STOP */
   }
 
-  obj->ToggleBrowserAccessibility(is_enabled);
+  obj->ToggleBrowserAccessibility(std::nullopt, is_enabled);
 }
 
 EWebAccessibilityUtil* EWebAccessibilityUtil::GetInstance() {
@@ -290,10 +287,36 @@ void EWebAccessibilityUtil::NotifyAccessibilityStatus(bool mode) {
 #endif
 }
 
-void EWebAccessibilityUtil::ToggleBrowserAccessibility(bool mode) {
+void EWebAccessibilityUtil::ToggleBrowserAccessibility(
+    std::optional<bool> new_vconf,
+    std::optional<bool> new_dbus) {
   content::BrowserAccessibilityStateImpl* state =
       content::BrowserAccessibilityStateImpl::GetInstance();
 
+  if (new_vconf.has_value()) {
+    vconf_a11y_enabled_ = new_vconf.value();
+  }
+
+  if (new_dbus.has_value()) {
+    dbus_a11y_enabled_ = new_dbus.value();
+  }
+
+  LOG(INFO) << "vconf_a11y_enabled_ : " << vconf_a11y_enabled_;
+  LOG(INFO) << "dbus_a11y_enabled_ : " << dbus_a11y_enabled_;
+
+  bool mode = (vconf_a11y_enabled_ || dbus_a11y_enabled_);
+
+#if defined(TIZEN_ATK_FEATURE_VD)
+  if (deactivated_by_app_) {
+    mode = false;
+  }
+#endif
+  if (a11y_enabled_ == mode) {
+    return;
+  }
+
+  a11y_enabled_ = mode;
+
   if (mode) {
     /* LCOV_EXCL_START */
     InitAtkBridgeAdaptor();
@@ -342,8 +365,7 @@ void EWebAccessibilityUtil::Deactivate(bool deactivated) {
     return;
   }
 
-  if (result)
-    ToggleBrowserAccessibility(result && !deactivated_by_app_);
+  ToggleBrowserAccessibility(result, std::nullopt);
 }
 #endif
 
@@ -364,11 +386,8 @@ void EWebAccessibilityUtil::ToggleAtk(bool& atk_status) {
     return;
     /* LCOV_EXCL_STOP */
   }
-#if defined(TIZEN_ATK_FEATURE_VD)
-  ToggleBrowserAccessibility(result && !IsDeactivatedByApp());
-#else
-  ToggleBrowserAccessibility(result);
-#endif
+
+  ToggleBrowserAccessibility(result, std::nullopt);
 }
 
 #if defined(ENABLE_WRT_JS)
index 21a6ee8c66b98b1c161924e90355681b71ddf3ab..8e9929c0d163c036116cbcf2b76ed0244a18b6c2 100644 (file)
@@ -6,6 +6,7 @@
 #define EWEB_ACCESSIBILITY_UTIL_H
 
 #include <Eldbus.h>
+#include <optional>
 
 #include "base/memory/singleton.h"
 
@@ -19,9 +20,10 @@ class EWebAccessibility;
 class EWebAccessibilityUtil {
  public:
   static EWebAccessibilityUtil* GetInstance();
-  void ToggleBrowserAccessibility(bool mode);
+  void ToggleBrowserAccessibility(std::optional<bool> new_vconf,
+                                  std::optional<bool> new_dbus);
 
-#if BUILDFLAG(IS_TIZEN_TV)
+#if defined(TIZEN_ATK_FEATURE_VD)
   bool IsDeactivatedByApp() const { return deactivated_by_app_; }
   void Deactivate(bool deactivated);
 #endif
@@ -31,6 +33,10 @@ class EWebAccessibilityUtil {
 #endif
   void ToggleAtk(bool& atk_status);
 
+  bool dbus_a11y_enabled_ = false;
+  bool vconf_a11y_enabled_ = false;
+  bool a11y_enabled_ = false;
+
  private:
   EWebAccessibilityUtil();
   ~EWebAccessibilityUtil();
@@ -47,7 +53,7 @@ class EWebAccessibilityUtil {
   bool atk_bridge_initialized_ = false;
   friend struct base::DefaultSingletonTraits<EWebAccessibilityUtil>;
 
-#if BUILDFLAG(IS_TIZEN_TV)
+#if defined(TIZEN_ATK_FEATURE_VD)
   bool deactivated_by_app_;
 #endif