Revert "[Tizen][AT_SPI] Remove Bridge::EnableAutoInit() arguments and etc."
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 1 Jun 2021 01:01:13 +0000 (10:01 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 1 Jun 2021 07:15:40 +0000 (16:15 +0900)
This reverts commit b29fce6b662a6f4a82d7667714473e16b3967220.

13 files changed:
dali/devel-api/adaptor-framework/accessibility-impl.h
dali/devel-api/adaptor-framework/atspi-accessibility.cpp
dali/devel-api/adaptor-framework/atspi-accessibility.h
dali/internal/accessibility/bridge/accessibility-common.h
dali/internal/accessibility/bridge/bridge-accessible.cpp
dali/internal/accessibility/bridge/bridge-accessible.h
dali/internal/accessibility/bridge/bridge-base.cpp
dali/internal/accessibility/bridge/bridge-base.h
dali/internal/accessibility/bridge/bridge-impl.cpp
dali/internal/accessibility/bridge/bridge-object.cpp
dali/internal/accessibility/bridge/dummy-atspi.cpp
dali/internal/accessibility/bridge/dummy-atspi.h
dali/internal/system/common/environment-variables.h

index c2741d2..7f1faae 100644 (file)
@@ -254,13 +254,6 @@ struct DALI_ADAPTOR_API Bridge
   virtual void StopReading(bool alsoNonDiscardable) = 0;
 
   /**
-   * @brief Suppresses reading of screen-reader
-   *
-   * @param suppress whether to suppress reading of screen-reader
-   */
-  virtual void SuppressScreenReader(bool suppress) = 0;
-
-  /**
    * @brief Get screen reader status.
    */
   virtual bool GetScreenReaderEnabled() = 0;
@@ -275,34 +268,6 @@ struct DALI_ADAPTOR_API Bridge
    **/
   static Bridge* GetCurrentBridge();
 
-  /**
-   * @brief Blocks auto-initialization of AT-SPI bridge
-   *
-   * Use this only if your application starts before DBus does, and call it early in main()
-   * (before GetCurrentBridge() is called by anyone). GetCurrentBridge() will then return an
-   * instance of DummyBridge.
-   *
-   * When DBus is ready, call EnableAutoInit(). Please note that GetCurrentBridge() may still
-   * return an instance of DummyBridge if AT-SPI was disabled at compile time or using an
-   * environment variable, or if creating the real bridge failed.
-   *
-   * @see Dali::Accessibility::DummyBridge
-   * @see Dali::Accessibility::Bridge::EnableAutoInit
-   */
-  static void DisableAutoInit();
-
-  /**
-   * @brief Re-enables auto-initialization of AT-SPI bridge
-   *
-   * Normal applications do not have to call this function. GetCurrentBridge() tries to
-   * initialize the AT-SPI bridge when it is called for the first time.
-   *
-   * @see Dali::Accessibility::Bridge::DisableAutoInit
-   * @see Dali::Accessibility::Bridge::AddTopLevelWindow
-   * @see Dali::Accessibility::Bridge::SetApplicationName
-   */
-  static void EnableAutoInit();
-
 protected:
   struct Data
   {
@@ -314,13 +279,6 @@ protected:
   std::shared_ptr<Data> data;
   friend class Accessible;
 
-  enum class AutoInitState
-  {
-    DISABLED,
-    ENABLED
-  };
-  inline static AutoInitState autoInitState = AutoInitState::ENABLED;
-
   /**
    * @brief Registers accessible object to be known in bridge object
    *
index 563fe90..7b36a94 100644 (file)
@@ -42,17 +42,6 @@ void Dali::AtspiAccessibility::StopReading(bool alsoNonDiscardable)
   }
 }
 
-bool Dali::AtspiAccessibility::SuppressScreenReader(bool suppress)
-{
-  if(auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge())
-  {
-    bridge->SuppressScreenReader(suppress);
-    return true;
-  }
-
-  return false;
-}
-
 void Dali::AtspiAccessibility::Say(const std::string& text, bool discardable, std::function<void(std::string)> callback)
 {
   if(auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge())
index ea95524..6c703f8 100644 (file)
@@ -57,14 +57,6 @@ DALI_ADAPTOR_API void Resume();
 DALI_ADAPTOR_API void StopReading(bool alsoNonDiscardable = false);
 
 /**
- * @brief Suppresses reading of screen-reader
- *
- * @param suppress whether to suppress reading of screen-reader
- * @return true on success, false otherwise
- */
-DALI_ADAPTOR_API bool SuppressScreenReader(bool suppress);
-
-/**
  * @brief Set ATSPI to be turned On or Off forcibly.
  *
  * @param[in] turnOn true to turn on, false to turn off.
index d9165f6..cdb92e1 100644 (file)
@@ -34,8 +34,6 @@
 #define A11yDbusPath "/org/a11y/bus"
 #define A11yDbusStatusInterface "org.a11y.Status"
 #define AtspiDbusNameRegistry "org.a11y.atspi.Registry"
-#define AtspiDbusPathRegistry "/org/a11y/atspi/registry"
-#define AtspiDbusInterfaceRegistry "org.a11y.atspi.Registry"
 #define AtspiDbusPathRoot "/org/a11y/atspi/accessible/root"
 #define AtspiDbusInterfaceSocket "org.a11y.atspi.Socket"
 #define AtspiPath "/org/a11y/atspi/accessible"
index 4f5ebb2..028d0ca 100644 (file)
@@ -341,11 +341,6 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
     describedByObject};
 }
 
-void BridgeAccessible::SuppressScreenReader(bool suppress)
-{
-   suppressScreenReader = suppress;
-}
-
 DBus::ValueOrError<bool> BridgeAccessible::DoGesture(Dali::Accessibility::Gesture type, int32_t xBeg, int32_t yBeg, int32_t xEnd, int32_t yEnd, Dali::Accessibility::GestureState state, uint32_t eventTime)
 {
   return FindSelf()->DoGesture(Dali::Accessibility::GestureInfo{type, xBeg, xEnd, yBeg, yEnd, state, eventTime});
@@ -724,13 +719,7 @@ DBus::ValueOrError<std::array<uint32_t, 2>> BridgeAccessible::GetStates()
 }
 DBus::ValueOrError<std::unordered_map<std::string, std::string>> BridgeAccessible::GetAttributes()
 {
-  std::unordered_map<std::string, std::string> attributes = FindSelf()->GetAttributes();
-  if(suppressScreenReader)
-  {
-    attributes.insert({"suppress-screen-reader", "true"});
-  }
-
-  return attributes;
+  return FindSelf()->GetAttributes();
 }
 DBus::ValueOrError<std::vector<std::string>> BridgeAccessible::GetInterfaces()
 {
index d5bdc52..7a59cb4 100644 (file)
@@ -33,7 +33,6 @@ protected:
   BridgeAccessible();
 
   void RegisterInterfaces();
-  bool suppressScreenReader = false;
 
 public:
   enum class GetNeighborSearchMode
@@ -87,7 +86,6 @@ public:
     >;
 
   ReadingMaterialType GetReadingMaterial();
-  void                SuppressScreenReader(bool) override;
 
   DBus::ValueOrError<bool> DoGesture(Dali::Accessibility::Gesture type, int32_t xBeg, int32_t yBeg, int32_t xEnd, int32_t yEnd, Dali::Accessibility::GestureState state, uint32_t eventTime);
 
index dcca27b..9f1da75 100644 (file)
@@ -88,29 +88,6 @@ bool BridgeBase::tickFilteredEvents()
   return !filteredEvents.empty();
 }
 
-void BridgeBase::RegisteredEventsUpdate()
-{
-  using ReturnType = std::vector<std::tuple<std::string, std::string>>;
-  registry.method<DBus::ValueOrError<ReturnType>()>( "GetRegisteredEvents" ).asyncCall([this](DBus::ValueOrError<ReturnType> msg) {
-    if(!msg)
-    {
-      LOG() << "Get registered events failed";
-      return;
-    }
-
-    allowObjectBoundsChangedEvent = false;
-
-    ReturnType values = std::get<ReturnType>(msg.getValues());
-    for(long unsigned int i = 0; i < values.size(); i++)
-    {
-      if (!std::get<1>(values[i]).compare("Object:BoundsChanged"))
-      {
-        allowObjectBoundsChangedEvent = true;
-      }
-    }
-  });
-}
-
 BridgeBase::ForceUpResult BridgeBase::ForceUp()
 {
   if(Bridge::ForceUp() == ForceUpResult::ALREADY_UP)
@@ -140,25 +117,12 @@ BridgeBase::ForceUpResult BridgeBase::ForceUp()
     dbusServer.addInterface(AtspiPath, desc);
   }
 
-  registry = {AtspiDbusNameRegistry, AtspiDbusPathRegistry, AtspiDbusInterfaceRegistry, con};
-
-  RegisteredEventsUpdate();
-
-  registry.addSignal<void(void)>("EventListenerRegistered", [this](void) {
-    RegisteredEventsUpdate();
-  });
-
-  registry.addSignal<void(void)>("EventListenerDeregistered", [this](void) {
-    RegisteredEventsUpdate();
-  });
-
   return ForceUpResult::JUST_STARTED;
 }
 
 void BridgeBase::ForceDown()
 {
   Bridge::ForceDown();
-  registry   = {};
   dbusServer = {};
   con        = {};
 }
index 5088ec6..e14f864 100644 (file)
@@ -275,7 +275,6 @@ protected:
 private:
   void IdSet(int id);
   int  IdGet();
-  void RegisteredEventsUpdate();
 
   using CacheElementType = std::tuple<
     Dali::Accessibility::Address,
@@ -300,8 +299,6 @@ protected:
   DBus::DBusServer           dbusServer;
   DBusWrapper::ConnectionPtr con;
   int                        id = 0;
-  DBus::DBusClient           registry;
-  bool                       allowObjectBoundsChangedEvent;
 };
 
 #endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_BASE_H
index 216b89b..b3ec24d 100644 (file)
@@ -18,8 +18,6 @@
 // CLASS HEADER
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/actors/layer.h>
-#include <dali/devel-api/common/stage.h>
 #include <dali/integration-api/debug.h>
 #include <iostream>
 #include <unordered_map>
 #include <dali/internal/accessibility/bridge/bridge-text.h>
 #include <dali/internal/accessibility/bridge/bridge-value.h>
 #include <dali/internal/accessibility/bridge/dummy-atspi.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/system/common/environment-variables.h>
 #include <dali/devel-api/adaptor-framework/environment-variable.h>
-#include <dali/devel-api/adaptor-framework/window-devel.h>
 
 using namespace Dali::Accessibility;
 
@@ -339,12 +335,8 @@ public:
   }
 };
 
-static bool bridgeInitialized;
-
 static Bridge* CreateBridge()
 {
-  bridgeInitialized = true;
-
   try
   {
     /* check environment variable first */
@@ -365,59 +357,6 @@ static Bridge* CreateBridge()
 
 Bridge* Bridge::GetCurrentBridge()
 {
-  static Bridge* bridge;
-
-  if (bridge)
-  {
-    return bridge;
-  }
-  else if (autoInitState == AutoInitState::ENABLED)
-  {
-    bridge = CreateBridge();
-
-    /* check environment variable for suppressing screen-reader */
-    const char *envSuppressScreenReader = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_SUPPRESS_SCREEN_READER);
-    if (envSuppressScreenReader && std::atoi(envSuppressScreenReader) != 0)
-    {
-      bridge->SuppressScreenReader(true);
-    }
-
-    return bridge;
-  }
-
-  return Dali::Accessibility::DummyBridge::GetInstance();
-}
-
-void Bridge::DisableAutoInit()
-{
-  if (bridgeInitialized)
-  {
-    DALI_LOG_ERROR("Bridge::DisableAutoInit() called after bridge auto-initialization");
-  }
-
-  autoInitState = AutoInitState::DISABLED;
-}
-
-void Bridge::EnableAutoInit()
-{
-  autoInitState = AutoInitState::ENABLED;
-
-  if (bridgeInitialized)
-  {
-    return;
-  }
-
-  auto rootLayer = Dali::Stage::GetCurrent().GetRootLayer();
-  auto window = Dali::DevelWindow::Get(rootLayer);
-  auto applicationName = Dali::Internal::Adaptor::Adaptor::GetApplicationPackageName();
-
-  auto* bridge = Bridge::GetCurrentBridge();
-  bridge->AddTopLevelWindow(Dali::Accessibility::Accessible::Get(rootLayer, true));
-  bridge->SetApplicationName(applicationName);
-  bridge->Initialize();
-
-  if(window && window.IsVisible())
-  {
-    bridge->ApplicationShown();
-  }
+  static Bridge* bridge = CreateBridge();
+  return bridge;
 }
index 06bb80d..e91f2e8 100644 (file)
@@ -496,8 +496,6 @@ void BridgeObject::EmitStateChanged(Accessible* obj, State state, int newValue1,
 
 void BridgeObject::EmitBoundsChanged(Accessible* obj, Dali::Rect<> rect)
 {
-  if(!allowObjectBoundsChangedEvent) return;
-
   auto        addr       = obj->GetAddress();
   const auto  prefixPath = "/org/a11y/atspi/accessible/";
   const auto  nullPath   = "/org/a11y/atspi/null";
index d63b02a..8eec6b8 100644 (file)
@@ -75,14 +75,6 @@ Accessibility::Bridge* Accessibility::Bridge::GetCurrentBridge()
   return Accessibility::DummyBridge::GetInstance();
 }
 
-void Accessibility::Bridge::DisableAutoInit()
-{
-}
-
-void Accessibility::Bridge::EnableAutoInit()
-{
-}
-
 void Accessibility::Accessible::EmitStateChanged(Accessibility::State state, int newValue1, int newValue2)
 {
 }
index e760c65..f47a33a 100644 (file)
@@ -140,10 +140,6 @@ struct DummyBridge : Dali::Accessibility::Bridge
   {
   }
 
-  void SuppressScreenReader(bool suppress) override
-  {
-  }
-
   bool GetScreenReaderEnabled() override
   {
     return false;
index ab3f1b9..094c16e 100644 (file)
@@ -139,8 +139,6 @@ namespace Adaptor
 
 #define DALI_ENV_DISABLE_ATSPI "DALI_DISABLE_ATSPI"
 
-#define DALI_ENV_SUPPRESS_SCREEN_READER "DALI_SUPPRESS_SCREEN_READER"
-
 } // namespace Adaptor
 
 } // namespace Internal