Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | List of all members
io.flutter.embedding.engine.systemchannels.AccessibilityChannel Class Reference

Classes

interface  AccessibilityMessageHandler
 

Public Member Functions

 AccessibilityChannel (@NonNull DartExecutor dartExecutor, @NonNull FlutterJNI flutterJNI)
 
 AccessibilityChannel ( @NonNull BasicMessageChannel< Object > channel, @NonNull FlutterJNI flutterJNI)
 
void onAndroidAccessibilityEnabled ()
 
void onAndroidAccessibilityDisabled ()
 
void setAccessibilityFeatures (int accessibilityFeatureFlags)
 
void dispatchSemanticsAction (int virtualViewId, @NonNull AccessibilityBridge.Action action)
 
void dispatchSemanticsAction (int virtualViewId, @NonNull AccessibilityBridge.Action action, @Nullable Object args)
 
void setAccessibilityMessageHandler (@Nullable AccessibilityMessageHandler handler)
 

Public Attributes

final BasicMessageChannel< Object > channel
 
final FlutterJNI flutterJNI
 
final BasicMessageChannel.MessageHandler< Object > parsingMessageHandler
 

Detailed Description

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

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

Definition at line 20 of file AccessibilityChannel.java.

Constructor & Destructor Documentation

◆ AccessibilityChannel() [1/2]

io.flutter.embedding.engine.systemchannels.AccessibilityChannel.AccessibilityChannel ( @NonNull DartExecutor  dartExecutor,
@NonNull FlutterJNI  flutterJNI 
)
inline

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.

Definition at line 98 of file AccessibilityChannel.java.

98 {
99 channel =
100 new BasicMessageChannel<>(
101 dartExecutor, "flutter/accessibility", StandardMessageCodec.INSTANCE);
102 channel.setMessageHandler(parsingMessageHandler);
103 this.flutterJNI = flutterJNI;
104 }
final BasicMessageChannel.MessageHandler< Object > parsingMessageHandler

◆ AccessibilityChannel() [2/2]

io.flutter.embedding.engine.systemchannels.AccessibilityChannel.AccessibilityChannel ( @NonNull BasicMessageChannel< Object >  channel,
@NonNull FlutterJNI  flutterJNI 
)
inline

Definition at line 107 of file AccessibilityChannel.java.

108 {
109 this.channel = channel;
110 this.flutterJNI = flutterJNI;
111 }

Member Function Documentation

◆ dispatchSemanticsAction() [1/2]

void io.flutter.embedding.engine.systemchannels.AccessibilityChannel.dispatchSemanticsAction ( int  virtualViewId,
@NonNull AccessibilityBridge.Action  action 
)
inline

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.

Definition at line 153 of file AccessibilityChannel.java.

154 {
156 }
void dispatchSemanticsAction(int nodeId, @NonNull AccessibilityBridge.Action action)

◆ dispatchSemanticsAction() [2/2]

void io.flutter.embedding.engine.systemchannels.AccessibilityChannel.dispatchSemanticsAction ( int  virtualViewId,
@NonNull AccessibilityBridge.Action  action,
@Nullable Object  args 
)
inline

Instructs Flutter to perform the given action on the SemanticsNode referenced by the given virtualViewId, passing the given args.

Definition at line 162 of file AccessibilityChannel.java.

163 {
165 }
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ onAndroidAccessibilityDisabled()

void io.flutter.embedding.engine.systemchannels.AccessibilityChannel.onAndroidAccessibilityDisabled ( )
inline

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.

Definition at line 129 of file AccessibilityChannel.java.

129 {
131 }
void setSemanticsEnabled(boolean enabled)

◆ onAndroidAccessibilityEnabled()

void io.flutter.embedding.engine.systemchannels.AccessibilityChannel.onAndroidAccessibilityEnabled ( )
inline

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.

Definition at line 119 of file AccessibilityChannel.java.

119 {
121 }

◆ setAccessibilityFeatures()

void io.flutter.embedding.engine.systemchannels.AccessibilityChannel.setAccessibilityFeatures ( int  accessibilityFeatureFlags)
inline

Instructs Flutter to activate/deactivate accessibility features corresponding to the flags provided by accessibilityFeatureFlags.

Definition at line 137 of file AccessibilityChannel.java.

137 {
138 flutterJNI.setAccessibilityFeatures(accessibilityFeatureFlags);
139 }

◆ setAccessibilityMessageHandler()

void io.flutter.embedding.engine.systemchannels.AccessibilityChannel.setAccessibilityMessageHandler ( @Nullable AccessibilityMessageHandler  handler)
inline

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

Definition at line 171 of file AccessibilityChannel.java.

171 {
172 this.handler = handler;
174 }
void setAccessibilityDelegate(@Nullable AccessibilityDelegate accessibilityDelegate)

Member Data Documentation

◆ channel

final BasicMessageChannel<Object> io.flutter.embedding.engine.systemchannels.AccessibilityChannel.channel

Definition at line 23 of file AccessibilityChannel.java.

◆ flutterJNI

final FlutterJNI io.flutter.embedding.engine.systemchannels.AccessibilityChannel.flutterJNI

Definition at line 24 of file AccessibilityChannel.java.

◆ parsingMessageHandler

final BasicMessageChannel.MessageHandler<Object> io.flutter.embedding.engine.systemchannels.AccessibilityChannel.parsingMessageHandler

Definition at line 27 of file AccessibilityChannel.java.

28 {
29 @Override
30 public void onMessage(
31 @Nullable Object message, @NonNull BasicMessageChannel.Reply<Object> reply) {
32 // If there is no handler to respond to this message then we don't need to
33 // parse it. Return.
34 if (handler == null) {
35 reply.reply(null);
36 return;
37 }
38
39 @SuppressWarnings("unchecked")
40 final HashMap<String, Object> annotatedEvent = (HashMap<String, Object>) message;
41 final String type = (String) annotatedEvent.get("type");
42 @SuppressWarnings("unchecked")
43 final HashMap<String, Object> data = (HashMap<String, Object>) annotatedEvent.get("data");
44
45 Log.v(TAG, "Received " + type + " message.");
46 switch (type) {
47 case "announce":
48 String announceMessage = (String) data.get("message");
49 if (announceMessage != null) {
50 handler.announce(announceMessage);
51 }
52 break;
53 case "tap":
54 {
55 Integer nodeId = (Integer) annotatedEvent.get("nodeId");
56 if (nodeId != null) {
57 handler.onTap(nodeId);
58 }
59 break;
60 }
61 case "longPress":
62 {
63 Integer nodeId = (Integer) annotatedEvent.get("nodeId");
64 if (nodeId != null) {
65 handler.onLongPress(nodeId);
66 }
67 break;
68 }
69 case "focus":
70 {
71 Integer nodeId = (Integer) annotatedEvent.get("nodeId");
72 if (nodeId != null) {
73 handler.onFocus(nodeId);
74 }
75 break;
76 }
77 case "tooltip":
78 {
79 String tooltipMessage = (String) data.get("message");
80 if (tooltipMessage != null) {
81 handler.onTooltip(tooltipMessage);
82 }
83 break;
84 }
85 }
86 reply.reply(null);
87 }
88 };
switch(prop_id)
Win32Message message
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41

The documentation for this class was generated from the following file: