static bool populateNode(JNIEnv *env, jobject /*thiz*/, jint objectId, jobject node) { QAccessibleInterface *iface = interfaceFromId(objectId); if (!iface || !iface->isValid()) { __android_log_print(ANDROID_LOG_WARN, m_qtTag, "Accessibility: populateNode for Invalid ID"); return false; } QAccessible::State state = iface->state(); const QStringList actions = QAccessibleBridgeUtils::effectiveActionNames(iface); const bool hasClickableAction = actions.contains(QAccessibleActionInterface::pressAction()) || actions.contains(QAccessibleActionInterface::toggleAction()); const bool hasIncreaseAction = actions.contains(QAccessibleActionInterface::increaseAction()); const bool hasDecreaseAction = actions.contains(QAccessibleActionInterface::decreaseAction()); // try to fill in the text property, this is what the screen reader reads jstring jdesc = descriptionForAccessibleObject_helper(env, iface); if (QAccessibleTextInterface *textIface = iface->textInterface()) { if (m_setTextSelectionMethodID && textIface->selectionCount() > 0) { int startSelection; int endSelection; textIface->selection(0, &startSelection, &endSelection); env->CallVoidMethod(node, m_setTextSelectionMethodID, startSelection, endSelection); } } env->CallVoidMethod(node, m_setEnabledMethodID, !state.disabled); env->CallVoidMethod(node, m_setCheckableMethodID, (bool)state.checkable); env->CallVoidMethod(node, m_setCheckedMethodID, (bool)state.checked); env->CallVoidMethod(node, m_setFocusableMethodID, (bool)state.focusable); env->CallVoidMethod(node, m_setFocusedMethodID, (bool)state.focused); env->CallVoidMethod(node, m_setVisibleToUserMethodID, !state.invisible); env->CallVoidMethod(node, m_setScrollableMethodID, hasIncreaseAction || hasDecreaseAction); env->CallVoidMethod(node, m_setClickableMethodID, hasClickableAction); // Add ACTION_CLICK if (hasClickableAction) env->CallVoidMethod(node, m_addActionMethodID, (int)16); // ACTION_CLICK defined in AccessibilityNodeInfo // Add ACTION_SCROLL_FORWARD if (hasIncreaseAction) env->CallVoidMethod(node, m_addActionMethodID, (int)4096); // ACTION_SCROLL_FORWARD defined in AccessibilityNodeInfo // Add ACTION_SCROLL_BACKWARD if (hasDecreaseAction) env->CallVoidMethod(node, m_addActionMethodID, (int)8192); // ACTION_SCROLL_BACKWARD defined in AccessibilityNodeInfo //CALL_METHOD(node, "setText", "(Ljava/lang/CharSequence;)V", jdesc) env->CallVoidMethod(node, m_setContentDescriptionMethodID, jdesc); return true; }