json.put("idPackage", wrap(node.getIdPackage())); json.put("idType", wrap(node.getIdType())); json.put("inputType", wrap(node.getInputType())); json.put("left", wrap(node.getLeft())); json.put("longClickable", wrap(node.isLongClickable()));
.append("\tafOptions:").append(options == null ? "N/A" : Arrays.toString(options)) .append("\tafHints: ").append(afHints == null ? "N/A" : Arrays.toString(afHints)) .append("\tinputType:").append(node.getInputType()) .append('\n');
.append("\tafOptions:").append(options == null ? "N/A" : Arrays.toString(options)) .append("\tafHints: ").append(afHints == null ? "N/A" : Arrays.toString(afHints)) .append("\tinputType:").append(node.getInputType()) .append('\n');
private void parseViewNode(AssistStructure.ViewNode node) { String[] hints = node.getAutofillHints(); if (hints != null && hints.length > 0) { if (Arrays.stream(hints).anyMatch(View.AUTOFILL_HINT_USERNAME::equals)) result.username.add(node.getAutofillId()); else if (Arrays.stream(hints).anyMatch(View.AUTOFILL_HINT_EMAIL_ADDRESS::equals)) result.email.add(node.getAutofillId()); else if (Arrays.stream(hints).anyMatch(View.AUTOFILL_HINT_PASSWORD::equals)) result.password.add(node.getAutofillId()); else Log.d(TAG, "unsupported hints"); } else if (node.getAutofillType() == View.AUTOFILL_TYPE_TEXT) { int inputType = node.getInputType(); if ((inputType & InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) > 0) result.email.add(node.getAutofillId()); else if ((inputType & InputType.TYPE_TEXT_VARIATION_PASSWORD) > 0) result.password.add(node.getAutofillId()); else if (result.password.isEmpty()) usernameCandidate = node.getAutofillId(); } for (int i=0; i<node.getChildCount(); ++i) parseViewNode(node.getChildAt(i)); }