From 282adf733093b41a31514746825ea05fc90fb3ee Mon Sep 17 00:00:00 2001 From: alanv Date: Sat, 19 May 2012 00:05:13 -0700 Subject: [PATCH] Pass IME accessibility events directly to the AccessibilityManager. Bug: 6523554 Change-Id: I44bceb7b068ff1ac0c799f4a93d5dcd8026f1e4b --- .../accessibility/AccessibilityEntityProvider.java | 7 ++++++- .../accessibility/AccessibilityUtils.java | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java index 67e21b10c..3cfef972a 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java @@ -282,7 +282,12 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat return; } - parent.requestSendAccessibilityEvent(mKeyboardView, event); + if (!parent.requestSendAccessibilityEvent(mKeyboardView, event)) { + // TODO: Remove this line after the top-level view for the IME + // window is fixed to be non-null and requestSendAccessibilityEvent + // can return true. + mAccessibilityUtils.requestSendAccessibilityEvent(event); + } } /** diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java index 2ea7d83e4..616b1c6d7 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java @@ -174,4 +174,16 @@ public class AccessibilityUtils { speak(text); } } + + /** + * Sends the specified {@link AccessibilityEvent} if accessibility is + * enabled. No operation if accessibility is disabled. + * + * @param event The event to send. + */ + public void requestSendAccessibilityEvent(AccessibilityEvent event) { + if (mAccessibilityManager.isEnabled()) { + mAccessibilityManager.sendAccessibilityEvent(event); + } + } }