Small cleanup in ‎AccessibilityBridge.java‎ (#179226)

This change removes unused `imports` and fixes typos in
`engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java`
## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit is contained in:
Mohellebi abdessalem 2025-12-01 22:33:56 +01:00 committed by GitHub
parent fede7e6a03
commit eee78231bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,8 +4,6 @@
package io.flutter.view;
import static io.flutter.Build.API_LEVELS;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
@ -38,7 +36,6 @@ import io.flutter.embedding.engine.systemchannels.AccessibilityChannel;
import io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate;
import io.flutter.util.Predicate;
import io.flutter.util.ViewUtils;
import io.flutter.view.AccessibilityBridge.Flag;
import io.flutter.view.AccessibilityStringBuilder.LocaleStringAttribute;
import io.flutter.view.AccessibilityStringBuilder.SpellOutStringAttribute;
import io.flutter.view.AccessibilityStringBuilder.StringAttribute;
@ -95,7 +92,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
| Action.SCROLL_LEFT.value
| Action.SCROLL_UP.value
| Action.SCROLL_DOWN.value;
// Flags that make a node accessibilty focusable.
// Flags that make a node accessibility focusable.
private static final int FOCUSABLE_FLAGS =
Flag.HAS_CHECKED_STATE.value
| Flag.IS_CHECKED.value
@ -519,7 +516,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
this.contentResolver.registerContentObserver(transitionUri, false, animationScaleObserver);
// Tells Flutter whether the text should be bolded or not. If the user changes bold text
// setting, the configuration will change and trigger a re-build of the accesibiltyBridge.
// setting, the configuration will change and trigger a re-build of the accessibilityBridge.
if (Build.VERSION.SDK_INT >= API_LEVELS.API_31) {
setBoldTextFlag();
}
@ -730,7 +727,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
//
// In this case, register the accessibility node in the view embedder,
// so the accessibility tree can be mirrored as a subtree of the Flutter accessibility tree.
// This is in constrast to hybrid composition where the embedded view is in the view hiearchy,
// This is in contrast to hybrid composition where the embedded view is in the view hierarchy,
// so it doesn't need to be mirrored.
//
// See the case down below for how hybrid composition is handled.
@ -2015,7 +2012,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
*
* <p>This method sets accessibility panel title if the API level >= 28, otherwise, it creates a
* {@link AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED} and sends the event to Android's
* accessibility system. In both cases, TalkBack announces the label of the route and re-addjusts
* accessibility system. In both cases, TalkBack announces the label of the route and re-adjusts
* the accessibility focus.
*
* <p>The given {@code route} should be a {@link SemanticsNode} that represents a navigation route
@ -2024,7 +2021,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
private void onWindowNameChange(@NonNull SemanticsNode route) {
String routeName = route.getRouteName();
if (routeName == null) {
// The routeName will be null when there is no semantics node that represnets namesRoute in
// The routeName will be null when there is no semantics node that represents namesRoute in
// the scopeRoute. The TYPE_WINDOW_STATE_CHANGED only works the route name is not null and not
// empty. Gives it a whitespace will make it focus the first semantics node without
// pronouncing any word.
@ -2123,7 +2120,8 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
}
// TODO(mattcarroll): should parent be set to "null" here? Changing the parent seems like the
// behavior of a method called "removeSemanticsNode()". The same is true
// for null'ing accessibilityFocusedSemanticsNode, inputFocusedSemanticsNode,
// for nullifying accessibilityFocusedSemanticsNode,
// inputFocusedSemanticsNode,
// and hoveredObject. Is this a hook method or a command?
semanticsNodeToBeRemoved.parent = null;
@ -2587,7 +2585,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
if (recursive) {
String childIndent = indent + " ";
for (SemanticsNode child : childrenInTraversalOrder) {
child.log(childIndent, recursive);
child.log(childIndent, true);
}
}
}