in AutofillFramework/afservice/src/main/java/com/example/android/autofill/service/AutofillHints.java [48:70]
public static FilledAutofillField generateFakeField(
FieldTypeWithHeuristics fieldTypeWithHeuristics, String packageName, int seed,
String datasetId) {
FakeData fakeData = fieldTypeWithHeuristics.fieldType.getFakeData();
String fieldTypeName = fieldTypeWithHeuristics.fieldType.getTypeName();
String text = null;
Long date = null;
Boolean toggle = null;
if (fakeData.strictExampleSet != null && fakeData.strictExampleSet.strings != null &&
fakeData.strictExampleSet.strings.size() > 0 &&
!fakeData.strictExampleSet.strings.get(0).isEmpty()) {
List<String> choices = fakeData.strictExampleSet.strings;
text = choices.get(seed % choices.size());
} else if (fakeData.textTemplate != null) {
text = fakeData.textTemplate.replace("seed", "" + seed)
.replace("curr_time", "" + Calendar.getInstance().getTimeInMillis());
} else if (fakeData.dateTemplate != null) {
if (fakeData.dateTemplate.contains("curr_time")) {
date = Calendar.getInstance().getTimeInMillis();
}
}
return new FilledAutofillField(datasetId, fieldTypeName, text, date, toggle);
}