From a7f3e9c7cb35ad252cdb417aa604e0b2358e83e4 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Wed, 18 Apr 2018 16:12:04 -0700 Subject: [PATCH 1/2] Revert "Always set FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE on SaveInfo when on compat mode." Save has many limitations on compat mode, so we better not change the SaveInfo behavior but rather document then. This reverts commit 4f74a018c8ee9801f1d5ce2c7ec726251efc4fbf. Test: atest CtsAutoFillServiceTestCases:VirtualContainerActivityTest \ CtsAutoFillServiceTestCases:VirtualContainerActivityCompatModeTest Bug: 77655074 Change-Id: I36bd28ca546dcedefe75de7815b76b8b5827aee3 --- core/java/android/service/autofill/AutofillService.java | 3 --- .../autofill/java/com/android/server/autofill/Session.java | 7 ++----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java index 60537a4ca3ec3..0f7cea21c052a 100644 --- a/core/java/android/service/autofill/AutofillService.java +++ b/core/java/android/service/autofill/AutofillService.java @@ -527,9 +527,6 @@ import android.view.autofill.AutofillValue; *
 <autofill-service xmlns:android="http://schemas.android.com/apk/res/android">
  *     <compatibility-package android:name="foo.bar.baz" android:maxLongVersionCode="1000000000"/>
  * </autofill-service>
- * - *

When using compatibility mode, the {@link SaveInfo.Builder#setFlags(int) SaveInfo flags} - * automatically include {@link SaveInfo#FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE}. */ public abstract class AutofillService extends Service { private static final String TAG = "AutofillService"; diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 1d62eb7b76415..e6b2a3522fd1a 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -2151,11 +2151,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (saveTriggerId != null) { writeLog(MetricsEvent.AUTOFILL_EXPLICIT_SAVE_TRIGGER_DEFINITION); } - int flags = saveInfo.getFlags(); - if (mCompatMode) { - flags |= SaveInfo.FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE; - } - mSaveOnAllViewsInvisible = (flags & SaveInfo.FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE) != 0; + mSaveOnAllViewsInvisible = + (saveInfo.getFlags() & SaveInfo.FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE) != 0; // We only need to track views if we want to save once they become invisible. if (mSaveOnAllViewsInvisible) { From 9c05605f52cf6d84241da553d90887ca1bad87dc Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Thu, 19 Apr 2018 10:33:20 -0700 Subject: [PATCH 2/2] Document compatibility mode limitations. Test: mmm -j108 frameworks/base/:doc-comment-check-docs Fixes: 77655074 Change-Id: I527d882850442c7e6e9379b1b423673885e07f2b --- .../service/autofill/AutofillService.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java index 0f7cea21c052a..6c18b4560d294 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; * *

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. * *

To enable autofill for such apps the platform provides a compatibility mode in which the @@ -521,12 +521,33 @@ import android.view.autofill.AutofillValue; * <meta-data android:name="android.autofill" android:resource="@xml/autofillservice" /> * </service> * - *

In the XML file you can specify one or more packages for which to enable compatibility + *

In the XML file you can specify one or more packages for which to enable compatibility * mode. Below is a sample meta-data declaration: * *

 <autofill-service xmlns:android="http://schemas.android.com/apk/res/android">
  *     <compatibility-package android:name="foo.bar.baz" android:maxLongVersionCode="1000000000"/>
  * </autofill-service>
+ * + *

Notice that compatibility mode has limitations such as: + *

*/ public abstract class AutofillService extends Service { private static final String TAG = "AutofillService";