Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
androidjniaccessibility.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
10#include "qpa/qplatformaccessibility.h"
11#include <QtGui/private/qaccessiblebridgeutils_p.h>
13#include "qwindow.h"
14#include "qrect.h"
15#include "QtGui/qaccessible.h"
16#include <QtCore/qmath.h>
17#include <QtCore/private/qjnihelpers_p.h>
18#include <QtCore/QJniObject>
19#include <QtGui/private/qhighdpiscaling_p.h>
20
21#include <QtCore/QObject>
22#include <QtCore/qpointer.h>
23#include <QtCore/qscopeguard.h>
24#include <QtCore/qvarlengtharray.h>
25
26static const char m_qtTag[] = "Qt A11Y";
27
28QT_BEGIN_NAMESPACE
29
30using namespace Qt::StringLiterals;
31
33{
60
61 static int RANGE_TYPE_INT = 0;
62 static int RANGE_TYPE_FLOAT = 0;
63 static int RANGE_TYPE_PERCENT = 0;
65
68 static int EXPANDED_STATE_FULL = 0;
69
70 static int ACTION_COLLAPSE = 0;
71 static int ACTION_EXPAND = 0;
72
73 static bool m_accessibilityActivated = false;
74
75 // This object is needed to schedule the execution of the code that
76 // deals with accessibility instances to the Qt main thread.
77 // Because of that almost every method here is split into two parts.
78 // The _helper part is executed in the context of m_accessibilityContext
79 // on the main thread. The other part is executed in Java thread.
81
82 // This method is called from the Qt main thread, and normally a
83 // QGuiApplication instance will be used as a parent.
85 {
86 if (m_accessibilityContext)
87 m_accessibilityContext->deleteLater();
88 m_accessibilityContext = new QObject(parent);
89 }
90
91 template <typename Func, typename Ret>
92 void runInObjectContext(QObject *context, Func &&func, Ret *retVal)
93 {
95 __android_log_print(ANDROID_LOG_WARN, m_qtTag,
96 "Could not run accessibility call in object context, no valid surface.");
97 return;
98 }
99
100 QtAndroidPrivate::AndroidDeadlockProtector protector(
101 u"QtAndroidAccessibility::runInObjectContext()"_s);
102 if (!protector.acquire()) {
103 __android_log_print(ANDROID_LOG_WARN, m_qtTag,
104 "Could not run accessibility call in object context, accessing "
105 "main thread could lead to deadlock");
106 return;
107 }
108
109 if (!QtAndroid::blockEventLoopsWhenSuspended()
110 || QGuiApplication::applicationState() != Qt::ApplicationSuspended) {
111 QMetaObject::invokeMethod(context, func, Qt::BlockingQueuedConnection, retVal);
112 } else {
113 __android_log_print(ANDROID_LOG_WARN, m_qtTag,
114 "Could not run accessibility call in object context, event loop suspended.");
115 }
116 }
117
118 bool isActive()
119 {
121 }
122
123 static void setActive(JNIEnv */*env*/, jobject /*thiz*/, jboolean active)
124 {
125 QMutexLocker lock(QtAndroid::platformInterfaceMutex());
128 if (platformIntegration) {
129 platformIntegration->accessibility()->setActive(active);
130 } else {
131 __android_log_print(ANDROID_LOG_DEBUG, m_qtTag,
132 "Android platform integration is not ready, accessibility activation deferred.");
133 }
134 }
135
136 QAccessibleInterface *interfaceFromId(jint objectId)
137 {
138 QAccessibleInterface *iface = nullptr;
139 if (objectId == -1) {
140 QWindow *win = qApp->focusWindow();
141 if (win)
142 iface = win->accessibleRoot();
143 } else {
144 iface = QAccessible::accessibleInterface(objectId);
145 }
146 return iface;
147 }
148
149 void notifyLocationChange(uint accessibilityObjectId)
150 {
151 QtAndroid::notifyAccessibilityLocationChange(accessibilityObjectId);
152 }
153
154 static int parentId_helper(int objectId); // forward declaration
155
156 void notifyObjectHide(uint accessibilityObjectId)
157 {
158 const auto parentObjectId = parentId_helper(accessibilityObjectId);
159 QtAndroid::notifyObjectHide(accessibilityObjectId, parentObjectId);
160 }
161
162 void notifyObjectShow(uint accessibilityObjectId)
163 {
164 const auto parentObjectId = parentId_helper(accessibilityObjectId);
165 QtAndroid::notifyObjectShow(parentObjectId);
166 }
167
168 void notifyObjectFocus(uint accessibilityObjectId)
169 {
170 QtAndroid::notifyObjectFocus(accessibilityObjectId);
171 }
172
173 static jstring jvalueForAccessibleObject(int objectId); // forward declaration
174
175 void notifyValueChanged(uint accessibilityObjectId)
176 {
177 jstring value = jvalueForAccessibleObject(accessibilityObjectId);
178 QtAndroid::notifyValueChanged(accessibilityObjectId, value);
179 }
180
181 // Forward declaration
182 static QString descriptionForInterface(QAccessibleInterface *iface);
183
184 void notifyDescriptionOrNameChanged(uint accessibilityObjectId)
185 {
186 QAccessibleInterface *iface = interfaceFromId(accessibilityObjectId);
187 if (iface && iface->isValid()) {
188 const QString value = descriptionForInterface(iface);
189 QtAndroid::notifyDescriptionOrNameChanged(accessibilityObjectId, value);
190 }
191 }
192
193 void notifyScrolledEvent(uint accessiblityObjectId)
194 {
195 QtAndroid::notifyScrolledEvent(accessiblityObjectId);
196 }
197
198 void notifyAnnouncementEvent(uint accessibilityObjectId, const QString &message)
199 {
200 QtAndroid::notifyAnnouncementEvent(accessibilityObjectId, message);
201 }
202
204 {
205 QAccessibleInterface *iface = interfaceFromId(objectId);
206 if (iface && iface->isValid()) {
207 const int childCount = iface->childCount();
208 QVarLengthArray<jint, 8> ifaceIdArray;
209 ifaceIdArray.reserve(childCount);
210 for (int i = 0; i < childCount; ++i) {
211 QAccessibleInterface *child = iface->child(i);
212 if (child && child->isValid())
213 ifaceIdArray.append(QAccessible::uniqueId(child));
214 }
215 return ifaceIdArray;
216 }
217 return {};
218 }
219
220 static jintArray childIdListForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId)
221 {
222 if (m_accessibilityContext) {
223 QVarLengthArray<jint, 8> ifaceIdArray;
224 runInObjectContext(m_accessibilityContext, [objectId]() {
225 return childIdListForAccessibleObject_helper(objectId);
226 }, &ifaceIdArray);
227 jintArray jArray = env->NewIntArray(jsize(ifaceIdArray.count()));
228 env->SetIntArrayRegion(jArray, 0, ifaceIdArray.count(), ifaceIdArray.data());
229 return jArray;
230 }
231
232 return env->NewIntArray(jsize(0));
233 }
234
235 static int parentId_helper(int objectId)
236 {
237 QAccessibleInterface *iface = interfaceFromId(objectId);
238 if (iface && iface->isValid()) {
239 QAccessibleInterface *parent = iface->parent();
240 if (parent && parent->isValid()) {
241 if (parent->role() == QAccessible::Application)
242 return -1;
243 return QAccessible::uniqueId(parent);
244 }
245 }
246 return -1;
247 }
248
249 static jint parentId(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
250 {
251 jint result = -1;
252 if (m_accessibilityContext) {
253 runInObjectContext(m_accessibilityContext, [objectId]() {
254 return parentId_helper(objectId);
255 }, &result);
256 }
257 return result;
258 }
259
260 static QRect screenRect_helper(int objectId, bool clip = true)
261 {
262 QRect rect;
263 QAccessibleInterface *iface = interfaceFromId(objectId);
264 if (iface && iface->isValid()) {
265 rect = QHighDpi::toNativePixels(iface->rect(), iface->window());
266 }
267 // If the widget is not fully in-bound in its parent then we have to clip the rectangle to draw
268 if (clip && iface && iface->parent() && iface->parent()->isValid()) {
269 const auto parentRect = QHighDpi::toNativePixels(iface->parent()->rect(), iface->parent()->window());
270 rect = rect.intersected(parentRect);
271 }
272 return rect;
273 }
274
275 static jobject screenRect(JNIEnv *env, jobject /*thiz*/, jint objectId)
276 {
277 QRect rect;
278 if (m_accessibilityContext) {
279 runInObjectContext(m_accessibilityContext, [objectId]() {
280 return screenRect_helper(objectId);
281 }, &rect);
282 }
283 jclass rectClass = env->FindClass("android/graphics/Rect");
284 jmethodID ctor = env->GetMethodID(rectClass, "<init>", "(IIII)V");
285 jobject jrect = env->NewObject(rectClass, ctor, rect.left(), rect.top(), rect.right(), rect.bottom());
286 return jrect;
287 }
288
289 static int hitTest_helper(float x, float y)
290 {
291 QAccessibleInterface *root = interfaceFromId(-1);
292 if (root && root->isValid()) {
293 QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window());
294
295 QAccessibleInterface *child = root->childAt(pos.x(), pos.y());
296 QAccessibleInterface *lastChild = nullptr;
297 while (child && (child != lastChild)) {
298 lastChild = child;
299 child = child->childAt(pos.x(), pos.y());
300 }
301 if (lastChild)
302 return QAccessible::uniqueId(lastChild);
303 }
304 return -1;
305 }
306
307 static jint hitTest(JNIEnv */*env*/, jobject /*thiz*/, jfloat x, jfloat y)
308 {
309 jint result = -1;
310 if (m_accessibilityContext) {
311 runInObjectContext(m_accessibilityContext, [x, y]() {
312 return hitTest_helper(x, y);
313 }, &result);
314 }
315 return result;
316 }
317
318 static void invokeActionOnInterfaceInMainThread(QAccessibleActionInterface* actionInterface,
319 const QString& action)
320 {
321 // Queue the action and return back to Java thread, so that we do not
322 // block it for too long
323 QMetaObject::invokeMethod(qApp, [actionInterface, action]() {
324 actionInterface->doAction(action);
325 }, Qt::QueuedConnection);
326 }
327
328 static bool clickAction_helper(int objectId)
329 {
330 QAccessibleInterface *iface = interfaceFromId(objectId);
331 if (!iface || !iface->isValid() || !iface->actionInterface())
332 return false;
333
334 const auto& actionNames = iface->actionInterface()->actionNames();
335
336 if (actionNames.contains(QAccessibleActionInterface::pressAction())) {
337 invokeActionOnInterfaceInMainThread(iface->actionInterface(),
338 QAccessibleActionInterface::pressAction());
339 } else if (actionNames.contains(QAccessibleActionInterface::toggleAction())) {
340 invokeActionOnInterfaceInMainThread(iface->actionInterface(),
341 QAccessibleActionInterface::toggleAction());
342 } else {
343 return false;
344 }
345 return true;
346 }
347
348 static bool focusAction_helper(int objectId)
349 {
350 QAccessibleInterface *iface = interfaceFromId(objectId);
351 if (!iface || !iface->isValid() || !iface->actionInterface())
352 return false;
353
354 const auto& actionNames = iface->actionInterface()->actionNames();
355
356 if (actionNames.contains(QAccessibleActionInterface::setFocusAction())) {
357 QAccessibleActionInterface *actionInterface = iface->actionInterface();
358 // Suppress keyboard activation during accessibility focus navigation.
359 QMetaObject::invokeMethod(qApp, [actionInterface]() {
360 auto *inputContext = QAndroidInputContext::androidInputContext();
361 if (inputContext)
362 inputContext->setAccessibilityFocusInProgress(true);
363 const auto resetGuard = qScopeGuard([inputContext] {
364 if (inputContext)
365 inputContext->setAccessibilityFocusInProgress(false);
366 });
367 actionInterface->doAction(QAccessibleActionInterface::setFocusAction());
368 }, Qt::QueuedConnection);
369 return true;
370 }
371 return false;
372 }
373
374 static jboolean clickAction(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
375 {
376 bool result = false;
377 if (m_accessibilityContext) {
378 runInObjectContext(m_accessibilityContext, [objectId]() {
379 return clickAction_helper(objectId);
380 }, &result);
381 }
382 return result;
383 }
384
385 static jboolean focusAction(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
386 {
387 bool result = false;
388 if (m_accessibilityContext) {
389 runInObjectContext(m_accessibilityContext, [objectId]() {
390 return focusAction_helper(objectId);
391 }, &result);
392 }
393 return result;
394 }
395
396 static bool scroll_helper(int objectId, const QString &actionName)
397 {
398 QAccessibleInterface *iface = interfaceFromId(objectId);
399 if (iface && iface->isValid())
400 return QAccessibleBridgeUtils::performEffectiveAction(iface, actionName);
401 return false;
402 }
403
404 static jboolean scrollForward(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
405 {
406 bool result = false;
407
408 const auto& ids = childIdListForAccessibleObject_helper(objectId);
409 if (ids.isEmpty())
410 return false;
411
412 const int firstChildId = ids.first();
413 const QRect oldPosition = screenRect_helper(firstChildId, false);
414
415 if (m_accessibilityContext) {
416 runInObjectContext(m_accessibilityContext, [objectId]() {
417 return scroll_helper(objectId, QAccessibleActionInterface::increaseAction());
418 }, &result);
419 }
420
421 // Don't check for position change if the call was not successful
422 return result && oldPosition != screenRect_helper(firstChildId, false);
423 }
424
425 static jboolean scrollBackward(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
426 {
427 bool result = false;
428
429 const auto& ids = childIdListForAccessibleObject_helper(objectId);
430 if (ids.isEmpty())
431 return false;
432
433 const int firstChildId = ids.first();
434 const QRect oldPosition = screenRect_helper(firstChildId, false);
435
436 if (m_accessibilityContext) {
437 runInObjectContext(m_accessibilityContext, [objectId]() {
438 return scroll_helper(objectId, QAccessibleActionInterface::decreaseAction());
439 }, &result);
440 }
441
442 // Don't check for position change if the call was not successful
443 return result && oldPosition != screenRect_helper(firstChildId, false);
444 }
445
446 static bool showOnScreen_helper(int objectId)
447 {
448 QAccessibleInterface *iface = interfaceFromId(objectId);
449 if (!iface || !iface->isValid() || !iface->actionInterface())
450 return false;
451
452 const auto actionNames = iface->actionInterface()->actionNames();
453
454 if (actionNames.contains(QAccessibleActionInterface::showOnScreenAction())) {
455 invokeActionOnInterfaceInMainThread(iface->actionInterface(), QAccessibleActionInterface::showOnScreenAction());
456 return true;
457 }
458 return false;
459 }
460
461 static jboolean showOnScreen(JNIEnv */*env*/, jobject /*thiz*/, jint objectId)
462 {
463 bool result = false;
464 if (m_accessibilityContext) {
465 runInObjectContext(m_accessibilityContext, [objectId]() {
466 return showOnScreen_helper(objectId);
467 }, &result);
468 }
469 return result;
470 }
471
472 static jboolean expand(JNIEnv * /*env*/, jobject /*thiz*/, jint objectId)
473 {
474 bool result = false;
475 if (m_accessibilityContext) {
476 runInObjectContext(
477 m_accessibilityContext, [objectId]() { return clickAction_helper(objectId); },
478 &result);
479 }
480 return result;
481 }
482
483 static jboolean collapse(JNIEnv * /*env*/, jobject /*thiz*/, jint objectId)
484 {
485 bool result = false;
486 if (m_accessibilityContext) {
487 runInObjectContext(
488 m_accessibilityContext, [objectId]() { return clickAction_helper(objectId); },
489 &result);
490 }
491 return result;
492 }
493
494 static QString textFromValue(QAccessibleInterface *iface)
495 {
496 QString valueStr;
497 QAccessibleValueInterface *valueIface = iface->valueInterface();
498 if (valueIface) {
499 const QVariant valueVar = valueIface->currentValue();
500 const auto type = valueVar.typeId();
501 if (type == QMetaType::Double || type == QMetaType::Float) {
502 // QVariant's toString() formats floating-point values with
503 // FloatingPointShortest, which is not an accessible
504 // representation; nor, in many cases, is it suitable to the UI
505 // element whose value we're looking at. So roll our own
506 // A11Y-friendly conversion to string.
507 const double val = valueVar.toDouble();
508 // Try to use minimumStepSize() to determine precision
509 bool stepIsValid = false;
510 const double step = qAbs(valueIface->minimumStepSize().toDouble(&stepIsValid));
511 if (!stepIsValid || qFuzzyIsNull(step)) {
512 // Ignore step, use default precision
513 valueStr = qFuzzyIsNull(val) ? u"0"_s : QString::number(val, 'f');
514 } else {
515 const int precision = [](double s) {
516 int count = 0;
517 while (s < 1. && !qFuzzyCompare(s, 1.)) {
518 ++count;
519 s *= 10;
520 }
521 // If s is now 1.25, we want to show some more digits,
522 // but don't want to get silly with a step like 1./7;
523 // so only include a few extra digits.
524 const int stop = count + 3;
525 const auto fractional = [](double v) {
526 double whole = 0.0;
527 std::modf(v + 0.5, &whole);
528 return qAbs(v - whole);
529 };
530 s = fractional(s);
531 while (count < stop && !qFuzzyIsNull(s)) {
532 ++count;
533 s = fractional(s * 10);
534 }
535 return count;
536 }(step);
537 valueStr = qFuzzyIsNull(val / step) ? u"0"_s
538 : QString::number(val, 'f', precision);
539 }
540 } else {
541 valueStr = valueVar.toString();
542 }
543 }
544 return valueStr;
545 }
546
548 {
549 QAccessibleInterface *iface = interfaceFromId(objectId);
550 const QString value = textFromValue(iface);
551 QJniEnvironment env;
552 jstring jstr = env->NewString((jchar*)value.constData(), (jsize)value.size());
553 if (env.checkAndClearExceptions())
554 __android_log_print(ANDROID_LOG_WARN, m_qtTag, "Failed to create jstring");
555 return jstr;
556 }
557
558 static QString classNameForRole(QAccessible::Role role, QAccessible::State state) {
559 switch (role) {
560 case QAccessible::Role::Button:
561 case QAccessible::Role::Link:
562 {
563 if (state.checkable)
564 return QStringLiteral("android.widget.ToggleButton");
565 return QStringLiteral("android.widget.Button");
566 }
567 case QAccessible::Role::CheckBox:
568 // As of android/accessibility/utils/Role.java::getRole a CheckBox
569 // is NOT android.widget.CheckBox
570 return QStringLiteral("android.widget.CompoundButton");
571 case QAccessible::Role::Switch:
572 return QStringLiteral("android.widget.Switch");
573 case QAccessible::Role::Clock:
574 return QStringLiteral("android.widget.TextClock");
575 case QAccessible::Role::ComboBox:
576 return QStringLiteral("android.widget.Spinner");
577 case QAccessible::Role::Graphic:
578 // QQuickImage does not provide this role it inherits Client from QQuickItem
579 return QStringLiteral("android.widget.ImageView");
580 case QAccessible::Role::Grouping:
581 return QStringLiteral("android.view.ViewGroup");
582 case QAccessible::Role::List:
583 // As of android/accessibility/utils/Role.java::getRole a List
584 // is NOT android.widget.ListView
585 return QStringLiteral("android.widget.AbsListView");
586 case QAccessible::Role::MenuItem:
587 return QStringLiteral("android.view.MenuItem");
588 case QAccessible::Role::PopupMenu:
589 return QStringLiteral("android.widget.PopupMenu");
590 case QAccessible::Role::Separator:
591 return QStringLiteral("android.widget.Space");
592 case QAccessible::Role::ToolBar:
593 return QStringLiteral("android.view.Toolbar");
594 case QAccessible::Role::Heading: [[fallthrough]];
595 case QAccessible::Role::StaticText:
596 // Heading vs. regular Text is finally determined by AccessibilityNodeInfo.isHeading()
597 return QStringLiteral("android.widget.TextView");
598 case QAccessible::Role::EditableText:
599 return QStringLiteral("android.widget.EditText");
600 case QAccessible::Role::RadioButton:
601 return QStringLiteral("android.widget.RadioButton");
602 case QAccessible::Role::ProgressBar:
603 return QStringLiteral("android.widget.ProgressBar");
604 case QAccessible::Role::SpinBox:
605 return QStringLiteral("android.widget.NumberPicker");
606 case QAccessible::Role::WebDocument:
607 return QStringLiteral("android.webkit.WebView");
608 case QAccessible::Role::Dialog:
609 return QStringLiteral("android.app.AlertDialog");
610 case QAccessible::Role::PageTab:
611 return QStringLiteral("android.app.ActionBar.Tab");
612 case QAccessible::Role::PageTabList:
613 return QStringLiteral("android.widget.TabWidget");
614 case QAccessible::Role::ScrollBar:
615 return QStringLiteral("android.widget.Scroller");
616 case QAccessible::Role::Slider:
617 return QStringLiteral("com.google.android.material.slider.Slider");
618 case QAccessible::Role::Table:
619 // #TODO Evaluate the usage of AccessibleNodeInfo.setCollectionItemInfo() to provide
620 // infos about colums, rows und items.
621 return QStringLiteral("android.widget.GridView");
622 case QAccessible::Role::Pane:
623 // #TODO QQuickScrollView, QQuickListView (see QTBUG-137806)
624 return QStringLiteral("android.view.ViewGroup");
625 case QAccessible::Role::AlertMessage:
626 case QAccessible::Role::Animation:
627 case QAccessible::Role::Application:
628 case QAccessible::Role::Assistant:
629 case QAccessible::Role::BlockQuote:
630 case QAccessible::Role::Border:
631 case QAccessible::Role::ButtonDropGrid:
632 case QAccessible::Role::ButtonDropDown:
633 case QAccessible::Role::ButtonMenu:
634 case QAccessible::Role::Canvas:
635 case QAccessible::Role::Caret:
636 case QAccessible::Role::Cell:
637 case QAccessible::Role::Chart:
638 case QAccessible::Role::Client:
639 case QAccessible::Role::ColorChooser:
640 case QAccessible::Role::Column:
641 case QAccessible::Role::ColumnHeader:
642 case QAccessible::Role::ComplementaryContent:
643 case QAccessible::Role::Cursor:
644 case QAccessible::Role::Desktop:
645 case QAccessible::Role::Dial:
646 case QAccessible::Role::Document:
647 case QAccessible::Role::Equation:
648 case QAccessible::Role::Footer:
649 case QAccessible::Role::Form:
650 case QAccessible::Role::Grip:
651 case QAccessible::Role::HelpBalloon:
652 case QAccessible::Role::HotkeyField:
653 case QAccessible::Role::Indicator:
654 case QAccessible::Role::LayeredPane:
655 case QAccessible::Role::ListItem:
656 case QAccessible::Role::MenuBar:
657 case QAccessible::Role::NoRole:
658 case QAccessible::Role::Note:
659 case QAccessible::Role::Notification:
660 case QAccessible::Role::Paragraph:
661 case QAccessible::Role::PropertyPage:
662 case QAccessible::Role::Row:
663 case QAccessible::Role::RowHeader:
664 case QAccessible::Role::Section:
665 case QAccessible::Role::Sound:
666 case QAccessible::Role::Splitter:
667 case QAccessible::Role::StatusBar:
668 case QAccessible::Role::Terminal:
669 case QAccessible::Role::TitleBar:
670 case QAccessible::Role::ToolTip:
671 case QAccessible::Role::Tree:
672 case QAccessible::Role::TreeItem:
673 case QAccessible::Role::UserRole:
674 case QAccessible::Role::Whitespace:
675 case QAccessible::Role::Window:
676 // If unsure, every visible or interactive element in Android
677 // inherits android.view.View and by many extends also TextView.
678 // Android itself does a similar thing e.g. in its Settings-App.
679 return QStringLiteral("android.view.TextView");
680 }
681 }
682
683 static int expandedStateFromState(QAccessible::State state)
684 {
685 if (!state.expandable)
687
688 return state.expanded ? EXPANDED_STATE_FULL : EXPANDED_STATE_COLLAPSED;
689 }
690
691 static QString descriptionForInterface(QAccessibleInterface *iface)
692 {
693 QString desc;
694 if (iface && iface->isValid()) {
695 bool hasValue = false;
696 desc = iface->text(QAccessible::Name);
697 const QString descStr = iface->text(QAccessible::Description);
698 if (!descStr.isEmpty()) {
699 if (!desc.isEmpty())
700 desc.append(QStringLiteral(", "));
701 desc.append(descStr);
702 }
703 if (desc.isEmpty()) {
704 desc = iface->text(QAccessible::Value);
705 hasValue = !desc.isEmpty();
706 }
707 if (!hasValue && iface->valueInterface()) {
708 const QString valueStr = textFromValue(iface);
709 if (!valueStr.isEmpty()) {
710 if (!desc.isEmpty())
711 desc.append(QChar(QChar::Space));
712 desc.append(valueStr);
713 }
714 }
715 }
716 return desc;
717 }
718
719 static QString descriptionForAccessibleObject_helper(int objectId)
720 {
721 QAccessibleInterface *iface = interfaceFromId(objectId);
722 return descriptionForInterface(iface);
723 }
724
725 static jstring descriptionForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId)
726 {
727 QString desc;
728 if (m_accessibilityContext) {
729 runInObjectContext(m_accessibilityContext, [objectId]() {
730 return descriptionForAccessibleObject_helper(objectId);
731 }, &desc);
732 }
733 return env->NewString((jchar*) desc.constData(), (jsize) desc.size());
734 }
735
736 static QString languageTag_helper(int objectId)
737 {
738 QAccessibleInterface *iface = interfaceFromId(objectId);
739 if (!iface || !iface->isValid())
740 return QString();
741
742 QAccessibleAttributesInterface *attributesIface = iface->attributesInterface();
743 if (!attributesIface || !attributesIface->attributeKeys().contains(QAccessible::Attribute::Locale))
744 return QString();
745
746 return attributesIface->attributeValue(QAccessible::Attribute::Locale).toLocale().bcp47Name();
747 }
748
749 static jstring languageTag(JNIEnv *env, jobject /*thiz*/, jint objectId)
750 {
751 QString tag;
752 if (m_accessibilityContext) {
753 runInObjectContext(m_accessibilityContext, [objectId]() {
754 return languageTag_helper(objectId);
755 }, &tag);
756 }
757 return env->NewString((jchar*)tag.constData(), (jsize)tag.size());
758 }
759
760 struct NodeInfo
761 {
762 bool valid = false;
766 QString description;
767 QString text;
768 QString hint;
769 QString identifier;
770 bool hasTextSelection = false;
773 bool hasValue = false;
774 QVariant minValue = 0;
775 QVariant maxValue = 0;
776 QVariant currentValue = 0;
777 QVariant valueStepSize = 0;
778 };
779
780 static NodeInfo populateNode_helper(int objectId)
781 {
782 NodeInfo info;
783 QAccessibleInterface *iface = interfaceFromId(objectId);
784 if (iface && iface->isValid()) {
785 info.valid = true;
786 info.state = iface->state();
787 info.role = iface->role();
788 info.actions = QAccessibleBridgeUtils::effectiveActionNames(iface);
789 info.description = descriptionForInterface(iface);
790 info.identifier = QAccessibleBridgeUtils::accessibleId(iface);
791 QAccessibleTextInterface *textIface = iface->textInterface();
792 if (textIface && (textIface->selectionCount() > 0)) {
793 info.hasTextSelection = true;
794 textIface->selection(0, &info.selectionStart, &info.selectionEnd);
795 }
796 // For editable nodes, capture the text (exposed via setText(), which
797 // a screen reader reads to track the caret and echo edits) and the
798 // accessible name (exposed via setHintText(), the label channel a
799 // screen reader reads for a text input).
800 if (info.state.editable) {
801 if (textIface)
802 info.text = textIface->text(0, textIface->characterCount());
803 info.hint = iface->text(QAccessible::Name);
804 }
805 QAccessibleValueInterface *valueInterface = iface->valueInterface();
806 if (valueInterface) {
807 info.hasValue = true;
808 info.minValue = valueInterface->minimumValue();
809 info.maxValue = valueInterface->maximumValue();
810 info.currentValue = valueInterface->currentValue();
811 info.valueStepSize = valueInterface->minimumStepSize();
812 }
813 }
814 return info;
815 }
816
817 static jboolean populateNode(JNIEnv *env, jobject /*thiz*/, jint objectId, jobject node)
818 {
819 NodeInfo info;
820 if (m_accessibilityContext) {
821 runInObjectContext(m_accessibilityContext, [objectId]() {
822 return populateNode_helper(objectId);
823 }, &info);
824 }
825 if (!info.valid) {
826 __android_log_print(ANDROID_LOG_WARN, m_qtTag, "Accessibility: populateNode for Invalid ID");
827 return false;
828 }
829
830 const QString role = classNameForRole(info.role, info.state);
831 jstring jrole = env->NewString((jchar*)role.constData(), (jsize)role.size());
832 env->CallVoidMethod(node, m_setClassNameMethodID, jrole);
833
834 const bool hasClickableAction =
835 (info.actions.contains(QAccessibleActionInterface::pressAction())
836 || info.actions.contains(QAccessibleActionInterface::toggleAction()))
837 && !(info.role == QAccessible::StaticText || info.role == QAccessible::Heading);
838 const bool hasIncreaseAction =
839 info.actions.contains(QAccessibleActionInterface::increaseAction());
840 const bool hasDecreaseAction =
841 info.actions.contains(QAccessibleActionInterface::decreaseAction());
842 const bool scrollableRole =
843 info.role == QAccessible::ScrollBar || info.role == QAccessible::List;
844
845 if (info.hasTextSelection && m_setTextSelectionMethodID) {
846 env->CallVoidMethod(node, m_setTextSelectionMethodID, info.selectionStart,
847 info.selectionEnd);
848 }
849
850 if (info.hasValue && m_setRangeInfoMethodID) {
851 int valueType = info.currentValue.typeId();
852 jint rangeType = RANGE_TYPE_INDETERMINATE;
853 switch (valueType) {
854 case QMetaType::Float:
855 case QMetaType::Double:
856 rangeType = RANGE_TYPE_FLOAT;
857 break;
858 case QMetaType::Int:
859 rangeType = RANGE_TYPE_INT;
860 break;
861 }
862
863 float min = info.minValue.toFloat();
864 float max = info.maxValue.toFloat();
865 float current = info.currentValue.toFloat();
866 if (info.role == QAccessible::ProgressBar) {
867 rangeType = RANGE_TYPE_PERCENT;
868 current = 100 * (current - min) / (max - min);
869 min = 0.0f;
870 max = 100.0f;
871 }
872
873 QJniObject rangeInfo("android/view/accessibility/AccessibilityNodeInfo$RangeInfo",
874 "(IFFF)V", rangeType, min, max, current);
875
876 if (rangeInfo.isValid()) {
877 env->CallVoidMethod(node, m_setRangeInfoMethodID, rangeInfo.object());
878 }
879 }
880
881 env->CallVoidMethod(node, m_setCheckableMethodID, (bool)info.state.checkable);
882 env->CallVoidMethod(node, m_setCheckedMethodID, (bool)info.state.checked);
883 if (QtAndroidPrivate::androidSdkVersion() >= 36) {
884 env->CallVoidMethod(node, m_setExpandedStateMethodID,
885 expandedStateFromState(info.state));
886 }
887 env->CallVoidMethod(node, m_setEditableMethodID, info.state.editable);
888 env->CallVoidMethod(node, m_setEnabledMethodID, !info.state.disabled);
889 env->CallVoidMethod(node, m_setFocusableMethodID, (bool)info.state.focusable);
890 env->CallVoidMethod(node, m_setFocusedMethodID, (bool)info.state.focused);
892 env->CallVoidMethod(node, m_setHeadingMethodID, info.role == QAccessible::Heading);
893 env->CallVoidMethod(node, m_setVisibleToUserMethodID, !info.state.invisible);
894 env->CallVoidMethod(node, m_setScrollableMethodID,
895 hasIncreaseAction || hasDecreaseAction || scrollableRole);
896 env->CallVoidMethod(node, m_setClickableMethodID, hasClickableAction || info.role == QAccessible::Link);
897
898 // Add ACTION_CLICK
899 if (hasClickableAction)
900 env->CallVoidMethod(node, m_addActionMethodID, (int)0x00000010); // ACTION_CLICK defined in AccessibilityNodeInfo
901
902 // Add ACTION_SCROLL_FORWARD
903 if (hasIncreaseAction)
904 env->CallVoidMethod(node, m_addActionMethodID, (int)0x00001000); // ACTION_SCROLL_FORWARD defined in AccessibilityNodeInfo
905
906 // Add ACTION_SCROLL_BACKWARD
907 if (hasDecreaseAction)
908 env->CallVoidMethod(node, m_addActionMethodID, (int)0x00002000); // ACTION_SCROLL_BACKWARD defined in AccessibilityNodeInfo
909
910 // Add ACTION_EXPAND / ACTION_COLLAPSE
911 if (info.state.expandable) {
912 if (info.state.expanded) {
913 env->CallVoidMethod(node, m_addActionMethodID, ACTION_COLLAPSE);
914 } else {
915 env->CallVoidMethod(node, m_addActionMethodID, ACTION_EXPAND);
916 }
917 }
918
919 // try to fill in the text property, this is what the screen reader reads
920 jstring jdesc = env->NewString((jchar*)info.description.constData(),
921 (jsize)info.description.size());
922 //CALL_METHOD(node, "setText", "(Ljava/lang/CharSequence;)V", jdesc)
923 env->CallVoidMethod(node, m_setContentDescriptionMethodID, jdesc);
924
925 // An editable node exposes its content via setText() (read to track the
926 // caret and echo edits), its label via setHintText() (the label channel
927 // for a text input), and an inputType so it is treated as a real text
928 // field. contentDescription is kept above for readers that use it instead.
929 if (info.state.editable) {
930 if (m_setTextMethodID) {
931 jstring jtext = env->NewString((jchar*)info.text.constData(),
932 (jsize)info.text.size());
933 env->CallVoidMethod(node, m_setTextMethodID, jtext);
934 env->DeleteLocalRef(jtext);
935 }
936 // 0x1 == android.text.InputType.TYPE_CLASS_TEXT.
938 env->CallVoidMethod(node, m_setInputTypeMethodID, (jint)0x00000001);
940 jstring jhint = env->NewString((jchar*)info.hint.constData(),
941 (jsize)info.hint.size());
942 env->CallVoidMethod(node, m_setHintTextMethodID, jhint);
943 env->DeleteLocalRef(jhint);
944 }
945 }
946
947 QJniObject(node).callMethod<void>("setViewIdResourceName", info.identifier);
948
949 return true;
950 }
951
960
962 {
963 QAccessibleInterface *iface = interfaceFromId(objectId);
964 if (!iface || !iface->isValid())
965 return { };
966
967 auto *viewportIface = iface->viewportInterface();
968 if (!viewportIface)
969 return { };
970
971 ScrollEventInfo info;
972 info.isValid = true;
973 info.isIndexed = viewportIface->isIndexed();
974 info.contentSize = viewportIface->contentSize();
975 info.position = viewportIface->position();
976 info.viewportSize = viewportIface->viewportSize();
977
978 return info;
979 }
980
981 static jboolean populateScrollEvent(JNIEnv *env, jobject /*thiz*/, jint objectId, jobject event)
982 {
983 ScrollEventInfo info;
984 if (m_accessibilityContext) {
985 runInObjectContext(
986 m_accessibilityContext,
987 [objectId]() { return populateScrollEvent_helper(objectId); }, &info);
988 }
989
990 if (!info.isValid)
991 return false;
992
993 if (info.isIndexed) {
994 const int itemCount = std::max(info.contentSize.width(), info.contentSize.height());
995 env->CallVoidMethod(event, m_setItemCountMethodID, itemCount);
996 const int fromIndex = std::max(info.position.x(), info.position.y()) * itemCount;
997 env->CallVoidMethod(event, m_setFromIndexMethodID, fromIndex);
998 const int toIndex = fromIndex
999 + std::min(info.viewportSize.width(), info.viewportSize.height() * itemCount);
1000 env->CallVoidMethod(event, m_setToIndexMethodID, toIndex);
1001
1002 } else {
1003 env->CallVoidMethod(event, m_setScrollXMethodID,
1004 (int)(info.position.x() * info.contentSize.width()));
1005 env->CallVoidMethod(event, m_setMaxScrollXMethodID, (int)info.contentSize.width());
1006 env->CallVoidMethod(event, m_setScrollYMethodID,
1007 (int)(info.position.y() * info.contentSize.height()));
1008 env->CallVoidMethod(event, m_setMaxScrollYMethodID, (int)info.contentSize.height());
1009 }
1010
1011 return true;
1012 }
1013
1014 static const JNINativeMethod methods[] = {
1015 {"setActive","(Z)V",(void*)setActive},
1016 {"childIdListForAccessibleObject", "(I)[I", (jintArray)childIdListForAccessibleObject},
1017 {"parentId", "(I)I", (void*)parentId},
1018 {"descriptionForAccessibleObject", "(I)Ljava/lang/String;", (jstring)descriptionForAccessibleObject},
1019 {"languageTag", "(I)Ljava/lang/String;", (jstring)languageTag},
1020 {"screenRect", "(I)Landroid/graphics/Rect;", (jobject)screenRect},
1021 {"hitTest", "(FF)I", (void*)hitTest},
1022 {"populateNode", "(ILandroid/view/accessibility/AccessibilityNodeInfo;)Z", (void*)populateNode},
1023 {"populateScrollEvent", "(ILandroid/view/accessibility/AccessibilityEvent;)Z", (void*)populateScrollEvent},
1024 {"clickAction", "(I)Z", (void*)clickAction},
1025 {"focusAction", "(I)Z", (void*)focusAction},
1026 {"scrollForward", "(I)Z", (void*)scrollForward},
1027 {"scrollBackward", "(I)Z", (void*)scrollBackward},
1028 {"showOnScreen", "(I)Z", (void *)showOnScreen},
1029 {"expand", "(I)Z", (void *)expand},
1030 {"collapse", "(I)Z", (void *)collapse}
1031 };
1032
1033#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE)
1034 VAR = env->GetMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE);
1035 if (!VAR) {
1036 __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::methodErrorMsgFmt(), METHOD_NAME, METHOD_SIGNATURE);
1037 return false;
1038 }
1039
1040#define CHECK_AND_INIT_STATIC_FIELD(TYPE, VAR, CLASS, FIELD_NAME)
1041 if (env.findStaticField<TYPE>(CLASS, FIELD_NAME) == nullptr) {
1042 __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(),
1043 QtAndroid::staticFieldErrorMsgFmt(), FIELD_NAME);
1044 return false;
1045 }
1046 VAR = QJniObject::getStaticField<TYPE>(CLASS, FIELD_NAME);
1047
1048 bool registerNatives(QJniEnvironment &env)
1049 {
1050 if (!env.registerNativeMethods("org/qtproject/qt/android/QtNativeAccessibility",
1051 methods, sizeof(methods) / sizeof(methods[0]))) {
1052 __android_log_print(ANDROID_LOG_FATAL,"Qt A11y", "RegisterNatives failed");
1053 return false;
1054 }
1055
1056 jclass nodeInfoClass = env->FindClass("android/view/accessibility/AccessibilityNodeInfo");
1057 GET_AND_CHECK_STATIC_METHOD(m_setClassNameMethodID, nodeInfoClass, "setClassName", "(Ljava/lang/CharSequence;)V");
1058 GET_AND_CHECK_STATIC_METHOD(m_addActionMethodID, nodeInfoClass, "addAction", "(I)V");
1059 GET_AND_CHECK_STATIC_METHOD(m_setCheckableMethodID, nodeInfoClass, "setCheckable", "(Z)V");
1060 GET_AND_CHECK_STATIC_METHOD(m_setCheckedMethodID, nodeInfoClass, "setChecked", "(Z)V");
1061 if (QtAndroidPrivate::androidSdkVersion() >= 36) {
1062 GET_AND_CHECK_STATIC_METHOD(m_setExpandedStateMethodID, nodeInfoClass,
1063 "setExpandedState", "(I)V");
1064 }
1065 GET_AND_CHECK_STATIC_METHOD(m_setClickableMethodID, nodeInfoClass, "setClickable", "(Z)V");
1066 GET_AND_CHECK_STATIC_METHOD(m_setContentDescriptionMethodID, nodeInfoClass, "setContentDescription", "(Ljava/lang/CharSequence;)V");
1067 GET_AND_CHECK_STATIC_METHOD(m_setTextMethodID, nodeInfoClass, "setText", "(Ljava/lang/CharSequence;)V");
1068 GET_AND_CHECK_STATIC_METHOD(m_setInputTypeMethodID, nodeInfoClass, "setInputType", "(I)V");
1069 // setHintText is API 26+, below Qt's API-28 floor, so no SDK guard needed.
1070 GET_AND_CHECK_STATIC_METHOD(m_setHintTextMethodID, nodeInfoClass, "setHintText", "(Ljava/lang/CharSequence;)V");
1071 GET_AND_CHECK_STATIC_METHOD(m_setEditableMethodID, nodeInfoClass, "setEditable", "(Z)V");
1072 GET_AND_CHECK_STATIC_METHOD(m_setEnabledMethodID, nodeInfoClass, "setEnabled", "(Z)V");
1073 GET_AND_CHECK_STATIC_METHOD(m_setFocusableMethodID, nodeInfoClass, "setFocusable", "(Z)V");
1074 GET_AND_CHECK_STATIC_METHOD(m_setFocusedMethodID, nodeInfoClass, "setFocused", "(Z)V");
1075 if (QtAndroidPrivate::androidSdkVersion() >= 28) {
1076 GET_AND_CHECK_STATIC_METHOD(m_setHeadingMethodID, nodeInfoClass, "setHeading", "(Z)V");
1077 }
1078 GET_AND_CHECK_STATIC_METHOD(m_setScrollableMethodID, nodeInfoClass, "setScrollable", "(Z)V");
1079 GET_AND_CHECK_STATIC_METHOD(m_setVisibleToUserMethodID, nodeInfoClass, "setVisibleToUser", "(Z)V");
1080 GET_AND_CHECK_STATIC_METHOD(m_setTextSelectionMethodID, nodeInfoClass, "setTextSelection", "(II)V");
1082 m_setRangeInfoMethodID, nodeInfoClass, "setRangeInfo",
1083 "(Landroid/view/accessibility/AccessibilityNodeInfo$RangeInfo;)V");
1084
1085 jclass eventClass = env->FindClass("android/view/accessibility/AccessibilityEvent");
1086 GET_AND_CHECK_STATIC_METHOD(m_setMaxScrollXMethodID, eventClass, "setMaxScrollX", "(I)V");
1087 GET_AND_CHECK_STATIC_METHOD(m_setScrollXMethodID, eventClass, "setScrollX", "(I)V");
1088 GET_AND_CHECK_STATIC_METHOD(m_setMaxScrollYMethodID, eventClass, "setMaxScrollY", "(I)V");
1089 GET_AND_CHECK_STATIC_METHOD(m_setScrollYMethodID, eventClass, "setScrollY", "(I)V");
1090 GET_AND_CHECK_STATIC_METHOD(m_setItemCountMethodID, eventClass, "setItemCount", "(I)V");
1091 GET_AND_CHECK_STATIC_METHOD(m_setFromIndexMethodID, eventClass, "setFromIndex", "(I)V");
1092 GET_AND_CHECK_STATIC_METHOD(m_setToIndexMethodID, eventClass, "setToIndex", "(I)V");
1093
1094 jclass rangeInfoClass =
1095 env->FindClass("android/view/accessibility/AccessibilityNodeInfo$RangeInfo");
1096 CHECK_AND_INIT_STATIC_FIELD(int, RANGE_TYPE_INT, rangeInfoClass, "RANGE_TYPE_INT");
1097 CHECK_AND_INIT_STATIC_FIELD(int, RANGE_TYPE_FLOAT, rangeInfoClass, "RANGE_TYPE_FLOAT");
1098 CHECK_AND_INIT_STATIC_FIELD(int, RANGE_TYPE_PERCENT, rangeInfoClass, "RANGE_TYPE_PERCENT");
1099 if (QtAndroidPrivate::androidSdkVersion() >= 36) {
1100 CHECK_AND_INIT_STATIC_FIELD(int, RANGE_TYPE_INDETERMINATE, rangeInfoClass,
1101 "RANGE_TYPE_INDETERMINATE");
1102 } else {
1104 }
1105
1106 if (QtAndroidPrivate::androidSdkVersion() >= 36) {
1107 CHECK_AND_INIT_STATIC_FIELD(int, EXPANDED_STATE_UNDEFINED, nodeInfoClass,
1108 "EXPANDED_STATE_UNDEFINED");
1109 CHECK_AND_INIT_STATIC_FIELD(int, EXPANDED_STATE_COLLAPSED, nodeInfoClass,
1110 "EXPANDED_STATE_COLLAPSED");
1111 CHECK_AND_INIT_STATIC_FIELD(int, EXPANDED_STATE_FULL, nodeInfoClass,
1112 "EXPANDED_STATE_FULL");
1113 }
1114
1115 CHECK_AND_INIT_STATIC_FIELD(int, ACTION_COLLAPSE, nodeInfoClass, "ACTION_COLLAPSE");
1116 CHECK_AND_INIT_STATIC_FIELD(int, ACTION_EXPAND, nodeInfoClass, "ACTION_EXPAND");
1117
1118 return true;
1119 }
1120}
1121
1122QT_END_NAMESPACE
static const char m_qtTag[]
#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE)
#define CHECK_AND_INIT_STATIC_FIELD(TYPE, VAR, CLASS, FIELD_NAME)
\inmodule QtCore\reentrant
Definition qpoint.h:30
static jboolean showOnScreen(JNIEnv *, jobject, jint objectId)
void notifyDescriptionOrNameChanged(uint accessibilityObjectId)
void notifyObjectShow(uint accessibilityObjectId)
static bool clickAction_helper(int objectId)
static const JNINativeMethod methods[]
void notifyLocationChange(uint accessibilityObjectId)
void runInObjectContext(QObject *context, Func &&func, Ret *retVal)
static jboolean scrollForward(JNIEnv *, jobject, jint objectId)
static ScrollEventInfo populateScrollEvent_helper(int objectId)
void notifyObjectFocus(uint accessibilityObjectId)
static jboolean scrollBackward(JNIEnv *, jobject, jint objectId)
static QString descriptionForInterface(QAccessibleInterface *iface)
static bool showOnScreen_helper(int objectId)
static int hitTest_helper(float x, float y)
static jboolean expand(JNIEnv *, jobject, jint objectId)
static jstring descriptionForAccessibleObject(JNIEnv *env, jobject, jint objectId)
static bool scroll_helper(int objectId, const QString &actionName)
static QString classNameForRole(QAccessible::Role role, QAccessible::State state)
static jmethodID m_setContentDescriptionMethodID
static QString textFromValue(QAccessibleInterface *iface)
void createAccessibilityContextObject(QObject *parent)
static QVarLengthArray< int, 8 > childIdListForAccessibleObject_helper(int objectId)
static NodeInfo populateNode_helper(int objectId)
void notifyObjectHide(uint accessibilityObjectId)
static jboolean focusAction(JNIEnv *, jobject, jint objectId)
static jmethodID m_setExpandedStateMethodID
static QString languageTag_helper(int objectId)
static jmethodID m_setVisibleToUserMethodID
static jint hitTest(JNIEnv *, jobject, jfloat x, jfloat y)
static jstring languageTag(JNIEnv *env, jobject, jint objectId)
static bool focusAction_helper(int objectId)
static jboolean clickAction(JNIEnv *, jobject, jint objectId)
static jstring jvalueForAccessibleObject(int objectId)
static void setActive(JNIEnv *, jobject, jboolean active)
static void invokeActionOnInterfaceInMainThread(QAccessibleActionInterface *actionInterface, const QString &action)
static jmethodID m_setTextSelectionMethodID
bool registerNatives(QJniEnvironment &env)
QAccessibleInterface * interfaceFromId(jint objectId)
void notifyValueChanged(uint accessibilityObjectId)
static jboolean populateScrollEvent(JNIEnv *env, jobject, jint objectId, jobject event)
static int expandedStateFromState(QAccessible::State state)
void notifyAnnouncementEvent(uint accessibilityObjectId, const QString &message)
static int parentId_helper(int objectId)
static QRect screenRect_helper(int objectId, bool clip=true)
static QString descriptionForAccessibleObject_helper(int objectId)
static jint parentId(JNIEnv *, jobject, jint objectId)
static jboolean collapse(JNIEnv *, jobject, jint objectId)
static jobject screenRect(JNIEnv *env, jobject, jint objectId)
static jintArray childIdListForAccessibleObject(JNIEnv *env, jobject, jint objectId)
static jboolean populateNode(JNIEnv *env, jobject, jint objectId, jobject node)
void notifyScrolledEvent(uint accessiblityObjectId)
QBasicMutex * platformInterfaceMutex()
QAndroidPlatformIntegration * androidPlatformIntegration()
#define qApp