private List <Dataset> BuildEntryDatasets(string query, string queryDomain, string queryPackage, AutofillId[] autofillIds, StructureParser parser, DisplayWarning warning) { List <Dataset> result = new List <Dataset>(); Kp2aLog.Log("AF: BuildEntryDatasets"); var suggestedEntries = GetSuggestedEntries(query).ToDictionary(e => e.DatasetName, e => e); Kp2aLog.Log("AF: BuildEntryDatasets found " + suggestedEntries.Count + " entries"); foreach (var filledAutofillFieldCollection in suggestedEntries.Values) { if (filledAutofillFieldCollection == null) { continue; } if (warning == DisplayWarning.None) { FilledAutofillFieldCollection partitionData = AutofillHintsHelper.FilterForPartition(filledAutofillFieldCollection, parser.AutofillFields.FocusedAutofillCanonicalHints); Kp2aLog.Log("AF: Add dataset"); result.Add(AutofillHelper.NewDataset(this, parser.AutofillFields, partitionData, IntentBuilder)); } else { //return an "auth" dataset (actually for just warning the user in case domain/package dont match) var sender = IntentBuilder.GetAuthIntentSenderForWarning(this, query, queryDomain, queryPackage, warning); var datasetName = filledAutofillFieldCollection.DatasetName; if (datasetName == null) { Kp2aLog.Log("AF: dataset name is null"); continue; } RemoteViews presentation = AutofillHelper.NewRemoteViews(PackageName, datasetName, AppNames.LauncherIcon); var datasetBuilder = new Dataset.Builder(presentation); datasetBuilder.SetAuthentication(sender); //need to add placeholders so we can directly fill after ChooseActivity foreach (var autofillId in autofillIds) { datasetBuilder.SetValue(autofillId, AutofillValue.ForText("PLACEHOLDER")); } Kp2aLog.Log("AF: Add auth dataset"); result.Add(datasetBuilder.Build()); } } return(result); }
private Dataset AddEntryDataset(string query, StructureParser parser) { var filledAutofillFieldCollection = GetSuggestedEntry(query); if (filledAutofillFieldCollection == null) { return(null); } int partitionIndex = AutofillHintsHelper.GetPartitionIndex(parser.AutofillFields.FocusedAutofillCanonicalHints.FirstOrDefault()); FilledAutofillFieldCollection partitionData = AutofillHintsHelper.FilterForPartition(filledAutofillFieldCollection, partitionIndex); return(AutofillHelper.NewDataset(this, parser.AutofillFields, partitionData, IntentBuilder)); }
protected void OnSuccess(FilledAutofillFieldCollection clientFormDataMap, bool isManual) { var intent = Intent; AssistStructure structure = (AssistStructure)intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure); StructureParser parser = new StructureParser(this, structure); parser.ParseForFill(isManual); AutofillFieldMetadataCollection autofillFields = parser.AutofillFields; int partitionIndex = AutofillHintsHelper.GetPartitionIndex(autofillFields.FocusedAutofillCanonicalHints.FirstOrDefault()); FilledAutofillFieldCollection partitionData = AutofillHintsHelper.FilterForPartition(clientFormDataMap, partitionIndex); ReplyIntent = new Intent(); SetDatasetIntent(AutofillHelper.NewDataset(this, autofillFields, partitionData, IntentBuilder)); }
protected void OnSuccess(FilledAutofillFieldCollection clientFormDataMap, bool isManual) { var intent = Intent; AssistStructure structure = (AssistStructure)intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure); StructureParser parser = new StructureParser(this, structure); parser.ParseForFill(isManual); AutofillFieldMetadataCollection autofillFields = parser.AutofillFields; var partitionData = AutofillHintsHelper.FilterForPartition(clientFormDataMap, parser.AutofillFields.FocusedAutofillCanonicalHints); ReplyIntent = new Intent(); SetDatasetIntent(AutofillHelper.NewDataset(this, autofillFields, partitionData, IntentBuilder, null /*TODO can we get the inlinePresentationSpec here?*/)); SetResult(Result.Ok, ReplyIntent); }
private Dataset BuildEntryDataset(string query, string queryDomain, string queryPackage, AutofillId[] autofillIds, StructureParser parser, DisplayWarning warning) { var filledAutofillFieldCollection = GetSuggestedEntry(query); if (filledAutofillFieldCollection == null) { return(null); } if (warning == DisplayWarning.None) { //can return an actual dataset int partitionIndex = AutofillHintsHelper.GetPartitionIndex(parser.AutofillFields.FocusedAutofillCanonicalHints.FirstOrDefault()); FilledAutofillFieldCollection partitionData = AutofillHintsHelper.FilterForPartition(filledAutofillFieldCollection, partitionIndex); return(AutofillHelper.NewDataset(this, parser.AutofillFields, partitionData, IntentBuilder)); } else { //return an "auth" dataset (actually for just warning the user in case domain/package dont match) var sender = IntentBuilder.GetAuthIntentSenderForWarning(this, query, queryDomain, queryPackage, warning); var datasetName = filledAutofillFieldCollection.DatasetName; if (datasetName == null) { return(null); } RemoteViews presentation = AutofillHelper.NewRemoteViews(PackageName, datasetName, AppNames.LauncherIcon); var datasetBuilder = new Dataset.Builder(presentation); datasetBuilder.SetAuthentication(sender); //need to add placeholders so we can directly fill after ChooseActivity foreach (var autofillId in autofillIds) { datasetBuilder.SetValue(autofillId, AutofillValue.ForText("PLACEHOLDER")); } return(datasetBuilder.Build()); } }