Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Autofill from saved credentials doesn't work #137760

Open
2 tasks done
TatsuUkraine opened this issue Nov 2, 2023 · 52 comments
Open
2 tasks done

[Android] Autofill from saved credentials doesn't work #137760

TatsuUkraine opened this issue Nov 2, 2023 · 52 comments
Labels
a: text input Entering text in a text field or keyboard related problems customer: crowd Affects or could affect many people, though not necessarily a specific customer. found in release: 3.13 Found to occur in 3.13 found in release: 3.16 Found to occur in 3.16 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team

Comments

@TatsuUkraine
Copy link

TatsuUkraine commented Nov 2, 2023

Is there an existing issue for this?

Steps to reproduce

  1. Create a form with username and password field
  2. Try to use password manager such as Google Password Manager
  3. Ensure that password usage requires biometric auth (not sure if it changes anything)
  4. Click in Key icon on keyboard and select password

Device for testing

Google Pixel 7 pro, Android 14 (34)

Expected results

Form prepopulates with the selected username/password combination

Actual results

Input loses focus and nothing happens.

Form can be prepopulated only if login/password combination is selected from Keyboard quick actions and no biometric check is requested

Code sample

Code sample (very simple autofillgroup with 2 inputs)
           AutofillGroup(
              child: Column(
                children: [
                  TextField(
                    autofillHints: [AutofillHints.username],
                  ),
                  TextField(
                    autofillHints: [AutofillHints.password],
                  ),
                ],
              ),
            ),

Screenshots or Video

Video
screen-20231103-102820.2.mp4

Logs

Logs
[+1656 ms] I/ImeTracker(29289): com.example.flutter_three_thirteen:355d8ebd: onRequestShow at ORIGIN_CLIENT_SHOW_SOFT_INPUT reason SHOW_SOFT_INPUT
[        ] D/InputMethodManager(29289): showSoftInput() view=io.flutter.embedding.android.FlutterView{5267c32 VFE...... .F...... 0,0-1440,3036 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
[  +21 ms] D/InputConnectionAdaptor(29289): The input method toggled cursor monitoring on
[  +43 ms] D/InsetsController(29289): show(ime(), fromIme=true)
[ +298 ms] I/ImeTracker(29289): com.example.flutter_three_thirteen:355d8ebd: onShown
[+1871 ms] D/InputConnectionAdaptor(29289): The input method toggled cursor monitoring off
[        ] W/WindowOnBackDispatcher(29289): sendCancelIfRunning: isInProgress=falsecallback=ImeCallback=ImeOnBackInvokedCallback@122401794 Callback=android.window.IOnBackInvokedCallback$Stub$Proxy@dd07025
[        ] I/ImeTracker(29289): com.google.android.gms:418f75e2: onCancelled at PHASE_CLIENT_ANIMATION_CANCEL
[   +9 ms] I/ImeTracker(29289): com.example.flutter_three_thirteen:f278d0eb: onRequestHide at ORIGIN_CLIENT_HIDE_SOFT_INPUT reason HIDE_SOFT_INPUT_BY_INSETS_API
[        ] I/ImeTracker(29289): com.example.flutter_three_thirteen:f278d0eb: onFailed at PHASE_CLIENT_VIEW_SERVED

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.9, on macOS 13.5.2 22G91 darwin-arm64, locale ru)
    • Flutter version 3.13.9 on channel stable at /Users/tatsu/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (8 days ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at ****
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = ****
    • Java binary at: ****
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.13.0

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Connected device (4 available)


[✓] Network resources
    • All expected network resources are available.
@dam-ease dam-ease added the in triage Presently being triaged by the triage team label Nov 2, 2023
@dam-ease
Copy link

dam-ease commented Nov 2, 2023

Hi @TatsuUkraine. When you setup details, have you also set those up in the system "autofill service" settings and provide relevant information to the autofill service for it to work ?

@TatsuUkraine
Copy link
Author

@dam-ease sorry, not sure that I understood the question( for this example I didn't do any native configuration for Android, basically this issue appears only when app looses focus either because of biometric auth or because you go into the password manager. If biometric auth is not requested, and you using password suggestions from the keyboard quick action - all works fine

@dam-ease dam-ease added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 2, 2023
@TatsuUkraine
Copy link
Author

@dam-ease I already replied😅

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 2, 2023
@TatsuUkraine
Copy link
Author

TatsuUkraine commented Nov 3, 2023

@dam-ease I added video to the description to better explain what is going on. On a video when screen goes black - it asks for biometric verification. On a video there are 3 attempts:

  1. Using Key icon to go to the password manager.
  2. Using quick action with biometric verification
  3. Using quick action without biometric verification

Autofill works only when app doesn't go to background (3rd try)

@dam-ease
Copy link

dam-ease commented Nov 3, 2023

I guess the time you replied and the time the label updated were the same.
We can reproduce the issue when clicking on Key icon > select saved account (without needing biometric verification). We tested with a Realme 6, Android 11.
Can you confirm again if you also can see the issue when removing biometric verification or not?

Screen.Recording.2023-11-03.at.17.55.12.mov

@dam-ease dam-ease added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 3, 2023
@TatsuUkraine
Copy link
Author

TatsuUkraine commented Nov 3, 2023

It seems biometric verification doesn't affect behavior a lot. If I disable biometric check for password usages only one difference is that there is no scenario 2 (from my prev comment). So it seems autofill just stops working when the app goes to background and the text field loses focus, either because of password manager bottom sheet or because of biometric check

screen-20231103-160500.2.mp4

Also, one note, I'm not entirely sure, since I didn't check this explicitly, but I think all was working in prev stable release

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 3, 2023
@dam-ease dam-ease added a: text input Entering text in a text field or keyboard related problems platform-android Android applications specifically framework flutter/packages/flutter repository. See also f: labels. team-android Owned by Android platform team found in release: 3.13 Found to occur in 3.13 found in release: 3.16 Found to occur in 3.16 has reproducible steps The issue has been confirmed reproducible and is ready to work on and removed in triage Presently being triaged by the triage team labels Nov 6, 2023
@camsim99 camsim99 added P2 Important issues not at the top of the work list triaged-android Triaged by Android platform team labels Nov 9, 2023
@davidpryor
Copy link

davidpryor commented Nov 20, 2023

I am seeing this same behavior while using 1password.
When required to first unlock the manager AND/OR attempting to fill the password from the "open 1password" option, the fields will not fill.

Once the manager is unlocked, 1password can fill as expected from the small "account choosing" modal, but still cannot fill from the "open 1password" option.

It seems this happens any time my app is pushed to the background by the password manager.

IF I force the focusNode for the username field to never loose focus by requesting focus when the focusNode is not in focus, it will autofill. It seems like the password manager does not/cannot regain focus on the textfield before it attempts to push the username/password text.

➜ flutter doctor -v
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale en-US)
    • Flutter version 3.13.9 on channel stable at /opt/homebrew/Caskroom/flutter/3.13.9/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (4 weeks ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/****/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.84.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0
    
[✓] Network resources
    • All expected network resources are available.

• No issues found!

Edit:
Attaching a video from a sample app.
The black screen is the 1password biometric auth popup, then the login selector.

Screen_Recording_20231120_152145.mp4

@AhmadHusein5853
Copy link

I started to notice this issue once my device got Android 14 update. on Android 13 it was working fine.

@adonisRodxander
Copy link

UPDATE: On version 3.22.0 works fine

@LongCatIsLooong
Copy link
Contributor

Looks like the first bad commit is 04e284a. The issue went away when the commit was reverted.

@catalunha

This comment was marked as off-topic.

@gnprice

This comment was marked as off-topic.

@gnprice
Copy link
Member

gnprice commented May 31, 2024

Looks like the first bad commit is 04e284a. The issue went away when the commit was reverted.

To unpack this a bit:
Commit 04e284a was an engine roll, pulling in flutter/engine@c97a0deccbc1.

That engine commit was reverted in flutter/engine@500ae6c.

That revert rolled into flutter/flutter in commit d35c08e, which was part of Flutter 3.22.0 but not 3.19.6 (the previous release).

@udaychandra
Copy link

We're facing the same issue with password autofill.

Using Flutter 3.22.1

@TatsuUkraine
Copy link
Author

TatsuUkraine commented Jun 3, 2024

All works fine for me on Android after update to 3.22.1. Fields aren't loosing focus during biometric verification in password manager. Login and password prefilled correctly in the form

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 3, 2024
@github-actions github-actions bot reopened this Jun 3, 2024
@TatsuUkraine
Copy link
Author

@LongCatIsLooong I don't know why bot reopened the issue, sorry 😅

@AristideVB
Copy link

@LongCatIsLooong I don't know why bot reopened the issue, sorry 😅

Might be a sign ! 😄 On Android Username is not saved to Google Password Manager for me, only suggested password

While on iOS existing password autofill does not fill the fields anymore (but I will investigate and open an issue)

@zigapovhe
Copy link

Jup, works for me on android, but I still have the same old issues on iOS build

@alarkirikal
Copy link

We are still running the exact same issue on iOS running Flutter 3.22.2. I noticed that after returning to the app, the username/password fields are unfocused. As soon as I manually tap on them to regain focus, the autofill values from the password manager (1Password in my case) are entered correctly. Thus this feels like the issue as explained above, where the fields losing focus on the app being sent to the background being the issue.

@TatsuUkraine
Copy link
Author

TatsuUkraine commented Jun 17, 2024

@alarkirikal There is an ongoing issue for iOS autofill.
#148475

Based on discussion looks like it will be fixed in the next stable release

@alarkirikal
Copy link

@alarkirikal There is an ongoing issue for iOS autofill. #148475

Based on discussion looks like it will be fixed in the next stable release

Just a bit later found that issue as well - wasn't that obvious to find at first glance due to its Closed status. But thank you for confirming.

Copy link

github-actions bot commented Jul 1, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2024
@AnnaPS
Copy link

AnnaPS commented Sep 24, 2024

Hi, is there any update on this? I can reproduce the issue using the example code on Flutter version 3.24.3. I tried the workaround and it works perfectly (android), but I also see some people saying that on version 3.22.1 it works now, but not for me (I also tried with this specific version). Thanks

@Anfet
Copy link

Anfet commented Jan 15, 2025

Google Password Manager autofill generates this error on password save:

`
2025-01-15 19:08:51.600 12950-12950 ChromesyncPasswordDataS com.google.android.gms.persistent E Saving or updating passwords failed [CONTEXT service_id=177 ]
java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:781)
at java.util.TimSort.mergeAt(TimSort.java:518)
at java.util.TimSort.mergeCollapse(TimSort.java:448)
at java.util.TimSort.sort(TimSort.java:245)
at java.util.Arrays.sort(Arrays.java:1351)
at fcou.R(:com.google.android.gms@[email protected] (190400-713002902):12)
at fcos.n(:com.google.android.gms@[email protected] (190400-713002902):7)
at admk.b(:com.google.android.gms@[email protected] (190400-713002902):77)
at dagger.producers.internal.AbstractProducesMethodProducer.a(:com.google.android.gms@[email protected] (190400-713002902):6)
at fhse.d(:com.google.android.gms@[email protected] (190400-713002902):3)
at fhsg.run(:com.google.android.gms@[email protected] (190400-713002902):38)
at apvb.c(:com.google.android.gms@[email protected] (190400-713002902):50)
at apvb.run(:com.google.android.gms@[email protected] (190400-713002902):76)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at aqam.run(:com.google.android.gms@[email protected] (190400-713002902):8)
at java.lang.Thread.run(Thread.java:1012)

`

@pogorv12
Copy link

Hi! I have the same issue on the web app.

@tototo23
Copy link

Hi! I have the same issue on the web app.

Hi, are you using Windows Hello to protect the credentials on Chrome ?
If yes, it is probably the same issue i created here : #162066

@pogorv12
Copy link

pogorv12 commented Jan 26, 2025

Hi! I have the same issue on the web app.

Hi, are you using Windows Hello to protect the credentials on Chrome ? If yes, it is probably the same issue i created here : #162066
Hello tototo! Thanks for reply!

No. I don't.

Actually my comment is related to password manager in chrome on Android that has exactly the same behaviour as described in the ticket description.

Chrome for desktop, safary on iphone works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems customer: crowd Affects or could affect many people, though not necessarily a specific customer. found in release: 3.13 Found to occur in 3.13 found in release: 3.16 Found to occur in 3.16 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team
Projects
None yet
Development

No branches or pull requests