Mobile: Autofill in browsers on Android P

Created on 5 Jun 2018  路  36Comments  路  Source: bitwarden/mobile

Android P, which is currently in Beta, now allows apps to take advantage of the Autofill framework in browsers without using a full Accessibility service. It requires that both the browsers and apps update things to take advantage of this.

Currently, bitwarden autofill DOES work in android P, but only in apps. So, I wanted to post some info I found with regards to getting autofill working in browsers to since using the autofill framework is always going to be better than using the accessibility service. I hope it can be implemented!

https://blog.dashlane.com/android-p-autofill/
https://developer.android.com/preview/features/autofill#compat-mode

I'm signed up for the bitwarden Android beta and running Android P, so if you make any changes and would like some feedback, I would be happy to help.

Most helpful comment

Should be about to find it here:

chrome://flags/#enable-android-autofill-accessibility

Just set the flag to enabled and restart the browser.

All 36 comments

Thanks for the info. Unfortunately we will have to wait until Xamarin releases support for android p before I can begin working on this.

Also, we support autofilling in Oreo on a few browsers like Firefox Focus and DuckDuckGo. Do you know if these work in Android P?

I understand.

Also, I dl'ed Firefox focus, and I got an autofill prompt, so I think you're good there. Hoping you can get things working for chrome, when xamarin updates. And thanks for the app/service. Really enjoying it.

9 is released in preview form - will this allow you guys to work on Android P autofil?
https://blog.xamarin.com/xamarin-android-9-0-p-preview/

Just wanted to follow up on this. Is this possible with the xamarin P preview release? Or will you be waiting for stable channel?

Sounds like it is. I have not got around to installing the preview yet though.

Very exciting! Just fyi @kspearrin, looks like they moved the documentation here. It's not longer at the link the in the first post.

https://developer.android.com/reference/android/service/autofill/AutofillService#compatibility-mode

Thanks, I'll update soon and check it out.

Tried this out today following the instructions from their docs here:
https://developer.android.com/reference/android/service/autofill/AutofillService#compatibility-mode

I have compatibility mode set like:

<?xml version="1.0" encoding="utf-8" ?>
<autofill-service xmlns:android="http://schemas.android.com/apk/res/android">
  <compatibility-package android:name="com.android.chrome" android:maxLongVersionCode="1000000000"/>
  <compatibility-package android:name="com.opera.browser" android:maxLongVersionCode="1000000000"/>
</autofill-service>

Tried both Opera and Chrome, yet I get no OnFillRequest event in the autofill service...

Hmm, I'm honestly not really a programmer so I'm not sure why it wouldn't have worked. I tried searching github though but really only found this:
https://github.com/googlesamples/android-AutofillFramework/commit/03c9e1de1b1a30a020282415b81f9996a0e9dba2
Not sure if it might help, and it looks somewhat similar to what you did. That said, I would be happy to test a beta and report back (I'm in that channel on the Play Store and running Pie on a Pixel 2)

I'm not sure what could be wrong. Maybe I need to update to Android Support libraries v28 as well, but those don't seem to be available for Xamarin yet.

If you want to try the dev build apks with the compat mode enabled on a device, you can download them from here: https://ci.appveyor.com/project/bitwarden/mobile/build/artifacts

I don't have a device that can run Android P, so I was only testing on a simulator. Maybe there is a difference?

Actually it works for me in Chrome (took build 1515)! We just need to add more browsers now.

I have Pixel XL and Android 9

@kspearrin Yea, it actually worked for me as well (Pixel 2 with Android 9). That said, it stops working after 2 or 3 sites on my device. Restarting chrome seems to fix it though, so that might be a chrome issue (Chrome 69) vs a bitwarden issue

EDIT: Also, not sure how good the Android simulator is, but there is a flag in chrome (Autofill Accessibility) that is enabled by default on most chrome loadouts. Maybe if you explicitly enable it in the simulator, you'll be able to test it successfully?

@szale9001 Where do you see this setting in Chrome? I can't find it on my simulator. Chrome 68

Should be about to find it here:

chrome://flags/#enable-android-autofill-accessibility

Just set the flag to enabled and restart the browser.

@szale9001 Thanks, that fixed it! I guess default is off for whatever reason.

Well because Google is Google, default means whatever they want (just to make it extra confusing). So default for Android 9, Pixel is probably enabled and default for your sim is probably off. Either way, glad it worked!

I added more support for other browsers in latest build

This still isn't native support, is it? It's just enabling the acessability service which can cause lag and batter drain. AFAIK there's still not native web browser autofil api working

Not sure what you mean, but it's about as native as you can get with browsers.

@fredgolightly In Android Pie they built in a way to allow the autofill API to access certain parts of the accessibility system on a per-app basis (mostly browsers). So while there might be a performance hit while using this autofill mode in those specific apps, it is nowhere near as bad as enabling the global Accessibility service.

I think we are good with this now. Closing issue.

The issue @szale9001 mentioned still happens to me. I'm running a OnePlus 6 on Pie. I enabled the accessibility flag explicitly in the browser. It still stops working after 2-3 sites and I have to restart Chrome to fix it.

Yea, still happens. Unfortunately I think it is a chrome bug. I tried dashlane and 1password to see if they consistently threw autofill prompts and they seemed to have the same problem.

Is this something that is being worked on?

No, since it was completed several months ago.

I just updated to Pie on my S9 and Autofill just doesn't work in the browser.

Are you using a browser that is compatible with autofill ?

I'm using chrome, and enabled chrome://flags/#enable-android-autofill-accessibility

Did you enable the Bitwarden auto fill service?

Yes. It works in apps.

Same issue here, not working in Chrome 71 or Chrome beta. I tried setting the flag, auto fill in apps and Firefox works. I have s9, i'm thinking this might be a Samsung bug?

Tested today the autofill framework on a Huawei Mate 10 Pro, Android 9 and Bitwarden or Dashlane with Chrome Beta or Firefox Beta.
Each of the 4 combinations has the same issue : It works on 1 or 2 sites then I have to restart the browser to make it work again. Looks like an Android 9 bug...

Was this page helpful?
0 / 5 - 0 ratings