mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 699243 - Add method to GeckoAppShell to emit a11y events and bridge it [r=blassey]
This commit is contained in:
parent
df967c87af
commit
7e098f7158
@ -64,6 +64,7 @@ import android.media.MediaScannerConnection;
|
||||
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
|
||||
import android.provider.Settings;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
|
||||
import android.util.*;
|
||||
import android.net.Uri;
|
||||
@ -1658,4 +1659,23 @@ public class GeckoAppShell
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void emitGeckoAccessibilityEvent (int eventType, String role, String text, String description, boolean enabled, boolean checked, boolean password) {
|
||||
AccessibilityManager accessibilityManager =
|
||||
(AccessibilityManager) GeckoApp.mAppContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
|
||||
if (!accessibilityManager.isEnabled())
|
||||
return;
|
||||
|
||||
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
|
||||
event.setClassName(GeckoApp.surfaceView.getClass().getName() + "$" + role);
|
||||
event.setPackageName(GeckoApp.mAppContext.getPackageName());
|
||||
event.setEnabled(enabled);
|
||||
event.setChecked(checked);
|
||||
event.setPassword(password);
|
||||
event.setContentDescription(description);
|
||||
event.getText().add(text);
|
||||
|
||||
accessibilityManager.sendAccessibilityEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -1244,6 +1244,15 @@ AndroidBridge::GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInf
|
||||
mJNIEnv->ReleaseFloatArrayElements(arr, info, 0);
|
||||
}
|
||||
|
||||
void AndroidBridge::EmitGeckoAccessibilityEvent (PRInt32 eventType, const nsAString& role, const nsAString& text, const nsAString& description, bool enabled, bool checked, bool password) {
|
||||
AutoLocalJNIFrame jniFrame;
|
||||
jstring jstrRole = mJNIEnv->NewString(nsPromiseFlatString(role).get(), role.Length());
|
||||
jstring jstrText = mJNIEnv->NewString(nsPromiseFlatString(text).get(), text.Length());
|
||||
jstring jstrDescription = mJNIEnv->NewString(nsPromiseFlatString(description).get(), description.Length());
|
||||
|
||||
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jEmitGeckoAccessibilityEvent, eventType, jstrRole, jstrText, jstrDescription, enabled, checked, password);
|
||||
}
|
||||
|
||||
void *
|
||||
AndroidBridge::LockBitmap(jobject bitmap)
|
||||
{
|
||||
|
@ -302,6 +302,8 @@ public:
|
||||
void DisableBatteryNotifications();
|
||||
void GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo);
|
||||
|
||||
void EmitGeckoAccessibilityEvent (PRInt32 eventType, const nsAString& role, const nsAString& text, const nsAString& description, bool enabled, bool checked, bool password);
|
||||
|
||||
protected:
|
||||
static AndroidBridge *sBridge;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user