From a6bcef301bb17eb46d60396f6bc67f6b9d6479bd Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 27 Mar 2020 14:57:32 -0700 Subject: [PATCH 1/7] Clear focus if a platform view goes away --- .../io/flutter/view/AccessibilityBridge.java | 15 +++++++++++++++ .../flutter/view/AccessibilityViewEmbedder.java | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index bd01f405ab213..b346d8f1035e6 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -1580,15 +1580,30 @@ private void willRemoveSemanticsNode(SemanticsNode semanticsNodeToBeRemoved) { // for null'ing accessibilityFocusedSemanticsNode, inputFocusedSemanticsNode, // and hoveredObject. Is this a hook method or a command? semanticsNodeToBeRemoved.parent = null; + + if (semanticsNodeToBeRemoved.platformViewId != -1 + && embeddedAccessibilityFocusedNodeId != null + && accessibilityViewEmbedder.platformViewOfNode(embeddedAccessibilityFocusedNodeId) + == platformViewsAccessibilityDelegate.getPlatformViewById(semanticsNodeToBeRemoved.platformViewId)) { + // If the currently focused a11y node is within a platform view that is + // getting removed: clear it's a11y focus. + sendAccessibilityEvent( + embeddedAccessibilityFocusedNodeId, + AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); + embeddedAccessibilityFocusedNodeId = null; + } + if (accessibilityFocusedSemanticsNode == semanticsNodeToBeRemoved) { sendAccessibilityEvent( accessibilityFocusedSemanticsNode.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); accessibilityFocusedSemanticsNode = null; } + if (inputFocusedSemanticsNode == semanticsNodeToBeRemoved) { inputFocusedSemanticsNode = null; } + if (hoveredObject == semanticsNodeToBeRemoved) { hoveredObject = null; } diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java index 0fb2957d92410..39ff9f63c8bd9 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java @@ -387,6 +387,18 @@ public boolean onAccessibilityHoverEvent(int rootFlutterId, @NonNull MotionEvent return origin.view.dispatchGenericMotionEvent(translatedEvent); } + /** + * Returns the View that contains the accessibility node identified by the + * provided flutterId or null if it doesn't belong to a view. + */ + public View platformViewOfNode(int flutterId) { + ViewAndId viewAndId = flutterIdToOrigin.get(flutterId); + if (viewAndId == null) { + return null; + } + return viewAndId.view; + } + private static class ViewAndId { final View view; final int id; From 71033229600878e54b8deffd6c4fd4cc1023aed7 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 30 Mar 2020 10:06:58 -0700 Subject: [PATCH 2/7] format --- .../platform/android/io/flutter/view/AccessibilityBridge.java | 3 ++- .../android/io/flutter/view/AccessibilityViewEmbedder.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index b346d8f1035e6..3f8a11f4851ce 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -1584,7 +1584,8 @@ private void willRemoveSemanticsNode(SemanticsNode semanticsNodeToBeRemoved) { if (semanticsNodeToBeRemoved.platformViewId != -1 && embeddedAccessibilityFocusedNodeId != null && accessibilityViewEmbedder.platformViewOfNode(embeddedAccessibilityFocusedNodeId) - == platformViewsAccessibilityDelegate.getPlatformViewById(semanticsNodeToBeRemoved.platformViewId)) { + == platformViewsAccessibilityDelegate.getPlatformViewById( + semanticsNodeToBeRemoved.platformViewId)) { // If the currently focused a11y node is within a platform view that is // getting removed: clear it's a11y focus. sendAccessibilityEvent( diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java index 39ff9f63c8bd9..8d285196c30e3 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java @@ -388,8 +388,8 @@ public boolean onAccessibilityHoverEvent(int rootFlutterId, @NonNull MotionEvent } /** - * Returns the View that contains the accessibility node identified by the - * provided flutterId or null if it doesn't belong to a view. + * Returns the View that contains the accessibility node identified by the provided flutterId or + * null if it doesn't belong to a view. */ public View platformViewOfNode(int flutterId) { ViewAndId viewAndId = flutterIdToOrigin.get(flutterId); From ea229161e30d9760a4e86ad2c4b67332b61c324d Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 15 Apr 2020 21:15:13 -0700 Subject: [PATCH 3/7] tests --- .../io/flutter/view/AccessibilityBridge.java | 19 ++- .../view/AccessibilityViewEmbedder.java | 2 +- .../flutter/view/AccessibilityBridgeTest.java | 128 +++++++++++++++--- testing/run_tests.py | 2 +- 4 files changed, 130 insertions(+), 21 deletions(-) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 3f8a11f4851ce..e7f9e43379e4d 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -26,6 +26,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; +import androidx.annotation.VisibleForTesting; import io.flutter.BuildConfig; import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate; @@ -333,10 +334,26 @@ public AccessibilityBridge( // TODO(mattcarrol): Add the annotation once the plumbing is done. // https://github.com/flutter/flutter/issues/29618 PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate) { + this(rootAccessibilityView, accessibilityChannel, accessibilityManager, contentResolver, new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID), platformViewsAccessibilityDelegate); + } + + @VisibleForTesting + public AccessibilityBridge( + @NonNull View rootAccessibilityView, + @NonNull AccessibilityChannel accessibilityChannel, + @NonNull AccessibilityManager accessibilityManager, + @NonNull ContentResolver contentResolver, + @NonNull AccessibilityViewEmbedder accessibilityViewEmbedder, + // This should be @NonNull once the plumbing for + // io.flutter.embedding.engine.android.FlutterView is done. + // TODO(mattcarrol): Add the annotation once the plumbing is done. + // https://github.com/flutter/flutter/issues/29618 + PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate) { this.rootAccessibilityView = rootAccessibilityView; this.accessibilityChannel = accessibilityChannel; this.accessibilityManager = accessibilityManager; this.contentResolver = contentResolver; + this.accessibilityViewEmbedder = accessibilityViewEmbedder; this.platformViewsAccessibilityDelegate = platformViewsAccessibilityDelegate; // Tell Flutter whether accessibility is initially active or not. Then register a listener @@ -388,8 +405,6 @@ public void onTouchExplorationStateChanged(boolean isTouchExplorationEnabled) { if (platformViewsAccessibilityDelegate != null) { platformViewsAccessibilityDelegate.attachAccessibilityBridge(this); } - accessibilityViewEmbedder = - new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID); } /** diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java index 8d285196c30e3..2823eb795d17b 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java @@ -44,7 +44,7 @@ * corresponding platform view and `originId`. */ @Keep -final class AccessibilityViewEmbedder { +class AccessibilityViewEmbedder { private static final String TAG = "AccessibilityBridge"; private final ReflectionAccessors reflectionAccessors; diff --git a/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java b/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java index aef458733d7b7..0ddbd2f5bc802 100644 --- a/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java +++ b/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java @@ -5,20 +5,27 @@ package io.flutter.view; import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.ContentResolver; import android.content.Context; import android.view.View; +import android.view.ViewParent; +import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; @@ -73,24 +80,95 @@ public void itDoesNotContainADescriptionIfScopesRoute() { assertEquals(nodeInfo.getText(), null); } - AccessibilityBridge setUpBridge() { - View view = mock(View.class); + @Test + public void itUnfocusesPlatformViewWhenPlatformViewGoesAway() { + AccessibilityViewEmbedder mockViewEmbedder = mock(AccessibilityViewEmbedder.class); + AccessibilityManager mockManager = mock(AccessibilityManager.class); + View mockRootView = mock(View.class); Context context = mock(Context.class); - when(view.getContext()).thenReturn(context); + when(mockRootView.getContext()).thenReturn(context); when(context.getPackageName()).thenReturn("test"); - AccessibilityChannel accessibilityChannel = mock(AccessibilityChannel.class); - AccessibilityManager accessibilityManager = mock(AccessibilityManager.class); - ContentResolver contentResolver = mock(ContentResolver.class); - PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate = - mock(PlatformViewsAccessibilityDelegate.class); - AccessibilityBridge accessibilityBridge = - new AccessibilityBridge( - view, + AccessibilityBridge accessibilityBridge = setUpBridge(mockRootView, mockManager, mockViewEmbedder); + + // Sent a11y tree with platform view. + TestSemanticsNode root = new TestSemanticsNode(); + root.id = 0; + TestSemanticsNode platformView = new TestSemanticsNode(); + platformView.id = 1; + platformView.platformViewId = 42; + root.children.add(platformView); + TestSemanticsUpdate testSemanticsUpdate = root.toUpdate(); + accessibilityBridge.updateSemantics(testSemanticsUpdate.buffer, testSemanticsUpdate.strings); + + // Set a11y focus to platform view. + View mockView = mock(View.class); + AccessibilityEvent focusEvent = mock(AccessibilityEvent.class); + when(mockViewEmbedder.requestSendAccessibilityEvent(mockView, mockView, focusEvent)).thenReturn(true); + when(mockViewEmbedder.getRecordFlutterId(mockView, focusEvent)).thenReturn(42); + when(focusEvent.getEventType()).thenReturn(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); + accessibilityBridge.externalViewRequestSendAccessibilityEvent(mockView, mockView, focusEvent); + + // Replace the platform view. + TestSemanticsNode node = new TestSemanticsNode(); + node.id = 2; + root.children.clear(); + root.children.add(node); + testSemanticsUpdate = root.toUpdate(); + when(mockManager.isEnabled()).thenReturn(true); + ViewParent mockParent = mock(ViewParent.class); + when(mockRootView.getParent()).thenReturn(mockParent); + accessibilityBridge.updateSemantics(testSemanticsUpdate.buffer, testSemanticsUpdate.strings); + + // Check that unfocus event was sent. + ArgumentCaptor eventCaptor = ArgumentCaptor.forClass(AccessibilityEvent.class); + verify(mockParent, times(2)).requestSendAccessibilityEvent(eq(mockRootView), eventCaptor.capture()); + AccessibilityEvent event = eventCaptor.getAllValues().get(0); + assertEquals(event.getEventType(), AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); + } + + AccessibilityBridge setUpBridge() { + return setUpBridge(null, null, null, null, null, null); + } + + AccessibilityBridge setUpBridge(View rootAccessibilityView, AccessibilityManager accessibilityManager, AccessibilityViewEmbedder accessibilityViewEmbedder) { + return setUpBridge(rootAccessibilityView, null, accessibilityManager, null, accessibilityViewEmbedder, null); + } + + AccessibilityBridge setUpBridge( + View rootAccessibilityView, + AccessibilityChannel accessibilityChannel, + AccessibilityManager accessibilityManager, + ContentResolver contentResolver, + AccessibilityViewEmbedder accessibilityViewEmbedder, + PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate + ) { + if (rootAccessibilityView == null) { + rootAccessibilityView = mock(View.class); + Context context = mock(Context.class); + when(rootAccessibilityView.getContext()).thenReturn(context); + when(context.getPackageName()).thenReturn("test"); + } + if (accessibilityChannel == null) { + accessibilityChannel = mock(AccessibilityChannel.class); + } + if (accessibilityManager == null) { + accessibilityManager = mock(AccessibilityManager.class); + } + if (contentResolver == null) { + contentResolver = mock(ContentResolver.class); + } + if (accessibilityViewEmbedder == null) { + accessibilityViewEmbedder = mock(AccessibilityViewEmbedder.class); + } + if (platformViewsAccessibilityDelegate == null) { + platformViewsAccessibilityDelegate = mock(PlatformViewsAccessibilityDelegate.class); + } + return new AccessibilityBridge( + rootAccessibilityView, accessibilityChannel, accessibilityManager, contentResolver, - platformViewsAccessibilityDelegate); - return accessibilityBridge; + accessibilityViewEmbedder, platformViewsAccessibilityDelegate); } /// The encoding for semantics is described in platform_view_android.cc @@ -136,11 +214,18 @@ void addFlag(AccessibilityBridge.Flag flag) { float top = 0.0f; float right = 0.0f; float bottom = 0.0f; - // children and custom actions not supported. + final List children = new ArrayList(); + //custom actions not supported. TestSemanticsUpdate toUpdate() { ArrayList strings = new ArrayList(); ByteBuffer bytes = ByteBuffer.allocate(1000); + addToBuffer(bytes, strings); + bytes.flip(); + return new TestSemanticsUpdate(bytes, strings.toArray(new String[strings.size()])); + } + + protected void addToBuffer(ByteBuffer bytes, ArrayList strings) { bytes.putInt(id); bytes.putInt(flags); bytes.putInt(actions); @@ -169,11 +254,20 @@ TestSemanticsUpdate toUpdate() { bytes.putFloat(0); } // children in traversal order. - bytes.putInt(0); + bytes.putInt(children.size()); + for (TestSemanticsNode node : children) { + bytes.putInt(node.id); + } + // children in hit test order. + for (TestSemanticsNode node : children) { + bytes.putInt(node.id); + } // custom actions bytes.putInt(0); - bytes.flip(); - return new TestSemanticsUpdate(bytes, strings.toArray(new String[strings.size()])); + // child nodes + for (TestSemanticsNode node : children) { + node.addToBuffer(bytes, strings); + } } } diff --git a/testing/run_tests.py b/testing/run_tests.py index 3fe88f065f4ce..03a31b8768a1f 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -282,7 +282,7 @@ def EnsureJavaTestsAreBuilt(android_out_dir): RunCmd(ninja_command, cwd=buildroot_dir) def AssertExpectedJavaVersion(): - EXPECTED_VERSION = '1.8' + EXPECTED_VERSION = '11.0' # `java -version` is output to stderr. https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4380614 version_output = subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT) match = bool(re.compile('version "%s' % EXPECTED_VERSION).search(version_output)) From 2e9408552396e7b1d9ebf16260e8c2a569ca9f8b Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 15 Apr 2020 21:24:42 -0700 Subject: [PATCH 4/7] ++ --- testing/run_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/run_tests.py b/testing/run_tests.py index 03a31b8768a1f..3fe88f065f4ce 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -282,7 +282,7 @@ def EnsureJavaTestsAreBuilt(android_out_dir): RunCmd(ninja_command, cwd=buildroot_dir) def AssertExpectedJavaVersion(): - EXPECTED_VERSION = '11.0' + EXPECTED_VERSION = '1.8' # `java -version` is output to stderr. https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4380614 version_output = subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT) match = bool(re.compile('version "%s' % EXPECTED_VERSION).search(version_output)) From 490db0717c5cade2b16cbc30e84f39e26aedffd5 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 16 Apr 2020 09:53:26 -0700 Subject: [PATCH 5/7] format --- .../io/flutter/view/AccessibilityBridge.java | 9 +++- .../flutter/view/AccessibilityBridgeTest.java | 46 +++++++++++-------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index e7f9e43379e4d..1e3fe6066ac81 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -334,7 +334,14 @@ public AccessibilityBridge( // TODO(mattcarrol): Add the annotation once the plumbing is done. // https://github.com/flutter/flutter/issues/29618 PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate) { - this(rootAccessibilityView, accessibilityChannel, accessibilityManager, contentResolver, new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID), platformViewsAccessibilityDelegate); + this( + rootAccessibilityView, + accessibilityChannel, + accessibilityManager, + contentResolver, + new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID), + platformViewsAccessibilityDelegate); + } } @VisibleForTesting diff --git a/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java b/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java index 0ddbd2f5bc802..5bbc7b999a7dd 100644 --- a/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java +++ b/shell/platform/android/test/io/flutter/view/AccessibilityBridgeTest.java @@ -88,7 +88,8 @@ public void itUnfocusesPlatformViewWhenPlatformViewGoesAway() { Context context = mock(Context.class); when(mockRootView.getContext()).thenReturn(context); when(context.getPackageName()).thenReturn("test"); - AccessibilityBridge accessibilityBridge = setUpBridge(mockRootView, mockManager, mockViewEmbedder); + AccessibilityBridge accessibilityBridge = + setUpBridge(mockRootView, mockManager, mockViewEmbedder); // Sent a11y tree with platform view. TestSemanticsNode root = new TestSemanticsNode(); @@ -103,7 +104,8 @@ public void itUnfocusesPlatformViewWhenPlatformViewGoesAway() { // Set a11y focus to platform view. View mockView = mock(View.class); AccessibilityEvent focusEvent = mock(AccessibilityEvent.class); - when(mockViewEmbedder.requestSendAccessibilityEvent(mockView, mockView, focusEvent)).thenReturn(true); + when(mockViewEmbedder.requestSendAccessibilityEvent(mockView, mockView, focusEvent)) + .thenReturn(true); when(mockViewEmbedder.getRecordFlutterId(mockView, focusEvent)).thenReturn(42); when(focusEvent.getEventType()).thenReturn(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); accessibilityBridge.externalViewRequestSendAccessibilityEvent(mockView, mockView, focusEvent); @@ -120,8 +122,10 @@ public void itUnfocusesPlatformViewWhenPlatformViewGoesAway() { accessibilityBridge.updateSemantics(testSemanticsUpdate.buffer, testSemanticsUpdate.strings); // Check that unfocus event was sent. - ArgumentCaptor eventCaptor = ArgumentCaptor.forClass(AccessibilityEvent.class); - verify(mockParent, times(2)).requestSendAccessibilityEvent(eq(mockRootView), eventCaptor.capture()); + ArgumentCaptor eventCaptor = + ArgumentCaptor.forClass(AccessibilityEvent.class); + verify(mockParent, times(2)) + .requestSendAccessibilityEvent(eq(mockRootView), eventCaptor.capture()); AccessibilityEvent event = eventCaptor.getAllValues().get(0); assertEquals(event.getEventType(), AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); } @@ -130,18 +134,21 @@ AccessibilityBridge setUpBridge() { return setUpBridge(null, null, null, null, null, null); } - AccessibilityBridge setUpBridge(View rootAccessibilityView, AccessibilityManager accessibilityManager, AccessibilityViewEmbedder accessibilityViewEmbedder) { - return setUpBridge(rootAccessibilityView, null, accessibilityManager, null, accessibilityViewEmbedder, null); + AccessibilityBridge setUpBridge( + View rootAccessibilityView, + AccessibilityManager accessibilityManager, + AccessibilityViewEmbedder accessibilityViewEmbedder) { + return setUpBridge( + rootAccessibilityView, null, accessibilityManager, null, accessibilityViewEmbedder, null); } AccessibilityBridge setUpBridge( - View rootAccessibilityView, - AccessibilityChannel accessibilityChannel, - AccessibilityManager accessibilityManager, - ContentResolver contentResolver, - AccessibilityViewEmbedder accessibilityViewEmbedder, - PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate - ) { + View rootAccessibilityView, + AccessibilityChannel accessibilityChannel, + AccessibilityManager accessibilityManager, + ContentResolver contentResolver, + AccessibilityViewEmbedder accessibilityViewEmbedder, + PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate) { if (rootAccessibilityView == null) { rootAccessibilityView = mock(View.class); Context context = mock(Context.class); @@ -164,11 +171,12 @@ AccessibilityBridge setUpBridge( platformViewsAccessibilityDelegate = mock(PlatformViewsAccessibilityDelegate.class); } return new AccessibilityBridge( - rootAccessibilityView, - accessibilityChannel, - accessibilityManager, - contentResolver, - accessibilityViewEmbedder, platformViewsAccessibilityDelegate); + rootAccessibilityView, + accessibilityChannel, + accessibilityManager, + contentResolver, + accessibilityViewEmbedder, + platformViewsAccessibilityDelegate); } /// The encoding for semantics is described in platform_view_android.cc @@ -215,7 +223,7 @@ void addFlag(AccessibilityBridge.Flag flag) { float right = 0.0f; float bottom = 0.0f; final List children = new ArrayList(); - //custom actions not supported. + // custom actions not supported. TestSemanticsUpdate toUpdate() { ArrayList strings = new ArrayList(); From 4ffc35dec97885b6013d0b5a771cbd21093ebc7c Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 16 Apr 2020 10:04:51 -0700 Subject: [PATCH 6/7] typo --- shell/platform/android/io/flutter/view/AccessibilityBridge.java | 1 - 1 file changed, 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 1e3fe6066ac81..c0852b629225a 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -341,7 +341,6 @@ public AccessibilityBridge( contentResolver, new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID), platformViewsAccessibilityDelegate); - } } @VisibleForTesting From 09d15487876f14593a5d6c865e567c40b1f8e631 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 16 Apr 2020 10:14:32 -0700 Subject: [PATCH 7/7] more format --- .../io/flutter/view/AccessibilityBridge.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index c0852b629225a..fa1050e0c7f96 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -334,13 +334,13 @@ public AccessibilityBridge( // TODO(mattcarrol): Add the annotation once the plumbing is done. // https://github.com/flutter/flutter/issues/29618 PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate) { - this( - rootAccessibilityView, - accessibilityChannel, - accessibilityManager, - contentResolver, - new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID), - platformViewsAccessibilityDelegate); + this( + rootAccessibilityView, + accessibilityChannel, + accessibilityManager, + contentResolver, + new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID), + platformViewsAccessibilityDelegate); } @VisibleForTesting