summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/ViewGroup.java9
-rw-r--r--core/java/android/view/autofill/AutofillFeatureFlags.java18
-rw-r--r--core/java/android/view/autofill/AutofillManager.java13
3 files changed, 39 insertions, 1 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 7bdff8c5b858..85d7c10ef91e 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -73,6 +73,7 @@ import android.view.inspector.InspectableProperty.EnumEntry;
import android.view.translation.TranslationCapability;
import android.view.translation.TranslationSpec.DataFormat;
import android.view.translation.ViewTranslationRequest;
+import android.webkit.WebView;
import android.window.OnBackInvokedDispatcher;
import com.android.internal.R;
@@ -3720,11 +3721,16 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
return afm.shouldIncludeAllChildrenViewsWithAutofillTypeNotNoneInAssistStructure();
}
- private boolean shouldIncludeAllChildrenViews(AutofillManager afm){
+ private boolean shouldIncludeAllChildrenViews(AutofillManager afm) {
if (afm == null) return false;
return afm.shouldIncludeAllChildrenViewInAssistStructure();
}
+ private boolean shouldAlwaysIncludeWebview(AutofillManager afm) {
+ if (afm == null) return false;
+ return afm.shouldAlwaysIncludeWebviewInAssistStructure();
+ }
+
/** @hide */
private void populateChildrenForAutofill(ArrayList<View> list, @AutofillFlags int flags) {
final int childrenCount = mChildrenCount;
@@ -3741,6 +3747,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
? mChildren[childIndex] : preorderedList.get(childIndex);
if ((flags & AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS) != 0
|| child.isImportantForAutofill()
+ || (child instanceof WebView && shouldAlwaysIncludeWebview(afm))
|| (child.isMatchingAutofillableHeuristics()
&& !child.isActivityDeniedForAutofillForUnimportantView())
|| (shouldIncludeAllChildrenViewWithAutofillTypeNotNone(afm)
diff --git a/core/java/android/view/autofill/AutofillFeatureFlags.java b/core/java/android/view/autofill/AutofillFeatureFlags.java
index 956230df524e..f543cab322bb 100644
--- a/core/java/android/view/autofill/AutofillFeatureFlags.java
+++ b/core/java/android/view/autofill/AutofillFeatureFlags.java
@@ -209,6 +209,17 @@ public class AutofillFeatureFlags {
DEVICE_CONFIG_INCLUDE_ALL_VIEWS_IN_ASSIST_STRUCTURE =
"include_all_views_in_assist_structure";
+ /**
+ * Whether to always include WebView in assist structure. WebView is a container view that
+ * providers "virtual" views. We want to always include such a container view since it can
+ * contain arbitrary views in it, some of which could be fillable.
+ *
+ * @hide
+ */
+ public static final String
+ DEVICE_CONFIG_ALWAYS_INCLUDE_WEBVIEW_IN_ASSIST_STRUCTURE =
+ "always_include_webview_in_assist_structure";
+
// END AUTOFILL FOR ALL APPS FLAGS //
@@ -441,6 +452,13 @@ public class AutofillFeatureFlags {
DEVICE_CONFIG_INCLUDE_ALL_VIEWS_IN_ASSIST_STRUCTURE, false);
}
+ /** @hide */
+ public static boolean shouldAlwaysIncludeWebviewInAssistStructure() {
+ return DeviceConfig.getBoolean(
+ DeviceConfig.NAMESPACE_AUTOFILL,
+ DEVICE_CONFIG_ALWAYS_INCLUDE_WEBVIEW_IN_ASSIST_STRUCTURE, true);
+ }
+
/**
* Whether should enable multi-line filter
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 2405d4092a0d..432f6e183731 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -728,6 +728,9 @@ public final class AutofillManager {
// Indicate whether should include all view in assist structure
private boolean mShouldIncludeAllChildrenViewInAssistStructure;
+ // Indicate whether WebView should always be included in the assist structure
+ private boolean mShouldAlwaysIncludeWebviewInAssistStructure;
+
// Indicates whether called the showAutofillDialog() method.
private boolean mShowAutofillDialogCalled = false;
@@ -946,6 +949,9 @@ public final class AutofillManager {
mShouldIncludeAllChildrenViewInAssistStructure
= AutofillFeatureFlags.shouldIncludeAllChildrenViewInAssistStructure();
+
+ mShouldAlwaysIncludeWebviewInAssistStructure =
+ AutofillFeatureFlags.shouldAlwaysIncludeWebviewInAssistStructure();
}
/**
@@ -1024,6 +1030,13 @@ public final class AutofillManager {
}
/**
+ * @hide
+ */
+ public boolean shouldAlwaysIncludeWebviewInAssistStructure() {
+ return mShouldAlwaysIncludeWebviewInAssistStructure;
+ }
+
+ /**
* Get the denied or allowed activitiy names under specified package from the list string and
* set it in fields accordingly
*