Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.view.AccessibilityBridge Class Reference
Inheritance diagram for io.flutter.view.AccessibilityBridge:

Public Member Functions

int getHoveredObjectId ()
 
boolean getAccessibleNavigation ()
 
 AccessibilityBridge ( @NonNull View rootAccessibilityView, @NonNull AccessibilityChannel accessibilityChannel, @NonNull AccessibilityManager accessibilityManager, @NonNull ContentResolver contentResolver, @NonNull PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate)
 
 AccessibilityBridge ( @NonNull View rootAccessibilityView, @NonNull AccessibilityChannel accessibilityChannel, @NonNull AccessibilityManager accessibilityManager, @NonNull ContentResolver contentResolver, @NonNull AccessibilityViewEmbedder accessibilityViewEmbedder, @NonNull PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate)
 

Detailed Description

Bridge between Android's OS accessibility system and Flutter's accessibility system.

An AccessibilityBridge requires:

The AccessibilityBridge causes Android to treat Flutter SemanticsNodes as if they were accessible Android Views. Accessibility requests may be sent from a Flutter widget to the Android OS, as if it were an Android View, and accessibility events may be consumed by a Flutter widget, as if it were an Android View. AccessibilityBridge refers to Flutter's accessible widgets as "virtual views" and identifies them with "virtual view IDs".

Definition at line 80 of file AccessibilityBridge.java.

Constructor & Destructor Documentation

◆ AccessibilityBridge() [1/2]

io.flutter.view.AccessibilityBridge.AccessibilityBridge ( @NonNull View  rootAccessibilityView,
@NonNull AccessibilityChannel  accessibilityChannel,
@NonNull AccessibilityManager  accessibilityManager,
@NonNull ContentResolver  contentResolver,
@NonNull PlatformViewsAccessibilityDelegate  platformViewsAccessibilityDelegate 
)
inline

Definition at line 416 of file AccessibilityBridge.java.

421 {
422 this(
423 rootAccessibilityView,
424 accessibilityChannel,
425 accessibilityManager,
426 contentResolver,
427 new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID),
428 platformViewsAccessibilityDelegate);
429 }

◆ AccessibilityBridge() [2/2]

io.flutter.view.AccessibilityBridge.AccessibilityBridge ( @NonNull View  rootAccessibilityView,
@NonNull AccessibilityChannel  accessibilityChannel,
@NonNull AccessibilityManager  accessibilityManager,
@NonNull ContentResolver  contentResolver,
@NonNull AccessibilityViewEmbedder  accessibilityViewEmbedder,
@NonNull PlatformViewsAccessibilityDelegate  platformViewsAccessibilityDelegate 
)
inline

Definition at line 432 of file AccessibilityBridge.java.

438 {
439 this.rootAccessibilityView = rootAccessibilityView;
440 this.accessibilityChannel = accessibilityChannel;
441 this.accessibilityManager = accessibilityManager;
442 this.contentResolver = contentResolver;
443 this.accessibilityViewEmbedder = accessibilityViewEmbedder;
444 this.platformViewsAccessibilityDelegate = platformViewsAccessibilityDelegate;
445 // Tell Flutter whether accessibility is initially active or not. Then register a listener
446 // to be notified of changes in the future.
447 accessibilityStateChangeListener.onAccessibilityStateChanged(accessibilityManager.isEnabled());
448 this.accessibilityManager.addAccessibilityStateChangeListener(accessibilityStateChangeListener);
449
450 // Tell Flutter whether touch exploration is initially active or not. Then register a listener
451 // to be notified of changes in the future.
452 touchExplorationStateChangeListener =
453 new AccessibilityManager.TouchExplorationStateChangeListener() {
454 @Override
455 public void onTouchExplorationStateChanged(boolean isTouchExplorationEnabled) {
456 if (isReleased) {
457 return;
458 }
459 if (!isTouchExplorationEnabled) {
460 setAccessibleNavigation(false);
461 onTouchExplorationExit();
462 }
463
464 if (onAccessibilityChangeListener != null) {
465 onAccessibilityChangeListener.onAccessibilityChanged(
466 accessibilityManager.isEnabled(), isTouchExplorationEnabled);
467 }
468 }
469 };
470 touchExplorationStateChangeListener.onTouchExplorationStateChanged(
471 accessibilityManager.isTouchExplorationEnabled());
472 this.accessibilityManager.addTouchExplorationStateChangeListener(
473 touchExplorationStateChangeListener);
474
475 // Tell Flutter whether animations should initially be enabled or disabled. Then register a
476 // listener to be notified of changes in the future.
477 animationScaleObserver.onChange(false);
478 Uri transitionUri = Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE);
479 this.contentResolver.registerContentObserver(transitionUri, false, animationScaleObserver);
480
481 // Tells Flutter whether the text should be bolded or not. If the user changes bold text
482 // setting, the configuration will change and trigger a re-build of the accesibiltyBridge.
483 if (Build.VERSION.SDK_INT >= API_LEVELS.API_31) {
484 setBoldTextFlag();
485 }
486
487 platformViewsAccessibilityDelegate.attachAccessibilityBridge(this);
488 }
void attachAccessibilityBridge(@NonNull AccessibilityBridge accessibilityBridge)
def Build(configs, env, options)
Definition: build.py:232

Member Function Documentation

◆ getAccessibleNavigation()

boolean io.flutter.view.AccessibilityBridge.getAccessibleNavigation ( )
inline

Definition at line 271 of file AccessibilityBridge.java.

271 {
272 return accessibleNavigation;
273 }

◆ getHoveredObjectId()

int io.flutter.view.AccessibilityBridge.getHoveredObjectId ( )
inline

Definition at line 245 of file AccessibilityBridge.java.

245 {
246 return hoveredObject.id;
247 }

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