public AutofillFieldMetadata(AssistStructure.ViewNode view) { mAutofillId = view.AutofillId; mAutofillType = view.AutofillType; mAutofillOptions = view.GetAutofillOptions(); mFocused = view.IsFocused; var hints = AutofillHints.FilterForSupportedHints(view.GetAutofillHints()); if (hints != null) { AutofillHints.ConvertToStoredHintNames(hints); SetHints(hints); } }
private void ParseLocked(bool forFill, AssistStructure.ViewNode viewNode, StringBuilder validWebDomain) { var webDomain = viewNode.WebDomain; if (webDomain != null) { if (CommonUtil.DEBUG) { Log.Debug(CommonUtil.TAG, "child web domain: " + webDomain); } if (validWebDomain.Length() > 0) { if (webDomain != validWebDomain.ToString()) { throw new SecurityException("Found multiple web domains: valid= " + validWebDomain + ", child=" + webDomain); } } else { validWebDomain.Append(webDomain); } } if (viewNode.GetAutofillHints() != null) { var filteredHints = AutofillHints.FilterForSupportedHints( viewNode.GetAutofillHints()); if (filteredHints != null && filteredHints.Length > 0) { if (forFill) { mAutofillFields.Add(new AutofillFieldMetadata(viewNode)); } else { var filledAutofillField = new FilledAutofillField(viewNode.GetAutofillHints()); AutofillValue autofillValue = viewNode.AutofillValue; if (autofillValue.IsText) { // Using toString of AutofillValue.getTextValue in order to save it to // SharedPreferences. filledAutofillField.SetTextValue(autofillValue.TextValue); } else if (autofillValue.IsDate) { filledAutofillField.SetDateValue(autofillValue.DateValue); } else if (autofillValue.IsList) { filledAutofillField.SetListValue(viewNode.GetAutofillOptions(), autofillValue.ListValue); } mFilledAutofillFieldCollection.Add(filledAutofillField); } } } int childrenSize = viewNode.ChildCount; if (childrenSize > 0) { for (int i = 0; i < childrenSize; i++) { ParseLocked(forFill, viewNode.GetChildAt(i), validWebDomain); } } }