Giter VIP home page Giter VIP logo

android-autofillframework's Introduction

Android AutofillFramework Sample

This repo has been migrated to github.com/android/input. Please check that repo for future updates. Thank you!

android-autofillframework's People

Contributors

codingjeremy avatar google-automerger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-autofillframework's Issues

App crashes while click on "SIGN IN USING VIRTUAL VIEWS"

                                                                                     --------- beginning of crash
03-27 17:42:13.203 17475-17475/com.example.android.autofillframework E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                      Process: com.example.android.autofillframework, PID: 17475
                                                                                      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.autofillframework/com.example.android.autofillframework.app.VirtualLoginActivity}: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class com.example.android.autofillframework.app.CustomVirtualView
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2758)
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2817)
                                                                                          at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1549)
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                          at android.os.Looper.loop(Looper.java:156)
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:6440)
                                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                                          at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:746)
                                                                                       Caused by: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class com.example.android.autofillframework.app.CustomVirtualView
                                                                                       Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class com.example.android.autofillframework.app.CustomVirtualView
                                                                                       Caused by: java.lang.reflect.InvocationTargetException
                                                                                          at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                                          at java.lang.reflect.Constructor.newInstance(Constructor.java:333)
                                                                                          at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                                                                          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
                                                                                          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:860)
                                                                                          at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                                          at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412)
                                                                                          at android.app.Activity.setContentView(Activity.java:2492)
                                                                                          at com.example.android.autofillframework.app.VirtualLoginActivity.onCreate(VirtualLoginActivity.java:41)
                                                                                          at android.app.Activity.performCreate(Activity.java:6773)
                                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1195)
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2711)
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2817)
                                                                                          at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1549)
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                          at android.os.Looper.loop(Looper.java:156)
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:6440)
                                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                                          at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:746)
                                                                                       Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/autofill/AutoFillManager;
                                                                                          at com.example.android.autofillframework.app.CustomVirtualView.<init>(CustomVirtualView.java:72)
                                                                                          at java.lang.reflect.Constructor.newInstance0(Native Method) 
                                                                                          at java.lang.reflect.Constructor.newInstance(Constructor.java:333) 
                                                                                          at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
                                                                                          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
                                                                                          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:860) 
                                                                                          at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
                                                                                          at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
                                                                                          at android.app.Activity.setContentView(Activity.java:2492) 
                                                                                          at com.example.android.autofillframework.app.VirtualLoginActivity.onCreate(VirtualLoginActivity.java:41) 
                                                                                          at android.app.Activity.performCreate(Activity.java:6773) 
                                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1195) 
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2711) 
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2817) 
                                                                                          at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1549) 
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                          at android.os.Looper.loop(Looper.java:156) 
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:6440) 
                                                                                          at java.lang.reflect.Method.invoke(Native Method) 
                                                                                          at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:746) 
                                                                                       Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.autofill.AutoFillManager" on path: DexPathList[[zip file "/data/app/com.example.android.autofillframework-XUA6dlToNwdNt-NCzDOMRg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.android.autofillframework-XUA6dlToNwdNt-NCzDOMRg==/lib/x86, /system/lib, /system/vendor/lib]]
                                                                                          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
                                                                                          at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                                                          at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                                          at com.example.android.autofillframework.app.CustomVirtualView.<init>(CustomVirtualView.java:72) 
                                                                                          at java.lang.reflect.Constructor.newInstance0(Native Method) 
                                                                                          at java.lang.reflect.Constructor.newInstance(Constructor.java:333) 
                                                                                          at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
                                                                                          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
                                                                                          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:860) 
                                                                                          at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
                                                                                          at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
                                                                                          at android.app.Activity.setContentView(Activity.java:2492) 
                                                                                          at com.example.android.autofillframework.app.VirtualLoginActivity.onCreate(VirtualLoginActivity.java:41) 
                                                                                          at android.app.Activity.performCreate(Activity.java:6773) 
                                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1195) 
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2711) 
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2817) 
                                                                                          at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1549) 
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                          at android.os.Looper.loop(Looper.java:156) 
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:6440) 
                                                                                          at java.lang.reflect.Method.invoke(Native Method) 
                                                                                          at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:746) 

sample code not working

Android Studio show message :
Error:Failed to find target with hash string 'android-O' in: /Users/xxx/Library/Android/sdk

When I click the Install missing platform(s) and sync project link android studio show dialog message as below :

Packages Unavailable
All package are not available for download!
The following package are not available:

  • Package id platforms; android-O

Thanks in advance.

Enable Authenticate response app crash

com.example.android.autofillframework E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                       Process: com.example.android.autofillframework, PID: 20182
                                                                                       java.lang.IllegalArgumentException: ids cannot be null or empry
                                                                                           at android.service.autofill.FillResponse$Builder.setAuthentication(FillResponse.java:272)
                                                                                           at com.example.android.autofillframework.multidatasetservice.MyAutofillService.onFillRequest(MyAutofillService.java:80)
                                                                                           at android.service.autofill.AutofillService.lambda$-android_service_autofill_AutofillService_4040(AutofillService.java:119)
                                                                                           at android.service.autofill.-$Lambda$svbjmB3NFhHnuZrn67G14PFSJlY.$m$0(Unknown Source:4)
                                                                                           at android.service.autofill.-$Lambda$svbjmB3NFhHnuZrn67G14PFSJlY.executeMessage(Unknown Source:0)
                                                                                           at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                                           at android.os.Looper.loop(Looper.java:164)
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                                           at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Second issue is Credit card autofilling also not working.

Change getStructure() method

Please change
AssistStructure structure = request.getStructure()
`in ../service/MyAutofillService.java to

AssistStructure structure = request.getFillContexts()
                .get(request.getFillContexts().size() - 1).getStructure()

because getStructure() method not supported now. AutofillField class also need some changes like String[] to CharSequence[] & for loop in updateSaveTypeFromHints() method.

onSaveRequest never called

There's no way to trigger the onSaveRequest method of MyAutofillService or at least it's not clear how to trigger that action. I used Android Emulator with Android O.

Autofill hints values

Hi,

Is it possible to get a list of values for the hints in the doc?

There is "username" and "password" in the exemple but is "mail" correct?

I guess it depends on the providers, but then it's not standardized? Removes a bit the point of the API then, no... ?

Thanks,

"Sample Credit Card Check Out Using Spinners" does not work.

When I fill user credentials in "Sample Login Using EditTexts" and "Sample Login Using AutoCompleteTextViews" for the first time, I see the toast asking whether I want to save that information.

image

However, that toast had never appeared in our case when we use "Sample Credit Card Check Out Using Spinners". From my understanding, implementations of client app seem fine. I am using 5X on Android Emulator. Any clue?

Autofill Spinners doesn't work

Hi,

I have tried your sample CreditCardSpinnersActivity and the Spinners isn't autofill, it works for the creditcardnumber and the vcc but spinners not moving.

Tested on a Nexus 5X with Android 8.0.

Crash in AutofillService

05-23 14:31:51.368 22493-22493/com.example.android.autofillframework E/AndroidRuntime: FATAL EXCEPTION: main
   Process: com.example.android.autofillframework, PID: 22493
   java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.example.android.autofillframework.service.model.SavedAutofillValue.getTextValue()' on a null object reference
       at com.example.android.autofillframework.service.model.ClientFormData.applyToFields(ClientFormData.java:135)
       at com.example.android.autofillframework.service.AutofillHelper.newDataset(AutofillHelper.java:49)
       at com.example.android.autofillframework.service.AutofillHelper.newResponse(AutofillHelper.java:84)
       at com.example.android.autofillframework.service.MyAutofillService.onFillRequest(MyAutofillService.java:102)
       at android.service.autofill.AutofillService.lambda$-android_service_autofill_AutofillService_4873(AutofillService.java:139)
       at android.service.autofill.-$Lambda$svbjmB3NFhHnuZrn67G14PFSJlY.$m$0(Unknown Source:4)
       at android.service.autofill.-$Lambda$svbjmB3NFhHnuZrn67G14PFSJlY.executeMessage(Unknown Source:0)
       at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6535)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

You are not checking to see if hintMap.get(hint) returns null.

This is coming when I launch an activity with this layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.commonsware.android.autofill.client.MainActivity">

  <EditText
    android:id="@+id/username"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="8dp"
    android:autofillHints="username"
    android:ems="10"
    android:inputType="textPersonName"
    android:text="@string/hint_username"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

  <EditText
    android:id="@+id/passphrase"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="8dp"
    android:autofillHints="password"
    android:ems="10"
    android:hint="@string/hint_passphrase"
    android:inputType="textPassword"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@id/username" />

  <EditText
    android:id="@+id/cc"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="8dp"
    android:autofillHints="creditCardNumber"
    android:ems="10"
    android:inputType="textPersonName"
    android:text="@string/hint_credit_card_number"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@id/passphrase" />

  <Button
    android:id="@+id/save"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="8dp"
    android:text="@string/btn_save"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@id/cc" />
</android.support.constraint.ConstraintLayout>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.