From 52e89069cb9d18ab03b4431301d3cb0d9adea278 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 21 May 2018 11:29:50 -0700 Subject: [PATCH] Re-add ACTION_LONG_CLICK for Android a11y (flutter/engine#5330) --- .../android/io/flutter/view/AccessibilityBridge.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java index f422a5f7a3..57b171994d 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -278,9 +278,19 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess } switch (action) { case AccessibilityNodeInfo.ACTION_CLICK: { + // Note: TalkBack prior to Oreo doesn't use this handler and instead simulates a + // click event at the center of the SemanticsNode. Other a11y services might go + // through this handler though. mOwner.dispatchSemanticsAction(virtualViewId, Action.TAP); return true; } + case AccessibilityNodeInfo.ACTION_LONG_CLICK: { + // Note: TalkBack doesn't use this handler and instead simulates a long click event + // at the center of the SemanticsNode. Other a11y services might go through this + // handler though. + mOwner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); + return true; + } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (object.hasAction(Action.SCROLL_UP)) { mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP);