[Tizen][AT-SPI] Track application lifecycle 22/315122/1
authorArtur Świgoń <a.swigon@samsung.com>
Thu, 4 Apr 2024 11:53:58 +0000 (13:53 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Thu, 25 Jul 2024 08:53:47 +0000 (10:53 +0200)
This allows to postpone the initalization of most infrastructure until the
application is acutally running from the UX point of view.

Change-Id: I451b70fe90568f0df66f75b9b0a889b75849f0c4

dali/devel-api/adaptor-framework/accessibility-bridge.h
dali/internal/accessibility/bridge/bridge-impl.cpp
dali/internal/accessibility/bridge/dummy/dummy-atspi.h
dali/internal/adaptor/common/application-impl.cpp

index 38ccd70ae27793b8bf63afe63e4a54aa76d38929..0796fadab18f2c0c79dc1ab3aec2fbc9efefbe68 100644 (file)
@@ -216,6 +216,16 @@ struct DALI_ADAPTOR_API Bridge
    */
   virtual void WindowMaximized(Window window) = 0;
 
+  /**
+   * @brief Tells the bridge that the application is not running
+   */
+  virtual void ApplicationPaused() = 0;
+
+  /**
+   * @brief Tells the bridge that the application is running
+    */
+  virtual void ApplicationResumed() = 0;
+
   /**
    * @brief Initializes accessibility bus.
    */
index 0ee2aaa8942ea5a0577050b905d3ecd18ec2899b..6896f1fcb170fc633b6caaa0cfe28fb9bfeaa43b 100644 (file)
@@ -80,6 +80,7 @@ class BridgeImpl : public virtual BridgeBase,
   DBus::DBusClient                                              mDirectReadingClient{};
   bool                                                          mIsScreenReaderEnabled{false};
   bool                                                          mIsEnabled{false};
+  bool                                                          mIsApplicationRunning{false};
   std::unordered_map<int32_t, std::function<void(std::string)>> mDirectReadingCallbacks{};
   Dali::Actor                                                   mHighlightedActor;
   std::function<void(Dali::Actor)>                              mHighlightClearAction{nullptr};
@@ -569,6 +570,24 @@ public:
     }
   }
 
+  /**
+   * @copydoc Dali::Accessibility::Bridge::ApplicationPaused()
+   */
+  void ApplicationPaused() override
+  {
+    mIsApplicationRunning = false;
+    SwitchBridge();
+  }
+
+  /**
+   * @copydoc Dali::Accessibility::Bridge::ApplicationResumed()
+   */
+  void ApplicationResumed() override
+  {
+    mIsApplicationRunning = true;
+    SwitchBridge();
+  }
+
   /**
    * @copydoc Dali::Accessibility::Bridge::SuppressScreenReader()
    */
@@ -584,7 +603,9 @@ public:
 
   void SwitchBridge()
   {
-    if((!mIsScreenReaderSuppressed && mIsScreenReaderEnabled) || mIsEnabled)
+    bool isScreenReaderEnabled = mIsScreenReaderEnabled && !mIsScreenReaderSuppressed;
+
+    if((isScreenReaderEnabled || mIsEnabled) && mIsApplicationRunning)
     {
       ForceUp();
     }
index 9e0035a6c3ea55b92cfacd57b5ed00da55da876e..451e797e4d0b35b59cc75d42e539f6207d5e0988 100644 (file)
@@ -109,6 +109,14 @@ struct DummyBridge : Dali::Accessibility::Bridge
   {
   }
 
+  void ApplicationPaused() override
+  {
+  }
+
+  void ApplicationResumed() override
+  {
+  }
+
   void Initialize() override
   {
   }
index 44d4146015cad2de06ab960539e6580c8065bfd2..0d348c47ed240d7df97b4cf509d54bfbda3488c5 100644 (file)
@@ -441,6 +441,8 @@ void Application::OnTerminate()
 
 void Application::OnPause()
 {
+  Accessibility::Bridge::GetCurrentBridge()->ApplicationPaused();
+
   // A DALi app should handle Pause/Resume events.
   // DALi just delivers the framework Pause event to the application, but not actually pause DALi core.
   // Pausing DALi core only occurs on the Window Hidden framework event
@@ -450,6 +452,8 @@ void Application::OnPause()
 
 void Application::OnResume()
 {
+  Accessibility::Bridge::GetCurrentBridge()->ApplicationResumed();
+
   // Emit the signal first so the application can queue any messages before we do an update/render
   // This ensures we do not just redraw the last frame before pausing if that's not required
   Dali::Application application(this);