android / input-samples

Multiple samples showing the best practices in input on Android.
Apache License 2.0
288 stars 265 forks source link

Not working on browser #24

Open nikz-dev opened 6 years ago

nikz-dev commented 6 years ago

Hi there, I just try this sample on Android P Beta but it's not working on browsers. Tested on chrome, chrome beta, Microsoft Edge.

the-felipeal commented 6 years ago

We need more information.

First, which service are you using? The sample project provides 3 services now, but just the "Basic Heuristics Autofill Service" supports compatibility mode.

Second, what exactly didn't work? Wasn't autofill triggered, or was it triggered but the service didn't return any datasets? If you're not sure, please provide the output of:

adb shell dumpsys autofill

and also the output of

adb shell dumpsys activity top

(the latter while the browser is the top activity)

nikz-dev commented 6 years ago

which service are you using -- Basic Heuristics Autofill Service Wasn't autofill triggered -- Autofill is triggered but when I click on URL bar but expected to trigger when the page loaded. Tested on Pixel 2 XL device. Steps I follow - 1- open Google Chrome beta 2- open Twitter.com 3- Now expected some items will be shown for autofill but no item is showing.

adb shell dumpsys autofill
Debug mode: false
Verbose mode: false
Disabled users: {0=false, 10=false}
Max partitions per session: 10
Max visible datasets: 3
User data constraints: 
  maxUserDataSize: 50
  maxFieldClassificationIdsSize: 10
  maxCategoryCount: 10
  minValueLength: 3
  maxValueLength: 100
Cached services: 2

Service at index 0
  User: 0
  UID: -1
  Autofill Service Info: N/A
  Component from settings: null
  Default component: com.google.android.gms/.autofill.service.AutofillService
  Disabled: false
  Field classification enabled: true
  Compat pkgs: N/A
  Setup complete: true
  Last prune: 0
  Disabled apps: N/A
  Disabled activities: N/A
  No sessions
  Clients: N/A
  No event on last fill response
  User data: N/A
  Field Classification strategy: 
    User ID: 0
    Queued commands: N/A
    Implementation: com.google.android.ext.services/android.ext.services.autofill.AutofillFieldClassificationServiceImpl
    Available algorithms: [EDIT_DISTANCE]
    Default algorithm: EDIT_DISTANCE

Service at index 1
  User: 10
  UID: 1010231
  Autofill Service Info: 
    Component: ComponentInfo{com.example.android.autofill.service/com.example.android.autofill.service.simple.BasicHeuristicsService}
    Settings: null
    Compat packages: {com.chrome.beta=10000000000, com.chrome.canary=10000000000, org.mozilla.fennec_aurora=10000000000, com.opera.mini.native=10000000000, com.sec.android.app.sbrowser.beta=10000000000, com.microsoft.emmx=10000000000, com.opera.mini.native.beta=10000000000, com.opera.browser=10000000000, com.android.chrome=10000000000, com.sec.android.app.sbrowser=10000000000, org.mozilla.firefox=10000000000, org.mozilla.firefox_beta=10000000000, com.opera.browser.beta=10000000000, com.chrome.dev=10000000000}
  Component from settings: com.example.android.autofill.service/com.example.android.autofill.service.simple.BasicHeuristicsService
  Default component: com.google.android.gms/.autofill.service.AutofillService
  Disabled: false
  Field classification enabled: true
  Compat pkgs: {com.chrome.beta=10000000000, com.chrome.canary=10000000000, org.mozilla.fennec_aurora=10000000000, com.opera.mini.native=10000000000, com.sec.android.app.sbrowser.beta=10000000000, com.microsoft.emmx=10000000000, com.opera.mini.native.beta=10000000000, com.opera.browser=10000000000, com.android.chrome=10000000000, com.sec.android.app.sbrowser=10000000000, org.mozilla.firefox=10000000000, org.mozilla.firefox_beta=10000000000, com.opera.browser.beta=10000000000, com.chrome.dev=10000000000}
  Setup complete: true
  Last prune: 1526381264757
  Disabled apps: N/A
  Disabled activities: N/A
  No sessions
  Clients: 
    callbacks: 2
    killed: false
    broadcasts count: -1
  No event on last fill response
  User data: N/A
  Field Classification strategy: 
    User ID: 10
    Queued commands: N/A
    Implementation: com.google.android.ext.services/android.ext.services.autofill.AutofillFieldClassificationServiceImpl
    Available algorithms: [EDIT_DISTANCE]
    Default algorithm: EDIT_DISTANCE
Autofill UI
  showsFillUi: false
  showsSaveUi: false
Autofill Compat State: 
    User: 10

Exception occurred while dumping:
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.util.ArrayMap.size()' on a null object reference
    at com.android.server.autofill.AutofillManagerService$AutofillCompatState.dump(AutofillManagerService.java:778)
    at com.android.server.autofill.AutofillManagerService$AutofillCompatState.access$1200(AutofillManagerService.java:689)
    at com.android.server.autofill.AutofillManagerService$AutoFillManagerServiceStub.dump(AutofillManagerService.java:1190)
    at android.os.Binder.doDump(Binder.java:571)
    at android.os.Binder.dump(Binder.java:561)
    at android.os.Binder.onTransact(Binder.java:511)
    at android.view.autofill.IAutoFillManager$Stub.onTransact(IAutoFillManager.java:424)
    at android.os.Binder.execTransact(Binder.java:731)
the-felipeal commented 6 years ago

According to dumpsys, the service is not set:

  Component from settings: null

You need to set it on Settings -> search for autofill -> Autofill service -> then select "Basic Heuristics Autofill Service"

the-felipeal commented 6 years ago

Actually, just to be clear, it looks like the Basic Heuristics service is set for user 1, a secondary user - are you running Chrome on user 1 or user 0?

the-felipeal commented 6 years ago

Actually, I found an issue with compat mode on multi-user, it provably won't work, unless you switch users right after you reboot.

Anyways, I'm fixing it, but for now, please test it only in the primary user...