diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index f918cadde87c7..637b60e2dcb47 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2723,25 +2723,20 @@ public class WebView extends AbsoluteLayout * {@code IFRAME}, in which case it would be treated the same way as multiple forms described * above, except that the {@link ViewStructure#setWebDomain(String) web domain} of the * {@code FORM} contains the {@code src} attribute from the {@code IFRAME} node. - *
It should also call {@code structure.setDataIsSensitive(false)} for fields whose value - * were not dynamically changed (for example, through Javascript). + *
If the WebView implementation can determine that the value of a field was set statically + * (for example, not through Javascript), it should also call + * {@code structure.setDataIsSensitive(false)}. * - *
Example1: an HTML form with 2 fields for username and password. + *
For example, an HTML form with 2 fields for username and password: * *
* <input type="text" name="username" id="user" value="Type your username" autocomplete="username" placeholder="Email or username">
@@ -2754,51 +2749,27 @@ public class WebView extends AbsoluteLayout
* int index = structure.addChildCount(2);
* ViewStructure username = structure.newChild(index);
* username.setAutofillId(structure.getAutofillId(), 1); // id 1 - first child
- * username.setClassName("input");
- * username.setInputType("android.widget.EditText");
* username.setAutofillHints("username");
* username.setHtmlInfo(username.newHtmlInfoBuilder("input")
* .addAttribute("type", "text")
* .addAttribute("name", "username")
- * .addAttribute("id", "user")
* .build());
* username.setHint("Email or username");
* username.setAutofillType(View.AUTOFILL_TYPE_TEXT);
* username.setAutofillValue(AutofillValue.forText("Type your username"));
- * username.setText("Type your username");
- * // Value of the field is not sensitive because it was not dynamically changed:
+ * // Value of the field is not sensitive because it was created statically and not changed.
* username.setDataIsSensitive(false);
*
* ViewStructure password = structure.newChild(index + 1);
* username.setAutofillId(structure, 2); // id 2 - second child
- * password.setInputType("android.widget.EditText");
- * password.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
* password.setAutofillHints("current-password");
* password.setHtmlInfo(password.newHtmlInfoBuilder("input")
* .addAttribute("type", "password")
* .addAttribute("name", "password")
- * .addAttribute("id", "pass")
* .build());
* password.setHint("Password");
* password.setAutofillType(View.AUTOFILL_TYPE_TEXT);
*
- *
- * Example2: an IFRAME tag. - * - *
- * <iframe src="https://example.com/login"/> - *- * - *
Would map to: - * - *
- * int index = structure.addChildCount(1);
- * ViewStructure iframe = structure.newChildFor(index);
- * iframe.setAutofillId(structure.getAutofillId(), 1);
- * iframe.setHtmlInfo(iframe.newHtmlInfoBuilder("iframe")
- * .addAttribute("src", "https://example.com/login")
- * .build());
- *
*/
@Override
public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags) {