From bd271212a283a8e243ea498117f57b09ca2b346a Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Wed, 22 Feb 2017 09:05:07 -0800 Subject: [PATCH] Improved documentation and added @CallSuper on onProvideAutoFillStructure(). onProvideAutoFillStructure() sets mandatory auto-fill information like the auto-fill id, so we must enforce subclass to call it. Bug: 35395043 Test: m update-api Change-Id: I525690b38639d970f516a906ddeb3a6bd6e01d8c --- core/java/android/app/assist/AssistStructure.java | 4 ++++ core/java/android/view/View.java | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index 13d0f03425d3b..678c017febe0d 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -1059,6 +1059,10 @@ public class AssistStructure implements Parcelable { *
  • Root node (containing the URL of the HTML page) *
  • Child nodes that represent hyperlinks (contains the hyperlink URL). * + * + * WARNING: a {@link android.service.autofill.AutoFillService} should only + * use this URL for auto-fill purposes when it trusts the app generating it (i.e., the app + * defined by {@link AssistStructure#getActivityComponent()}). */ public String getUrl() { return mUrl; diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index df0a161327f0d..aa85a985155b0 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6983,19 +6983,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Called when assist structure is being retrieved from a view as part of an auto-fill request. * - *

    When implementing this method, subclasses must also: - * - *

      - *
    1. Implement {@link #autoFill(AutoFillValue)}, {@link #getAutoFillType()} - * and {@link #getAutoFillValue()}. - *
    2. Call {@link android.view.autofill.AutoFillManager#virtualValueChanged(View, int, - * AutoFillValue)} when its value changed. - *
    + *

    This method already provides most of what's needed for auto-fill, but should be overridden + * when the view contents does not include PII (Personally Identifiable Information) (so it + * can call {@link ViewStructure#setSanitized(boolean) ViewStructure#setSanitized(true)}). * * @param structure Fill in with structured view data. The default implementation * fills in all data that can be inferred from the view itself. * @param flags optional flags (currently {@code 0}). */ + @CallSuper public void onProvideAutoFillStructure(ViewStructure structure, int flags) { onProvideStructureForAssistOrAutoFill(structure, true); }