private void AppendViewMetadata([NonNull] DatasetWithFilledAutofillFields

                                        datasetWithFilledAutofillFields, [NonNull] string[] hints, int partition,
                                        [Nullable] string textValue, [Nullable] long dateValue, [Nullable] bool toggleValue,
                                        [Nullable] string[] autofillOptions, [Nullable] int listIndex)
        {
            for (int i = 0; i < hints.Length; i++)
            {
                String hint = hints[i];
                // Then check if the "actual" hint is supported.
                FieldTypeWithHeuristics fieldTypeWithHeuristics = mFieldTypesByAutofillHint[hint];
                if (fieldTypeWithHeuristics != null)
                {
                    FieldType fieldType = fieldTypeWithHeuristics.fieldType;
                    if (!AutofillHints.MatchesPartition(fieldType.GetPartition(), partition))
                    {
                        continue;
                    }
                    // Only add the field if the hint is supported by the type.
                    if (textValue != null)
                    {
                        if (!fieldType.GetAutofillTypes().ints.Contains((int)AutofillType.Text))
                        {
                            Util.Loge("Text is invalid type for hint '%s'", hint);
                        }
                    }
                    if (autofillOptions != null && listIndex != null && autofillOptions.Length > listIndex)
                    {
                        if (!fieldType.GetAutofillTypes().ints.Contains((int)AutofillType.List))
                        {
                            Util.Loge("List is invalid type for hint '%s'", hint);
                        }
                        textValue = autofillOptions[listIndex];
                    }
                    if (dateValue != null)
                    {
                        if (!fieldType.GetAutofillTypes().ints.Contains((int)AutofillType.Date))
                        {
                            Util.Loge("Date is invalid type for hint '%s'", hint);
                        }
                    }
                    if (toggleValue != null)
                    {
                        if (!fieldType.GetAutofillTypes().ints.Contains((int)AutofillType.Toggle))
                        {
                            Util.Loge("Toggle is invalid type for hint '%s'", hint);
                        }
                    }
                    String datasetId = datasetWithFilledAutofillFields.autofillDataset.GetId();
                    datasetWithFilledAutofillFields.Add(new FilledAutofillField(datasetId,
                                                                                mPackageName, fieldType.GetTypeName(), textValue, dateValue, toggleValue));
                }
                else
                {
                    Util.Loge("Invalid hint: %s", hint);
                }
            }
        }
        private DatasetWithFilledAutofillFields BuildCollectionForPartition(
            AutofillDataset dataset, int partition)
        {
            DatasetWithFilledAutofillFields datasetWithFilledAutofillFields =
                new DatasetWithFilledAutofillFields();

            datasetWithFilledAutofillFields.autofillDataset = dataset;
            foreach (var fieldTypeWithHeuristics in mFieldTypesWithHints)
            {
                if (AutofillHints.MatchesPartition(
                        fieldTypeWithHeuristics.getFieldType().GetPartition(), partition))
                {
                    var fakeField = AutofillHints.generateFakeField(fieldTypeWithHeuristics, mPackageName,
                                                                    mSeed, dataset.GetId());
                    datasetWithFilledAutofillFields.Add(fakeField);
                }
            }
            return(datasetWithFilledAutofillFields);
        }