diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-04-19 23:32:46 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-04-19 23:32:46 +0000 |
| commit | 4dddd61fa8c89ad26f699bde2a1eb8732df9ad1d (patch) | |
| tree | 4dd608b1e67eddcbc52c3b07565c1bef17aff1d5 /core/java/android | |
| parent | 8a87e9ddd87254c1d4db0d428510f961fa420b52 (diff) | |
| parent | 9c05605f52cf6d84241da553d90887ca1bad87dc (diff) | |
Merge changes from topic "revert_save_info" into pi-dev
* changes:
Document compatibility mode limitations.
Revert "Always set FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE on SaveInfo when on compat mode."
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/service/autofill/AutofillService.java | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java index 60537a4ca3ec..6c18b4560d29 100644 --- a/core/java/android/service/autofill/AutofillService.java +++ b/core/java/android/service/autofill/AutofillService.java @@ -496,9 +496,9 @@ import android.view.autofill.AutofillValue; * * <p>Apps that use standard Android widgets support autofill out-of-the-box and need to do * very little to improve their user experience (annotating autofillable views and providing - * autofill hints). However, some apps do their own rendering and the rendered content may - * contain semantic structure that needs to be surfaced to the autofill framework. The platform - * exposes APIs to achieve this, however it could take some time until these apps implement + * autofill hints). However, some apps (typically browsers) do their own rendering and the rendered + * content may contain semantic structure that needs to be surfaced to the autofill framework. The + * platform exposes APIs to achieve this, however it could take some time until these apps implement * autofill support. * * <p>To enable autofill for such apps the platform provides a compatibility mode in which the @@ -521,15 +521,33 @@ import android.view.autofill.AutofillValue; * <meta-data android:name="android.autofill" android:resource="@xml/autofillservice" /> * </service></pre> * - * <P>In the XML file you can specify one or more packages for which to enable compatibility + * <p>In the XML file you can specify one or more packages for which to enable compatibility * mode. Below is a sample meta-data declaration: * * <pre> <autofill-service xmlns:android="http://schemas.android.com/apk/res/android"> * <compatibility-package android:name="foo.bar.baz" android:maxLongVersionCode="1000000000"/> * </autofill-service></pre> * - * <p>When using compatibility mode, the {@link SaveInfo.Builder#setFlags(int) SaveInfo flags} - * automatically include {@link SaveInfo#FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE}. + * <p>Notice that compatibility mode has limitations such as: + * <ul> + * <li>No manual autofill requests. Hence, the {@link FillRequest} + * {@link FillRequest#getFlags() flags} never have the {@link FillRequest#FLAG_MANUAL_REQUEST} flag. + * <li>The value of password fields are most likely masked—for example, {@code ****} instead + * of {@code 1234}. Hence, you must be careful when using these values to avoid updating the user + * data with invalid input. For example, when you parse the {@link FillRequest} and detect a + * password field, you could check if its + * {@link android.app.assist.AssistStructure.ViewNode#getInputType() + * input type} has password flags and if so, don't add it to the {@link SaveInfo} object. + * <li>The autofill context is not always {@link AutofillManager#commit() committed} when an HTML + * form is submitted. Hence, you must use other mechanisms to trigger save, such as setting the + * {@link SaveInfo#FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE} flag on {@link SaveInfo.Builder#setFlags(int)} + * or using {@link SaveInfo.Builder#setTriggerId(AutofillId)}. + * <li>Browsers often provide their own autofill management system. When both the browser and + * the platform render an autofill dialog at the same time, the result can be confusing to the user. + * Such browsers typically offer an option for users to disable autofill, so your service should + * also allow users to disable compatiblity mode for specific apps. That way, it is up to the user + * to decide which autofill mechanism—the browser's or the platform's—should be used. + * </ul> */ public abstract class AutofillService extends Service { private static final String TAG = "AutofillService"; |
