Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions shell/platform/android/io/flutter/view/AccessibilityBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -596,12 +596,12 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {

if (semanticsNode.parent != null) {
if (BuildConfig.DEBUG && semanticsNode.id <= ROOT_NODE_ID) {
throw new AssertionError("Semantics node id is not > ROOT_NODE_ID.");
Log.e(TAG, "Semantics node id is not > ROOT_NODE_ID.");
}
result.setParent(rootAccessibilityView, semanticsNode.parent.id);
} else {
if (BuildConfig.DEBUG && semanticsNode.id != ROOT_NODE_ID) {
throw new AssertionError("Semantics node id does not equal ROOT_NODE_ID.");
Log.e(TAG, "Semantics node id does not equal ROOT_NODE_ID.");
}
result.setParent(rootAccessibilityView);
}
Expand Down Expand Up @@ -712,7 +712,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
boolean hasCheckedState = semanticsNode.hasFlag(Flag.HAS_CHECKED_STATE);
boolean hasToggledState = semanticsNode.hasFlag(Flag.HAS_TOGGLED_STATE);
if (BuildConfig.DEBUG && (hasCheckedState && hasToggledState)) {
throw new AssertionError("Expected semanticsNode to have checked state and toggled state.");
Log.e(TAG, "Expected semanticsNode to have checked state and toggled state.");
}
result.setCheckable(hasCheckedState || hasToggledState);
if (hasCheckedState) {
Expand Down Expand Up @@ -1063,7 +1063,7 @@ public AccessibilityNodeInfo findFocus(int focus) {
*/
private SemanticsNode getRootSemanticsNode() {
if (BuildConfig.DEBUG && !flutterSemanticsTree.containsKey(0)) {
throw new AssertionError("Attempted to getRootSemanticsNode without a root sematnics node.");
Log.e(TAG, "Attempted to getRootSemanticsNode without a root sematnics node.");
}
return flutterSemanticsTree.get(0);
}
Expand Down Expand Up @@ -1328,10 +1328,10 @@ void updateSemantics(@NonNull ByteBuffer buffer, @NonNull String[] strings) {
}
if (BuildConfig.DEBUG) {
if (object.scrollIndex + visibleChildren > object.scrollChildren) {
throw new AssertionError("Scroll index is out of bounds.");
Log.e(TAG, "Scroll index is out of bounds.");
}
if (object.childrenInHitTestOrder.get(object.scrollIndex).hasFlag(Flag.IS_HIDDEN)) {
throw new AssertionError("Attempted to move Accessibility Focus to hidden child.");
Log.e(TAG, "Attempted to move Accessibility Focus to hidden child.");
}
}
// The setToIndex should be the index of the last visible child. Because we counted all
Expand Down Expand Up @@ -1486,7 +1486,7 @@ private void createAndSendWindowChangeEvent(@NonNull SemanticsNode route) {
*/
private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) {
if (BuildConfig.DEBUG && virtualViewId == ROOT_NODE_ID) {
throw new AssertionError("VirtualView node must not be the root node.");
Log.e(TAG, "VirtualView node must not be the root node.");
}
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.setPackageName(rootAccessibilityView.getContext().getPackageName());
Expand All @@ -1501,10 +1501,10 @@ private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int event
private void willRemoveSemanticsNode(SemanticsNode semanticsNodeToBeRemoved) {
if (BuildConfig.DEBUG) {
if (!flutterSemanticsTree.containsKey(semanticsNodeToBeRemoved.id)) {
throw new AssertionError("Attempted to remove a node that is not in the tree.");
Log.e(TAG, "Attempted to remove a node that is not in the tree.");
}
if (flutterSemanticsTree.get(semanticsNodeToBeRemoved.id) != semanticsNodeToBeRemoved) {
throw new AssertionError("Flutter semantics tree failed to get expected node when searching by id.");
Log.e(TAG, "Flutter semantics tree failed to get expected node when searching by id.");
}
}
// TODO(mattcarroll): should parent be set to "null" here? Changing the parent seems like the
Expand Down Expand Up @@ -1803,7 +1803,7 @@ private boolean hasFlag(@NonNull Flag flag) {

private boolean hadFlag(@NonNull Flag flag) {
if (BuildConfig.DEBUG && !hadPreviousConfig) {
throw new AssertionError("Attempted to check hadFlag but had no previous config.");
Log.e(TAG, "Attempted to check hadFlag but had no previous config.");
}
return (previousFlags & flag.value) != 0;
}
Expand Down Expand Up @@ -1937,7 +1937,7 @@ private void updateWith(@NonNull ByteBuffer buffer, @NonNull String[] strings) {
// If we receive a different overrideId it means that we were passed
// a standard action to override that we don't yet support.
if (BuildConfig.DEBUG && action.overrideId != -1) {
throw new AssertionError("Expected action.overrideId to be -1.");
Log.e(TAG, "Expected action.overrideId to be -1.");
}
customAccessibilityActions.add(action);
}
Expand All @@ -1961,7 +1961,7 @@ private void ensureInverseTransform() {

private Rect getGlobalRect() {
if (BuildConfig.DEBUG && globalGeometryDirty) {
throw new AssertionError("Attempted to getGlobalRect with a dirty geometry.");
Log.e(TAG, "Attempted to getGlobalRect with a dirty geometry.");
}
return globalRect;
}
Expand Down Expand Up @@ -2085,10 +2085,10 @@ private void updateRecursively(float[] ancestorTransform, Set<SemanticsNode> vis

if (BuildConfig.DEBUG) {
if (globalTransform == null) {
throw new AssertionError("Expected globalTransform to not be null.");
Log.e(TAG, "Expected globalTransform to not be null.");
}
if (globalRect == null) {
throw new AssertionError("Expected globalRect to not be null.");
Log.e(TAG, "Expected globalRect to not be null.");
}
}

Expand Down