From 22e251a307a5afc655805ff56fdf51b65dc3f9ce Mon Sep 17 00:00:00 2001 From: jiewenlei Date: Thu, 4 May 2023 16:55:41 -0700 Subject: [PATCH] Update javadoc to reflect "autofill for all apps" changes. For SetImportantForAutofill: https://screenshot.googleplex.com/AHAHKeXN7a649Hx For isImportantForAutofill: https://screenshot.googleplex.com/8TNagJWZtatdKfh Test: m Bug: 264489182 Change-Id: I0c2b6e2208b6d667c486c23cbbea32a087255f33 --- core/java/android/view/View.java | 54 +++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 003307db832a5..6cc3e7d5195d5 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -9845,10 +9845,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * *

Note: Setting the mode as {@link #IMPORTANT_FOR_AUTOFILL_NO} or * {@link #IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS} does not guarantee the view (and its - * children) will be always be considered not important; for example, when the user explicitly - * makes an autofill request, all views are considered important. See - * {@link #isImportantForAutofill()} for more details about how the View's importance for - * autofill is used. + * children) will not be used for autofill purpose; for example, when the user explicitly + * makes an autofill request, all views are included in the ViewStructure, and starting in + * {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE} the system uses other factors along + * with importance to determine the autofill behavior. See {@link #isImportantForAutofill()} + * for more details about how the View's importance for autofill is used. * * @param mode {@link #IMPORTANT_FOR_AUTOFILL_AUTO}, {@link #IMPORTANT_FOR_AUTOFILL_YES}, * {@link #IMPORTANT_FOR_AUTOFILL_NO}, {@link #IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS}, @@ -9894,21 +9895,36 @@ public class View implements Drawable.Callback, KeyEvent.Callback, *

  • otherwise, it returns {@code false}. * * - *

    When a view is considered important for autofill: - *

    - * - *

    On the other hand, when a view is considered not important for autofill: - *

    + *

    The behavior of importances depends on Android version: + *

      + *
    1. For {@link android.os.Build.VERSION_CODES#TIRAMISU} and below: + *
        + *
      1. When a view is considered important for autofill: + *
          + *
        1. The view might automatically trigger an autofill request when focused on. + *
        2. The contents of the view are included in the {@link ViewStructure} used in an + * autofill request. + *
        + *
      2. On the other hand, when a view is considered not important for autofill: + *
          + *
        1. The view never automatically triggers autofill requests, but it can trigger a + * manual request through {@link AutofillManager#requestAutofill(View)}. + *
        2. The contents of the view are not included in the {@link ViewStructure} used in + * an autofill request, unless the request has the + * {@link #AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS} flag. + *
        + *
      + *
    2. For {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE} and above: + *
        + *
      1. The system uses importance, along with other view properties and other optimization + * factors, to determine if a view should trigger autofill on focus. + *
      2. The contents of {@link #IMPORTANT_FOR_AUTOFILL_AUTO}, + * {@link #IMPORTANT_FOR_AUTOFILL_YES}, {@link #IMPORTANT_FOR_AUTOFILL_NO}, + * {@link #IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS}, and + * {@link #IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS} views will be included in the + * {@link ViewStructure} used in an autofill request. + *
      + *
    * * @return whether the view is considered important for autofill. *