[NUI] Check whether Accessibility is enabled intentionally
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Wed, 20 Oct 2021 07:12:22 +0000 (16:12 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 21 Oct 2021 01:42:30 +0000 (10:42 +0900)
- Added `IsForcedEnabled` API internally.
- This is to check Accessibility could be enabled/disabled from the
outside.
 (e.g. by some applications)

Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
src/Tizen.NUI.Components/Controls/Button.Internal.cs
src/Tizen.NUI/src/public/Accessibility/AccessibilityManager.cs

index 9b679c2..e7aeb0e 100755 (executable)
@@ -468,6 +468,11 @@ namespace Tizen.NUI.Components
                 return false;
             }
 
+            if (!AccessibilityManager.Instance.IsForcedEnable())
+            {
+                return false;
+            }
+
             // Touch Down
             isPressed = true;
             UpdateState();
index 5e37283..d419132 100755 (executable)
@@ -32,6 +32,7 @@ namespace Tizen.NUI.Accessibility
     public partial class AccessibilityManager : BaseHandle
     {
         private static readonly AccessibilityManager instance = AccessibilityManager.Get();
+        private bool isForced = false;
 
         internal AccessibilityManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.AccessibilityManager.AccessibilityManager_SWIGUpcast(cPtr), cMemoryOwn)
         {
@@ -852,6 +853,7 @@ namespace Tizen.NUI.Accessibility
         [EditorBrowsable(EditorBrowsableState.Never)]
         public void EnableAccessibility(bool enabled)
         {
+            isForced = enabled;
             Interop.AccessibilityManager.EnableAccessibility(swigCPtr, enabled);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
@@ -870,6 +872,13 @@ namespace Tizen.NUI.Accessibility
             return ret;
         }
 
+        /// Queries whether EnableAccessibility() is called and Accessibility is enabled forcibly or not.
+        /// This API is only used for internal checks.
+        internal bool IsForcedEnable()
+        {
+            return isForced;
+        }
+
         internal static AccessibilityManager Get()
         {
             AccessibilityManager ret = new AccessibilityManager(Interop.AccessibilityManager.AccessibilityManager_Get(), true);