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 doesn't work #547

Closed
kdrag0n opened this issue May 6, 2020 · 35 comments
Closed

Android autofill doesn't work #547

kdrag0n opened this issue May 6, 2020 · 35 comments

Comments

@kdrag0n
Copy link

kdrag0n commented May 6, 2020

Bromite version

Version: 81.0.4044.106.1586736791
Arch: arm64
Android version: 10
Device model: Pixel 2 XL

Is this bug about the SystemWebView?

No

Is the bug reproducible with latest version?

Yes

Can the bug be reproduced with corresponding Chromium version?

Yes

Describe the bug

According to #348, Bromite should support Android's autofill framework, but it doesn't work on any of my devices. I've tried Bitwarden and 1Password password managers, and none of them detect any login fields in Bromite, while they work with all the other browsers I've tried. Chrome and Firefox Preview have been verified to work.

Steps to reproduce the bug

  1. Enable autofill in any password manager (not using accessibility)
  2. Go to any website with a login field (e.g. https://github.com/login)
  3. Focus the username/email or password field
  4. Notice how no popup appears

Expected behavior

Autofill popup appears under the login field.

Screenshots

Not working in Bromite:
image

Working in Firefox Preview:
image

Working in Chrome:
image

@csagan5
Copy link
Contributor

csagan5 commented May 6, 2020

Working in Chrome:

You should test with the corresponding Chromium version, no other browser/version matters.

When testing with Chromium a popup will appear asking you to login to your Google account. That is why this feature is not supported.

  1. Enable autofill in any password manager (not using accessibility)

The native autofill manager needs some Google Play Services integration which is disabled in Bromite because it would require building with a proprietary binary and integrating with some service. We are staying away from those as much as possible.

@csagan5 csagan5 closed this as completed May 6, 2020
@kdrag0n
Copy link
Author

kdrag0n commented May 6, 2020

It doesn't work in Bromite's build of Chromium. There are no popups at all, not even a Google account popup.

Android autofill does not have anything to do with Google Play Services. I just tested two random apps from the official F-Droid repo (CloudMare and FairEmail) that have no integration with Play Services, and autofill works perfectly in both of them.

@kdrag0n
Copy link
Author

kdrag0n commented May 11, 2020

@csagan5 could this issue be re-opened? As I said above, Android autofill does not have anything to do with Google Play Services. In my testing, several randomly sampled apps from the official F-Droid repository all have working autofill. The F-Droid repo prohibits apps with Google Play Services, so there can't be a correlation there.

I just tested autofill with some more Chromium-based browsers. Vanilla trunk builds of Chromium from Download Chromium are also broken, but Brave is not, so I suspect that Bromite needs to change something when building Chromium to make it work.

@csagan5
Copy link
Contributor

csagan5 commented May 12, 2020

@kdrag0n those apps you tested are not browsers, Chromium variants have a different integration for the autofill feature. Brave uses Google Play Services integrations.

I have tested this already in the past (you have not), it cannot work without enabling the Play Services blob. Feel free to make your own build and verify it yourself.

@csagan5
Copy link
Contributor

csagan5 commented Jun 2, 2020

See also:

The upstream issue seems to be https://bugs.chromium.org/p/chromium/issues/detail?id=1015381

@PeterHindes
Copy link

could someone make a diff patch. i would like to use it with the integration anyway. ill just run my own builds with a patch.

@Socalix
Copy link

Socalix commented Sep 7, 2021

A solution is here!
I just tried adding Bromite to the autofill_compat_mode_allowed_packages as indicated by Kiwibrowser here: kiwibrowser/src.next#64 (comment)

With this command:
adb shell settings put global autofill_compat_mode_allowed_packages "$(adb shell settings get global autofill_compat_mode_allowed_packages):org.bromite.bromite[url_bar]"

After restarting (must) Bromite - autofill password managers work great!
Just for curiosity, I tried removing Chrome from this setting and autofill no longer works in Chrome. 😄

@csagan5 I see Kiwibrowser is trying to get on the default list, do you think Bromite could get on it too?

@csagan5
Copy link
Contributor

csagan5 commented Sep 9, 2021

@Socalix that sounds very interesting, thanks for reporting back; so this would work even without using the Play Store integration, just by making sure that vanilla Android contains Bromite's package name?

I think it would be hard to convince Android developers to add Bromite, but we could try. Meanwhile the workaround could be mentioned in the FAQs.

@Socalix
Copy link

Socalix commented Sep 9, 2021

@csagan5 Yes, it works as soon as you set this value and restart the browser. My understanding is that it triggers some translation layer between accessibility and autofill API. It will be interesting to know who/what/where decides to put those values there. Brave browser managed to get on that list, so I don't see a reason why others would not.

The tricky part with manually setting it, is that there's something that keeps resetting the value, so it doesn't stay there for more than a few hours. :(

@plantroon
Copy link

@csagan5 Yes, it works as soon as you set this value and restart the browser. My understanding is that it triggers some translation layer between accessibility and autofill API. It will be interesting to know who/what/where decides to put those values there. Brave browser managed to get on that list, so I don't see a reason why others would not.

The tricky part with manually setting it, is that there's something that keeps resetting the value, so it doesn't stay there for more than a few hours. :(

I found that it resets itself at 22:30 (CEST) for me. I did not figure out what mechanism is resetting it either.

@kdrag0n
Copy link
Author

kdrag0n commented Sep 15, 2021

There's no default value for the autofill_compat_mode_allowed_packages setting in AOSP; the url_bar values come from Google Play Services, which provisions and overwrites settings periodically. The best solution I can think of (assuming you're not using a custom ROM, where it would be possible to add a hacky override to the system) is restoring the settings periodically using an app like Tasker.

Of course, the ideal solution would be to get Bromite added to Google's list, but I can't see that happening because it's not on the Play Store.

@lippling
Copy link

lippling commented Oct 1, 2021

A solution is here! I just tried adding Bromite to the autofill_compat_mode_allowed_packages as indicated by Kiwibrowser here: kiwibrowser/src.next#64 (comment)

With this command: adb shell settings put global autofill_compat_mode_allowed_packages "$(adb shell settings get global autofill_compat_mode_allowed_packages):org.bromite.bromite[url_bar]"

After restarting (must) Bromite - autofill password managers work great! Just for curiosity, I tried removing Chrome from this setting and autofill no longer works in Chrome. 😄

@csagan5 I see Kiwibrowser is trying to get on the default list, do you think Bromite could get on it too?

I use GrapheneOS and the workaround does not work for me.

@famo
Copy link

famo commented Oct 2, 2021

There's no default value for the autofill_compat_mode_allowed_packages setting in AOSP; the url_bar values come from Google Play Services, which provisions and overwrites settings periodically.

What about ROMs without GPS, but microG? I assume microG could theoretically set this value?

The best solution I can think of (assuming you're not using a custom ROM, where it would be possible to add a hacky override to the system) is restoring the settings periodically using an app like Tasker.

For this to work one still needs root access, which really limits the scope of that solution..

Of course, the ideal solution would be to get Bromite added to Google's list, but I can't see that happening because it's not on the Play Store.

See above, would it be useful to open an feature request on mircoG, @kdrag0n ?
Ideally microG could implement a setting where a user can choose apps to add the the autofill_compat_mode_allowed_packages list.
This way at least some systems would work...

Btw, this still wouldn't enable native autofill, but rather the compatibility mode (see autofill-services), so further progress on this might should be tracked in an another issue.

@csagan5

The upstream issue seems to be https://bugs.chromium.org/p/chromium/issues/detail?id=1015381

This issue is resolved by now, does it help for native autofill in bromite?

@csagan5
Copy link
Contributor

csagan5 commented Oct 7, 2021

Btw, this still wouldn't enable native autofill, but rather the compatibility mode (see autofill-services), so further progress on this might should be tracked in an another issue.

@csagan5

It is unclear to me what needs to be changed in Bromite, so not sure what the new issue would contain.

@uazo
Copy link
Collaborator

uazo commented Oct 23, 2021

so, as I was curious I checked.

then, there are 2 different types of autofill, the one managed by gcm and the native android one that uses the provider assigned by the user (which can be bitwarden or lastpass for example).
in chromium the first is active, in the webview the second.
so I took the webview code and brought it to chromium managing to activate the process, but not to finish it because my executable is called org.chromium.chrome.stable and is not part of the list in bitwarden.

@csagan5 would you please tell me how to change the process name? I could go and see how it's done but surely you already know.

if this works we could activate native autofill support and eliminate support for accessibility, which is very intrusive on privacy. I have seen that basically EVERYTHING the user does (click, focus, etc ..) of ALL the views (ie, even the internal chromium one, such as the settings) is granted to the accessibility provider.

@csagan5
Copy link
Contributor

csagan5 commented Oct 24, 2021

@csagan5 would you please tell me how to change the process name? I could go and see how it's done but surely you already know.

The easiest is to change the package name in chrome/android/BUILD.gn

if this works we could activate native autofill support and eliminate support for accessibility, which is very intrusive on privacy. I have seen that basically EVERYTHING the user does (click, focus, etc ..) of ALL the views (ie, even the internal chromium one, such as the settings) is granted to the accessibility provider.

Native autofill support: yes, that would be great! And IIRC it was present in Chromium and then was removed in favor of the GCM one.
Eliminate support for accessibility: that would be great as well...except if you think about what "accessibility" means: https://www.w3.org/WAI/
It is supposed to be there for people with disabilities and not for invading user privacy; perhaps it should be behind a flag so that only who really needs it will enable it.

@uazo
Copy link
Collaborator

uazo commented Oct 24, 2021

The easiest is to change the package name in chrome/android/BUILD.gn

Certain! Thanks.

so he replies, but it still doesn't work:

10-24 09:01:46.340  1912  3033 D AutofillManagerServiceImpl: restarting session 755099325 due to manual request on 0:65536
10-24 09:01:46.341  5634  5634 D AutofillManager: Session restarted: 755099325=>-566142474
10-24 09:01:46.409  5634  5634 I AssistStructure: Flattened final assist data: 25080 bytes, containing 2 windows, 114 views
10-24 09:01:46.437  1912  2011 I AssistStructure: Flattened final assist data: 24716 bytes, containing 2 windows, 114 views

who knows why, it should be verified better, perhaps with the help of the bitwarden team, at least to ask them if there is any of their logs to check.
EDIT: maybe I understand .. I'll try

Native autofill support: yes, that would be great! And IIRC it was present in Chromium and then was removed in favor of the GCM one.

here the patch in the works, if anyone wants to contribute.

perhaps it should be behind a flag so that only who really needs it will enable it.

sure, I thought so.
it seems very simple, just take action here

@uazo
Copy link
Collaborator

uazo commented Oct 24, 2021

it works!

image

@csagan5
Copy link
Contributor

csagan5 commented Oct 24, 2021

perhaps it should be behind a flag so that only who really needs it will enable it.

sure, I thought so. it seems very simple, just take action here

Yes, it looks like a good place to evaluate a flag; do you want to make a separate PR for this?

@uazo
Copy link
Collaborator

uazo commented Oct 24, 2021

Yes, it looks like a good place to evaluate a flag; do you want to make a separate PR for this?

sure, I'll take care of it.

@csagan5
Copy link
Contributor

csagan5 commented Oct 24, 2021

@uazo you can find my original findings about autofill in this comment; they match your findings.

@uazo
Copy link
Collaborator

uazo commented Oct 26, 2021

I didn't think it was a long-awaited feature...

@csagan5
Copy link
Contributor

csagan5 commented Oct 26, 2021

Fixed in 94.0.4606.109.

@PurpleCodingWizard
Copy link

I tried bitwarden and keepassDX but could not get the input field as shown in the screenshot. I did update to the latest version and this is a android 10 device. Smartcookiewebpreview a geckoview based firefox like browser does pop the password prompt. So, not really fixed at least here...

@uazo
Copy link
Collaborator

uazo commented Oct 27, 2021

I tried bitwarden

it works for me, could you give us more details?

and keepassDX

actually this doesn't work, I'll check

@uazo
Copy link
Collaborator

uazo commented Oct 27, 2021

keepassdx in the emulator with org.chromium.chrome it works

image

as soon as it finishes compiling check with the published version

@uazo
Copy link
Collaborator

uazo commented Oct 27, 2021

just checked, it works perfectly, even on my (physical) device.

@PurpleCodingWizard
Copy link

PurpleCodingWizard commented Oct 28, 2021

I tried bitwarden

it works for me, could you give us more details?

I had tried both apps in the latest version of bromite(v94.0.4606.109 )as the changelog mentioned this being fixed in it. Unfortunately, I do not get the password entry prompt as nothing pop-ups.

as soon as it finishes compiling check with the published version

Is that a new official release not available yet of bromite or do you mean some chromium version you tested?

Edit: v90-> v94

@uazo
Copy link
Collaborator

uazo commented Oct 28, 2021

v90.0.4606.109

it is not the latest version.

did you follow the instructions on the bitwarden website?
also, please open another issue with your device details

@PurpleCodingWizard
Copy link

PurpleCodingWizard commented Oct 28, 2021

v94.0.4606.109
it is not the latest version.

Sorry, I had to manually type the version as there's no copy function in settings. This is the latest that shows in github releases.

did you follow the instructions on the bitwarden website?

I basically, created a new account, selected bitwarden as accessibility input provider. And did the input tests on github.com/login. Repeated with keepassDX too. I did not find any instructions which were to be followed for bitwarden. Can you link the webpage?

also, please open another issue with your device details

Sure. Will do so later.

@uazo
Copy link
Collaborator

uazo commented Oct 28, 2021

accessibility input provider

maybe that's the problem.
not accessibility but autofill:

image

@PurpleCodingWizard
Copy link

PurpleCodingWizard commented Oct 28, 2021

accessibility input provider

maybe that's the problem. not accessibility but autofill:

I uninstalled bitwarden but keepassDX was already set to autofill while testing as seen in the screenshot attached here.
IMG_20211028_182050

@uazo
Copy link
Collaborator

uazo commented Oct 30, 2021

also, please open another issue with your device details
Sure. Will do so later.

please fill in your details so let us understand

@PurpleCodingWizard
Copy link

also, please open another issue with your device details
Sure. Will do so later.

please fill in your details so let us understand

Sorry for late reply
But, apparently, it worked once or twice on amazon.com so atleast it works in some sites out there. I will try to file a bug report after I get the time to test more later

@csagan5
Copy link
Contributor

csagan5 commented Nov 1, 2021

Sorry, I had to manually type the version as there's no copy function in settings. This is the latest that shows in github releases.

Please edit the issue description with the correct version, it is not optional; none of the template questions are.

calyxos-gerrit pushed a commit to CalyxOS/chromium that referenced this issue Mar 8, 2023
There are 2 different types of autofill: one managed via GCM and the
native Android one that uses the provider assigned by the user
(which can be any user installed app like Bitwarden for example).
In chromium GCM is active while in the WebView the latter.
This patch uses WebView code to enable native Android autofill
along with browser-managed autofill.
A separate toggle is introduced to enable autofill in incognito mode.

See also: bromite/bromite#547

Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants