[Tizen][AT-SPI] Track application lifecycle 96/309096/1 accepted/tizen/7.0/unified/20240411.100459
authorArtur Świgoń <a.swigon@samsung.com>
Thu, 4 Apr 2024 11:53:58 +0000 (13:53 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Thu, 4 Apr 2024 13:29:49 +0000 (15:29 +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 58a98fed947a1bb415c13ef0d092a8b7fdd843c5..2ad9d38274a1ebdf195b962291a7162c4ba873ed 100644 (file)
@@ -194,6 +194,16 @@ struct DALI_ADAPTOR_API Bridge
    */
   virtual void WindowUnfocused(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 46c30c7d98ea1e1bd645235e6624e61b406d60e3..00c60a60e59eb73b24844218a0909652539c23ec 100644 (file)
@@ -82,6 +82,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;
@@ -494,6 +495,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()
    */
@@ -509,7 +528,9 @@ public:
 
   void SwitchBridge()
   {
-    if((!mIsScreenReaderSuppressed && mIsScreenReaderEnabled) || mIsEnabled)
+    bool isScreenReaderEnabled = mIsScreenReaderEnabled && !mIsScreenReaderSuppressed;
+
+    if((isScreenReaderEnabled || mIsEnabled) && mIsApplicationRunning)
     {
       ForceUp();
     }
index 195fa6eb2013e1871114222afdb79ce9bd3b456b..c56e29ac13de20f7689e6a43e366bb83169bbd1b 100644 (file)
@@ -97,6 +97,14 @@ struct DummyBridge : Dali::Accessibility::Bridge
   {
   }
 
+  void ApplicationPaused() override
+  {
+  }
+
+  void ApplicationResumed() override
+  {
+  }
+
   void Initialize() override
   {
   }
index 0a8e122de6e0e520af1a54e4bf835402c39d0775..d3e8bd37d75dba02e842df6ac1514230219c2bfe 100644 (file)
@@ -333,6 +333,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
@@ -342,6 +344,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);