1

We have an app where we are asking for login and password inside a fragment. It used to work like a charm with autofill. The password manager worked great with it, autofilling passwords already entered by the user.

But recently, when selecting the user/password proposition by the password manager no fields are completed.

We did not find which change in android studio SDK triggered the problem (we are using Android Studio 4.1.3 / Build #AI-201.8743.12.41.7199119, built on March 11, 2021 / Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64 )

In the log we have the following hint:

AutofillManager: autofill(): no View with id xxxxxxxxxxxxx

2 times (apparently one for the login and one for the password).

We are stuck not knowing how to investigate the issue.

The layout for the form is as follow:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/loginConfigScreen"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">


    <TextView
            android:id="@+id/loginScreen__instructions_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/connect_label"/>


    <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_marginTop="50dp"
            android:layout_height="wrap_content">

        <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/usernameEdit"
                android:layout_width="match_parent"
                android:imeOptions="actionNext"
                android:singleLine="true"
                android:layout_height="wrap_content"
                android:hint="@string/user_hint"
                android:autofillHints="username"
                android:importantForAutofill="yes" />
    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/input_layout_password"
            android:layout_width="match_parent"
            android:layout_marginTop="20dp"
            app:passwordToggleEnabled="true"
            android:layout_height="wrap_content">

        <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/passwordEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:hint="@string/password_hint"
                android:autofillHints="password"
                android:importantForAutofill="yes" />
    </com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
Manuel Yguel
  • 198
  • 1
  • 9
  • 1
    We got a hint: we were recreating the fragment in the ```onResume()``` method, commenting the part that recreates the fragment makes the username and passwords be indeed filled in. So it looks like, now, after the autofillManager has made its job, a call to the onResume() method is made. It needs to be confirmed that it is a recent change. – Manuel Yguel Apr 21 '21 at 10:27
  • Can you share the Kotlin/Java code? – Priyansh Kedia Apr 21 '21 at 13:50

0 Answers0