From 5fcf92fc51f2850aa922221033f8e423e8d539b2 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Fri, 10 Dec 2021 17:42:21 +0900 Subject: [PATCH] [Tizen] [ATSPI] ignore ScreenReaderEnabled property on suppress mode The 'suppress' mode means that we do not want screen-reader working for our ATSPI related event. In this case, it would be better NOT to enable ATSPI bridge. So far we have used 'suppress-screen-reader' attribute. But sometimes GetAttributes does not work with following error message. "get attribute error: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken." We could handle this case, but the best is NOT to send unnecessary ATSPI events. The screen-reader should turning on ScreenReaderEnabled property only The ATSPI bridge will be enabled, when IsEnabled property is set by another AT client such as Aurum. Change-Id: I529ae8cc29594915b20c23279371a6488d11ea2d --- .../accessibility/bridge/bridge-accessible.cpp | 5 ---- .../accessibility/bridge/bridge-accessible.h | 9 ------ dali/internal/accessibility/bridge/bridge-base.h | 1 + dali/internal/accessibility/bridge/bridge-impl.cpp | 33 ++++++++++++++++++++-- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/dali/internal/accessibility/bridge/bridge-accessible.cpp b/dali/internal/accessibility/bridge/bridge-accessible.cpp index e389f15..db83ffc 100644 --- a/dali/internal/accessibility/bridge/bridge-accessible.cpp +++ b/dali/internal/accessibility/bridge/bridge-accessible.cpp @@ -601,11 +601,6 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial() describedByObject}; } -void BridgeAccessible::SuppressScreenReader(bool suppress) -{ - mIsScreenReaderSuppressed = suppress; -} - DBus::ValueOrError BridgeAccessible::DoGesture(Dali::Accessibility::Gesture type, int32_t startPositionX, int32_t startPositionY, int32_t endPositionX, int32_t endPositionY, Dali::Accessibility::GestureState state, uint32_t eventTime) { // Please be aware of sending GestureInfo point in the different order with parameters diff --git a/dali/internal/accessibility/bridge/bridge-accessible.h b/dali/internal/accessibility/bridge/bridge-accessible.h index 219db3b..49e3439 100644 --- a/dali/internal/accessibility/bridge/bridge-accessible.h +++ b/dali/internal/accessibility/bridge/bridge-accessible.h @@ -190,11 +190,6 @@ public: ReadingMaterialType GetReadingMaterial(); /** - * @copydoc Dali::Accessibility::Bridge::SuppressScreenReader() - */ - void SuppressScreenReader(bool) override; - - /** * @copydoc Dali::Accessibility::Accessible::DoGesture() */ DBus::ValueOrError DoGesture(Dali::Accessibility::Gesture type, int32_t startPositionX, int32_t startPositionY, int32_t endPositionX, int32_t endPositionY, Dali::Accessibility::GestureState state, uint32_t eventTime); @@ -285,10 +280,6 @@ private: * @return The Component object */ Dali::Accessibility::Component* CalculateNavigableAccessibleAtPoint(Dali::Accessibility::Accessible* root, Dali::Accessibility::Point point, Dali::Accessibility::CoordinateType type, unsigned int maxRecursionDepth); - - -protected: - bool mIsScreenReaderSuppressed = false; }; #endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_ACCESSIBLE_H diff --git a/dali/internal/accessibility/bridge/bridge-base.h b/dali/internal/accessibility/bridge/bridge-base.h index 62a0094..74f4384 100644 --- a/dali/internal/accessibility/bridge/bridge-base.h +++ b/dali/internal/accessibility/bridge/bridge-base.h @@ -433,6 +433,7 @@ public: protected: mutable AppAccessible mApplication; std::vector mPopups; + bool mIsScreenReaderSuppressed = false; private: diff --git a/dali/internal/accessibility/bridge/bridge-impl.cpp b/dali/internal/accessibility/bridge/bridge-impl.cpp index bbb050b..5962576 100644 --- a/dali/internal/accessibility/bridge/bridge-impl.cpp +++ b/dali/internal/accessibility/bridge/bridge-impl.cpp @@ -437,6 +437,19 @@ public: } } + /** + * @copydoc Dali::Accessibility::Bridge::SuppressScreenReader() + */ + void SuppressScreenReader(bool suppress) override + { + if(mIsScreenReaderSuppressed == suppress) + { + return; + } + mIsScreenReaderSuppressed = suppress; + ReadScreenReaderEnabledProperty(); + } + bool ReadIsEnabledTimerCallback() { ReadIsEnabledProperty(); @@ -461,10 +474,14 @@ public: return; } mIsEnabled = std::get<0>(msg); - if(mIsEnabled) + if((!mIsScreenReaderSuppressed && mIsScreenReaderEnabled) || mIsEnabled) { ForceUp(); } + else + { + ForceDown(); + } }); } @@ -491,6 +508,12 @@ public: void ReadScreenReaderEnabledProperty() { + // can be true because of SuppressScreenReader before init + if (!mAccessibilityStatusClient) + { + return; + } + mAccessibilityStatusClient.property("ScreenReaderEnabled").asyncGet([this](DBus::ValueOrError msg) { if(!msg) { @@ -507,10 +530,14 @@ public: return; } mIsScreenReaderEnabled = std::get<0>(msg); - if(mIsScreenReaderEnabled) + if((!mIsScreenReaderSuppressed && mIsScreenReaderEnabled) || mIsEnabled) { ForceUp(); } + else + { + ForceDown(); + } }); } @@ -518,7 +545,7 @@ public: { mAccessibilityStatusClient.addPropertyChangedEvent("ScreenReaderEnabled", [this](bool res) { mIsScreenReaderEnabled = res; - if(mIsScreenReaderEnabled || mIsEnabled) + if((!mIsScreenReaderSuppressed && mIsScreenReaderEnabled) || mIsEnabled) { ForceUp(); } -- 2.7.4