Android 自动填充建议类似于 Google Chrome 的新密码

Android autofill suggest new password similar to Google Chrome

我有一个简单的创建帐户屏幕,如图所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:importantForAutofill="yes"
    android:orientation="vertical">

    <com.google.android.material.textfield.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:autofillHints="username"
        android:hint="email"
        android:inputType="textEmailAddress">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:autofillHints="password"
        android:hint="Create a password"
        android:inputType="textPassword">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:autofillHints="password"
        android:hint="Re-enter password"
        android:inputType="textPassword">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </com.google.android.material.textfield.TextInputLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Login" />

</LinearLayout>

当我 select 电子邮件字段时,google 自动填充服务建议填写一个电子邮件地址。有没有办法触发密码管理器建议一个新的安全密码?我在 Google Chrome 中看到了这种行为,本机 android 应用程序是否提供此功能?

自己花了很多时间寻找这个,显然这是 chrome 上的自定义功能(来源:android police

手指交叉 Google 的 androidx.autofill 团队