AssistStructure.WindowNode node=assistStructure.getWindowNodeAt(i); AutofillId temp=collectViewIds(node.getRootViewNode(), ids);
protected JSONObject dumpStructureWindow( AssistStructure.WindowNode window, JSONObject json) throws JSONException { json.put("displayId", wrap(window.getDisplayId())); json.put("height", wrap(window.getHeight())); json.put("left", wrap(window.getLeft())); json.put("title", wrap(window.getTitle())); json.put("top", wrap(window.getTop())); json.put("width", wrap(window.getWidth())); json.put("root", dumpStructureNode(window.getRootViewNode(), new JSONObject())); return(json); }
/** * Parses the {@link AssistStructure} representing the activity being autofilled, and returns a * map of autofillable fields (represented by their autofill ids) mapped by the hint associate * with them. * * <p>An autofillable field is a {@link ViewNode} whose {@link #getHint(ViewNode)} metho */ @NonNull private ArrayMap<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) { ArrayMap<String, AutofillId> fields = new ArrayMap<>(); int nodes = structure.getWindowNodeCount(); for (int i = 0; i < nodes; i++) { ViewNode node = structure.getWindowNodeAt(i).getRootViewNode(); addAutofillableFields(fields, node); } return fields; }
/** * Parses the {@link AssistStructure} representing the activity being autofilled, and returns a * map of autofillable fields (represented by their autofill ids) mapped by the hint associate * with them. * * <p>An autofillable field is a {@link ViewNode} whose {@link #getHint(ViewNode)} metho */ @NonNull private Map<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) { Map<String, AutofillId> fields = new ArrayMap<>(); int nodes = structure.getWindowNodeCount(); for (int i = 0; i < nodes; i++) { ViewNode node = structure.getWindowNodeAt(i).getRootViewNode(); addAutofillableFields(fields, node); } return fields; }
Result parse() { result = new Result(); usernameCandidate = null; for (int i=0; i<structure.getWindowNodeCount(); ++i) { AssistStructure.WindowNode windowNode = structure.getWindowNodeAt(i); result.title.add(windowNode.getTitle()); result.webDomain.add(windowNode.getRootViewNode().getWebDomain()); parseViewNode(windowNode.getRootViewNode()); } // If not explicit username field found, add the field just before password field. if (result.username.isEmpty() && result.email.isEmpty() && !result.password.isEmpty() && usernameCandidate != null) result.username.add(usernameCandidate); return result; }
/** * Gets a node if it matches the filter criteria for the given id. */ public static ViewNode findNodeByFilter(@NonNull AssistStructure structure, @NonNull Object id, @NonNull NodeFilter filter) { logv("Parsing request for activity %s", structure.getActivityComponent()); final int nodes = structure.getWindowNodeCount(); for (int i = 0; i < nodes; i++) { final WindowNode windowNode = structure.getWindowNodeAt(i); final ViewNode rootNode = windowNode.getRootViewNode(); final ViewNode node = findNodeByFilter(rootNode, id, filter); if (node != null) { return node; } } return null; }
/** * Traverses through the {@link AssistStructure} and does something at each {@link ViewNode}. * * @param processor contains action to be performed on each {@link ViewNode}. */ public void parse(NodeProcessor processor) { for (AssistStructure structure : mStructures) { int nodes = structure.getWindowNodeCount(); for (int i = 0; i < nodes; i++) { AssistStructure.ViewNode viewNode = structure.getWindowNodeAt(i).getRootViewNode(); traverseRoot(viewNode, processor); } } }
public static void dumpStructure(AssistStructure structure) { int nodeCount = structure.getWindowNodeCount(); Log.v(TAG, "dumpStructure(): component=" + structure.getActivityComponent() + " numberNodes=" + nodeCount); for (int i = 0; i < nodeCount; i++) { Log.v(TAG, "node #" + i); WindowNode node = structure.getWindowNodeAt(i); dumpNode(" ", node.getRootViewNode()); } }
@NonNull private ArrayMap<String, AutofillId> getAutofillableFields(@NonNull AssistStructure structure) { ArrayMap<String, AutofillId> fields = new ArrayMap<>(); int nodes = structure.getWindowNodeCount(); for (int i = 0; i < nodes; i++) { ViewNode node = structure.getWindowNodeAt(i).getRootViewNode(); addAutofillableFields(fields, node); } return fields; }
public static void dumpStructure(AssistStructure structure) { if (logVerboseEnabled()) { int nodeCount = structure.getWindowNodeCount(); logv("dumpStructure(): component=%s numberNodes=%d", structure.getActivityComponent(), nodeCount); for (int i = 0; i < nodeCount; i++) { logv("node #%d", i); WindowNode node = structure.getWindowNodeAt(i); dumpNode(new StringBuilder(), " ", node.getRootViewNode(), 0); } } }
private JSONObject dumpStructureWindow( AssistStructure.WindowNode window, JSONObject json) throws JSONException { json.put("displayId", wrap(window.getDisplayId())); json.put("height", wrap(window.getHeight())); json.put("left", wrap(window.getLeft())); json.put("title", wrap(window.getTitle())); json.put("top", wrap(window.getTop())); json.put("width", wrap(window.getWidth())); json.put("root", dumpStructureNode(window.getRootViewNode(), new JSONObject())); return (json); }