Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Android Embedding PR 17: Clarify AccessibilityBridge. #8061

Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import io.flutter.embedding.engine.FlutterEngine.EngineLifecycleListener;
import io.flutter.embedding.engine.renderer.FlutterRenderer;
import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener;
import io.flutter.plugin.common.StandardMessageCodec;
import io.flutter.view.AccessibilityBridge;

/**
* Interface between Flutter embedding's Java code and Flutter engine's C/C++ code.
Expand Down Expand Up @@ -323,6 +325,22 @@ private native void nativeDispatchPointerDataPacket(long nativePlatformViewId,
ByteBuffer buffer,
int position);

public void dispatchSemanticsAction(int id, @NonNull AccessibilityBridge.Action action) {
dispatchSemanticsAction(id, action, null);
}

public void dispatchSemanticsAction(int id, @NonNull AccessibilityBridge.Action action, @Nullable Object args) {
ensureAttachedToNative();

ByteBuffer encodedArgs = null;
int position = 0;
if (args != null) {
encodedArgs = StandardMessageCodec.INSTANCE.encodeMessage(args);
position = encodedArgs.position();
}
dispatchSemanticsAction(id, action.value, encodedArgs, position);
}

@UiThread
public void dispatchSemanticsAction(int id, int action, ByteBuffer args, int argsPosition) {
ensureAttachedToNative();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ public interface AccessibilityMessageHandler {
void announce(@NonNull String message);

/**
* The user has tapped on the artifact with the given {@code nodeId}.
* The user has tapped on the widget with the given {@code nodeId}.
*/
void onTap(int nodeId);

/**
* The user has long pressed on the artifact with the given {@code nodeId}.
* The user has long pressed on the widget with the given {@code nodeId}.
*/
void onLongPress(int nodeId);

/**
* The user has opened a popup window, menu, dialog, etc.
* The user has opened a tooltip.
*/
void onTooltip(@NonNull String message);
}
Expand Down
Loading