googlearchive/android-AutofillFramework

Change getStructure() method

nikz-dev opened this issue · 4 comments

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.

This all was updated yesterday when Beta2 was launched.

This all was updated yesterday when Beta2 was launched.

There are no tags or branches named "Beta2", so it is unclear what this refers to. If you clone this repo (master branch), it fails to build, with the aforementioned problems. Here is a Gradle console output shows, when running gradle installDebug while in the Application/ directory:

:Application:compileDebugJavaWithJavac
/tmp/android-AutofillFramework/Application/src/main/java/com/example/android/autofillframework/service/model/SavableAutofillData.java:33: error: incompatible types: CharSequence[] cannot be converted to String[]
                String[] autofillOptions = viewNode.getAutofillOptions();
                                                                      ^
/tmp/android-AutofillFramework/Application/src/main/java/com/example/android/autofillframework/service/model/AutofillField.java:39: error: incompatible types: CharSequence[] cannot be converted to String[]
        mAutofillOptions = view.getAutofillOptions();
                                                  ^
/tmp/android-AutofillFramework/Application/src/main/java/com/example/android/autofillframework/service/MyAutofillService.java:46: error: method does not override or implement a method from a supertype
    @Override
    ^
/tmp/android-AutofillFramework/Application/src/main/java/com/example/android/autofillframework/service/MyAutofillService.java:52: error: method does not override or implement a method from a supertype
    @Override
    ^
/tmp/android-AutofillFramework/Application/src/main/java/com/example/android/autofillframework/service/MyAutofillService.java:61: error: cannot find symbol
        AssistStructure structure = request.getStructure();
                                           ^
  symbol:   method getStructure()
  location: variable request of type FillRequest
5 errors
:Application:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Application:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Furthermore, you can see the buggy code right in this repo, such as using String[] instead of CharSequence[].

IOW, while this repo is compatible with ODP2, it has not tracked the change to ODP3, released this past Thursday.

Thanks for all the details. ((By Beta2, I meant ODP3))

The issue is that our sample publishing scripts didn't delete the service package; it was supposed to be renamed to multidatasetservice and updated to work with ODP3 APIs, but instead it added the multidatasetservice package and didn't remove the old service package.

@commonsguy it's the same cause as what happened in ODP2 when you reported similar issues. I thought it was fixed so we have more investigating to do (though APIs are final so hopefully this can't be an issue for a while). In the meantime I just deleted the service package so it should build now.

By Beta2, I meant ODP3

Oy, I think I need a scorecard... :-)

In the meantime I just deleted the service package so it should build now.

Yes, I can confirm that a fresh clone of the repo builds. Thanks!