Class AccessibilityChannel
See AccessibilityChannel.AccessibilityMessageHandler
, which lists all accessibility requests and events
that might be sent from Flutter to the Android platform.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Handler that receives accessibility messages sent from Flutter to Android through a givenAccessibilityChannel
. -
Field Summary
-
Constructor Summary
ConstructorDescriptionAccessibilityChannel
(DartExecutor dartExecutor, FlutterJNI flutterJNI) Constructs anAccessibilityChannel
that connects Android to the Dart code running indartExecutor
.AccessibilityChannel
(BasicMessageChannel<Object> channel, FlutterJNI flutterJNI) -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispatchSemanticsAction
(int virtualViewId, AccessibilityBridge.Action action) Instructs Flutter to perform the givenaction
on theSemanticsNode
referenced by the givenvirtualViewId
.void
dispatchSemanticsAction
(int virtualViewId, AccessibilityBridge.Action action, Object args) Instructs Flutter to perform the givenaction
on theSemanticsNode
referenced by the givenvirtualViewId
, passing the givenargs
.void
Informs Flutter that the Android OS currently has accessibility disabled.void
Informs Flutter that the Android OS currently has accessibility enabled.void
setAccessibilityFeatures
(int accessibilityFeatureFlags) Instructs Flutter to activate/deactivate accessibility features corresponding to the flags provided byaccessibilityFeatureFlags
.void
Sets theAccessibilityChannel.AccessibilityMessageHandler
which receives all events and requests that are parsed from the underlying accessibility channel.
-
Field Details
-
channel
-
flutterJNI
-
parsingMessageHandler
-
-
Constructor Details
-
AccessibilityChannel
Constructs anAccessibilityChannel
that connects Android to the Dart code running indartExecutor
.The given
dartExecutor
is permitted to be idle or executing code.See
DartExecutor
. -
AccessibilityChannel
@VisibleForTesting public AccessibilityChannel(@NonNull BasicMessageChannel<Object> channel, @NonNull FlutterJNI flutterJNI)
-
-
Method Details
-
onAndroidAccessibilityEnabled
public void onAndroidAccessibilityEnabled()Informs Flutter that the Android OS currently has accessibility enabled.To accommodate enabled accessibility, this method instructs Flutter to activate its semantics tree, which forms the basis of Flutter's accessibility support.
-
onAndroidAccessibilityDisabled
public void onAndroidAccessibilityDisabled()Informs Flutter that the Android OS currently has accessibility disabled.Given that accessibility is not required at this time, this method instructs Flutter to deactivate its semantics tree.
-
setAccessibilityFeatures
public void setAccessibilityFeatures(int accessibilityFeatureFlags) Instructs Flutter to activate/deactivate accessibility features corresponding to the flags provided byaccessibilityFeatureFlags
. -
dispatchSemanticsAction
Instructs Flutter to perform the givenaction
on theSemanticsNode
referenced by the givenvirtualViewId
.One might wonder why Flutter would need to be instructed that the user wants to perform an action. When the user is touching the screen in accessibility mode, Android takes over the touch input, categorizing input as one of a many accessibility gestures. Therefore, Flutter does not have an opportunity to react to said touch input. Instead, Flutter must be notified by Android of the desired action. Additionally, some accessibility systems use other input methods, such as speech, to take virtual actions. Android interprets those requests and then instructs the app to take the appropriate action.
-
dispatchSemanticsAction
public void dispatchSemanticsAction(int virtualViewId, @NonNull AccessibilityBridge.Action action, @Nullable Object args) Instructs Flutter to perform the givenaction
on theSemanticsNode
referenced by the givenvirtualViewId
, passing the givenargs
. -
setAccessibilityMessageHandler
public void setAccessibilityMessageHandler(@Nullable AccessibilityChannel.AccessibilityMessageHandler handler) Sets theAccessibilityChannel.AccessibilityMessageHandler
which receives all events and requests that are parsed from the underlying accessibility channel.
-