io.flutter.embedding.engine.systemchannels

## Class AccessibilityChannel

- java.lang.Object
- - io.flutter.embedding.engine.systemchannels.AccessibilityChannel

-     public class AccessibilityChannel
      extends Object

  System channel that sends accessibility requests and events from Flutter to Android.

  See `AccessibilityChannel.AccessibilityMessageHandler`, which lists all accessibility requests and events that might be sent from Flutter to the Android platform.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `AccessibilityChannel.AccessibilityMessageHandler` Handler that receives accessibility messages sent from Flutter to Android through a given `AccessibilityChannel`.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `BasicMessageChannel<Object>` | `channel`
    `FlutterJNI` | `flutterJNI`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AccessibilityChannel(DartExecutor dartExecutor, FlutterJNI flutterJNI)` Constructs an `AccessibilityChannel` that connects Android to the Dart code running in `dartExecutor`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `dispatchSemanticsAction(int virtualViewId, AccessibilityBridge.Action action)` Instructs Flutter to perform the given `action` on the `SemanticsNode` referenced by the given `virtualViewId`.
    `void` | `dispatchSemanticsAction(int virtualViewId, AccessibilityBridge.Action action, Object args)` Instructs Flutter to perform the given `action` on the `SemanticsNode` referenced by the given `virtualViewId`, passing the given `args`.
    `void` | `onAndroidAccessibilityDisabled()` Informs Flutter that the Android OS currently has accessibility disabled.
    `void` | `onAndroidAccessibilityEnabled()` 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 by `accessibilityFeatureFlags`.
    `void` | `setAccessibilityMessageHandler(AccessibilityChannel.AccessibilityMessageHandler handler)` Sets the `AccessibilityChannel.AccessibilityMessageHandler` which receives all events and requests that are parsed from the underlying accessibility channel.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### channel

          @NonNull
          public final BasicMessageChannel<Object> channel

    - #### flutterJNI

          @NonNull
          public final FlutterJNI flutterJNI

  - ### Constructor Detail

    - #### AccessibilityChannel

          public AccessibilityChannel(@NonNull
                                      DartExecutor dartExecutor,
                                      @NonNull
                                      FlutterJNI flutterJNI)

      Constructs an `AccessibilityChannel` that connects Android to the Dart code running in `dartExecutor`.

      The given `dartExecutor` is permitted to be idle or executing code.

      See `DartExecutor`.

  - ### Method Detail

    - #### 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 by `accessibilityFeatureFlags`.

    - #### dispatchSemanticsAction

          public void dispatchSemanticsAction(int virtualViewId,
                                              @NonNull
                                              AccessibilityBridge.Action action)

      Instructs Flutter to perform the given `action` on the `SemanticsNode` referenced by the given `virtualViewId`.

      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 given `action` on the `SemanticsNode` referenced by the given `virtualViewId`, passing the given `args`.

    - #### setAccessibilityMessageHandler

          public void setAccessibilityMessageHandler(@Nullable
                                                     AccessibilityChannel.AccessibilityMessageHandler handler)

      Sets the `AccessibilityChannel.AccessibilityMessageHandler` which receives all events and requests that are parsed from the underlying accessibility channel.