public FillResponse BuildResponseForFocusedNode(string datasetName, FilledAutofillField field, FieldType fieldType) { FillResponse.Builder responseBuilder = new FillResponse.Builder(); RemoteViews remoteViews = RemoteViewsHelper.ViewsWithNoAuth( mPackageName, datasetName); Dataset dataset = mDatasetAdapter.BuildDatasetForFocusedNode(field, fieldType, remoteViews); if (dataset != null) { responseBuilder.AddDataset(dataset); return(responseBuilder.Build()); } return(null); }
/** * Wraps autofill data in a Response object (essentially a series of Datasets) which can then * be sent back to the client View. */ public FillResponse BuildResponse(Dictionary <string, FieldTypeWithHeuristics> fieldTypesByAutofillHint, List <DatasetWithFilledAutofillFields> datasets, bool datasetAuth) { FillResponse.Builder responseBuilder = new FillResponse.Builder(); if (datasets != null) { foreach (var datasetWithFilledAutofillFields in datasets) { if (datasetWithFilledAutofillFields != null) { Dataset dataset; String datasetName = datasetWithFilledAutofillFields.autofillDataset.GetDatasetName(); if (datasetAuth) { IntentSender intentSender = AuthActivity.GetAuthIntentSenderForDataset( mContext, datasetName); RemoteViews remoteViews = RemoteViewsHelper.ViewsWithAuth( mPackageName, datasetName); dataset = mDatasetAdapter.BuildDataset(fieldTypesByAutofillHint, datasetWithFilledAutofillFields, remoteViews, intentSender); } else { RemoteViews remoteViews = RemoteViewsHelper.ViewsWithNoAuth( mPackageName, datasetName); dataset = mDatasetAdapter.BuildDataset(fieldTypesByAutofillHint, datasetWithFilledAutofillFields, remoteViews); } if (dataset != null) { responseBuilder.AddDataset(dataset); } } } } int saveType = 0; AutofillId[] autofillIds = mClientViewMetadata.mFocusedIds; if (autofillIds != null && autofillIds.Length > 0) { SaveInfo saveInfo = new SaveInfo.Builder((SaveDataType)saveType, autofillIds).Build(); responseBuilder.SetSaveInfo(saveInfo); return(responseBuilder.Build()); } return(null); }