in AutofillFramework/afservice/src/main/java/com/example/android/autofill/service/simple/DebugService.java [227:253]
protected String inferHint(ViewNode node, @Nullable String actualHint) {
if (actualHint == null) return null;
String hint = actualHint.toLowerCase();
if (hint.contains("label") || hint.contains("container")) {
Log.v(TAG, "Ignoring 'label/container' hint: " + hint);
return null;
}
if (hint.contains("password")) return View.AUTOFILL_HINT_PASSWORD;
if (hint.contains("username")
|| (hint.contains("login") && hint.contains("id")))
return View.AUTOFILL_HINT_USERNAME;
if (hint.contains("email")) return View.AUTOFILL_HINT_EMAIL_ADDRESS;
if (hint.contains("name")) return View.AUTOFILL_HINT_NAME;
if (hint.contains("phone")) return View.AUTOFILL_HINT_PHONE;
// When everything else fails, return the full string - this is helpful to help app
// developers visualize when autofill is triggered when it shouldn't (for example, in a
// chat conversation window), so they can mark the root view of such activities with
// android:importantForAutofill=noExcludeDescendants
if (node.isEnabled() && node.getAutofillType() != View.AUTOFILL_TYPE_NONE) {
Log.v(TAG, "Falling back to " + actualHint);
return actualHint;
}
return null;
}