Because since Android 8.0 Oreo, Android supports autofill framework natively, and the input fields are considered as account credentials.
Android introduced autofill framework in Android 8.0 Oreo. It allows autofill services (e.g. Google Autofill, password managers, etc.) to save and automatically fill the data on autofill clients (e.g. Android apps) when needed.
To determine the type of the input, developers can rely on the autofill service's heuristics or explicitly give proper hints. One of the common autofill scenarios is account credentials, in which there are hints for:
- Username (
AUTOFILL_HINT_USERNAME
)
- Password (
AUTOFILL_HINT_PASSWORD
)
- New username (
AUTOFILL_HINT_NEW_USERNAME
)
- New password (
AUTOFILL_HINT_NEW_PASSWORD
)
When the autofill service detects these hints, it will prompt the user to save/fill the credentials.
P.S. the autofill service can be changed from the Android Settings by navigating to Settings > System > Language and input > Autofill service, or searching for "autofill".