Merge "Adding two experiment flags to definie the condition to include views in assist structure (AS)." into udc-dev
This commit is contained in:
@@ -66,6 +66,7 @@ import android.view.animation.AnimationUtils;
|
|||||||
import android.view.animation.LayoutAnimationController;
|
import android.view.animation.LayoutAnimationController;
|
||||||
import android.view.animation.Transformation;
|
import android.view.animation.Transformation;
|
||||||
import android.view.autofill.AutofillId;
|
import android.view.autofill.AutofillId;
|
||||||
|
import android.view.autofill.AutofillManager;
|
||||||
import android.view.autofill.Helper;
|
import android.view.autofill.Helper;
|
||||||
import android.view.inspector.InspectableProperty;
|
import android.view.inspector.InspectableProperty;
|
||||||
import android.view.inspector.InspectableProperty.EnumEntry;
|
import android.view.inspector.InspectableProperty.EnumEntry;
|
||||||
@@ -3709,6 +3710,20 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AutofillManager getAutofillManager() {
|
||||||
|
return mContext.getSystemService(AutofillManager.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean shouldIncludeAllChildrenViewWithAutofillTypeNotNone(AutofillManager afm) {
|
||||||
|
if (afm == null) return false;
|
||||||
|
return afm.shouldIncludeAllChildrenViewsWithAutofillTypeNotNoneInAssistStructure();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean shouldIncludeAllChildrenViews(AutofillManager afm){
|
||||||
|
if (afm == null) return false;
|
||||||
|
return afm.shouldIncludeAllChildrenViewInAssistStructure();
|
||||||
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
private void populateChildrenForAutofill(ArrayList<View> list, @AutofillFlags int flags) {
|
private void populateChildrenForAutofill(ArrayList<View> list, @AutofillFlags int flags) {
|
||||||
final int childrenCount = mChildrenCount;
|
final int childrenCount = mChildrenCount;
|
||||||
@@ -3718,6 +3733,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
final ArrayList<View> preorderedList = buildOrderedChildList();
|
final ArrayList<View> preorderedList = buildOrderedChildList();
|
||||||
final boolean customOrder = preorderedList == null
|
final boolean customOrder = preorderedList == null
|
||||||
&& isChildrenDrawingOrderEnabled();
|
&& isChildrenDrawingOrderEnabled();
|
||||||
|
final AutofillManager afm = getAutofillManager();
|
||||||
for (int i = 0; i < childrenCount; i++) {
|
for (int i = 0; i < childrenCount; i++) {
|
||||||
final int childIndex = getAndVerifyPreorderedIndex(childrenCount, i, customOrder);
|
final int childIndex = getAndVerifyPreorderedIndex(childrenCount, i, customOrder);
|
||||||
final View child = (preorderedList == null)
|
final View child = (preorderedList == null)
|
||||||
@@ -3725,7 +3741,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
|||||||
if ((flags & AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS) != 0
|
if ((flags & AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS) != 0
|
||||||
|| child.isImportantForAutofill()
|
|| child.isImportantForAutofill()
|
||||||
|| (child.isMatchingAutofillableHeuristics()
|
|| (child.isMatchingAutofillableHeuristics()
|
||||||
&& !child.isActivityDeniedForAutofillForUnimportantView())) {
|
&& !child.isActivityDeniedForAutofillForUnimportantView())
|
||||||
|
|| (shouldIncludeAllChildrenViewWithAutofillTypeNotNone(afm)
|
||||||
|
&& child.getAutofillType() != AUTOFILL_TYPE_NONE)
|
||||||
|
|| shouldIncludeAllChildrenViews(afm)){
|
||||||
list.add(child);
|
list.add(child);
|
||||||
} else if (child instanceof ViewGroup) {
|
} else if (child instanceof ViewGroup) {
|
||||||
((ViewGroup) child).populateChildrenForAutofill(list, flags);
|
((ViewGroup) child).populateChildrenForAutofill(list, flags);
|
||||||
|
|||||||
@@ -193,6 +193,24 @@ public class AutofillFeatureFlags {
|
|||||||
public static final String DEVICE_CONFIG_SHOULD_ENABLE_AUTOFILL_ON_ALL_VIEW_TYPES =
|
public static final String DEVICE_CONFIG_SHOULD_ENABLE_AUTOFILL_ON_ALL_VIEW_TYPES =
|
||||||
"should_enable_autofill_on_all_view_types";
|
"should_enable_autofill_on_all_view_types";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether include all autofill type not none views in assist structure
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String
|
||||||
|
DEVICE_CONFIG_INCLUDE_ALL_AUTOFILL_TYPE_NOT_NONE_VIEWS_IN_ASSIST_STRUCTURE =
|
||||||
|
"include_all_autofill_type_not_none_views_in_assist_structure";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether include all views in assist structure
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String
|
||||||
|
DEVICE_CONFIG_INCLUDE_ALL_VIEWS_IN_ASSIST_STRUCTURE =
|
||||||
|
"include_all_views_in_assist_structure";
|
||||||
|
|
||||||
// END AUTOFILL FOR ALL APPS FLAGS //
|
// END AUTOFILL FOR ALL APPS FLAGS //
|
||||||
|
|
||||||
|
|
||||||
@@ -398,6 +416,28 @@ public class AutofillFeatureFlags {
|
|||||||
DeviceConfig.NAMESPACE_AUTOFILL,
|
DeviceConfig.NAMESPACE_AUTOFILL,
|
||||||
DEVICE_CONFIG_PACKAGE_AND_ACTIVITY_ALLOWLIST_FOR_TRIGGERING_FILL_REQUEST, "");
|
DEVICE_CONFIG_PACKAGE_AND_ACTIVITY_ALLOWLIST_FOR_TRIGGERING_FILL_REQUEST, "");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Whether include all views that have autofill type not none in assist structure.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static boolean shouldIncludeAllViewsAutofillTypeNotNoneInAssistStructrue() {
|
||||||
|
return DeviceConfig.getBoolean(
|
||||||
|
DeviceConfig.NAMESPACE_AUTOFILL,
|
||||||
|
DEVICE_CONFIG_INCLUDE_ALL_AUTOFILL_TYPE_NOT_NONE_VIEWS_IN_ASSIST_STRUCTURE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether include all views in assist structure.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static boolean shouldIncludeAllChildrenViewInAssistStructure() {
|
||||||
|
return DeviceConfig.getBoolean(
|
||||||
|
DeviceConfig.NAMESPACE_AUTOFILL,
|
||||||
|
DEVICE_CONFIG_INCLUDE_ALL_VIEWS_IN_ASSIST_STRUCTURE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// START AUTOFILL PCC CLASSIFICATION FUNCTIONS
|
// START AUTOFILL PCC CLASSIFICATION FUNCTIONS
|
||||||
|
|
||||||
|
|||||||
@@ -707,6 +707,12 @@ public final class AutofillManager {
|
|||||||
// An allowed activity set read from device config
|
// An allowed activity set read from device config
|
||||||
private Set<String> mAllowedActivitySet = new ArraySet<>();
|
private Set<String> mAllowedActivitySet = new ArraySet<>();
|
||||||
|
|
||||||
|
// Indicate whether should include all view with autofill type not none in assist structure
|
||||||
|
private boolean mShouldIncludeAllViewsWithAutofillTypeNotNoneInAssistStructure;
|
||||||
|
|
||||||
|
// Indicate whether should include all view in assist structure
|
||||||
|
private boolean mShouldIncludeAllChildrenViewInAssistStructure;
|
||||||
|
|
||||||
// Indicates whether called the showAutofillDialog() method.
|
// Indicates whether called the showAutofillDialog() method.
|
||||||
private boolean mShowAutofillDialogCalled = false;
|
private boolean mShowAutofillDialogCalled = false;
|
||||||
|
|
||||||
@@ -913,6 +919,12 @@ public final class AutofillManager {
|
|||||||
mAllowedActivitySet = getDeniedOrAllowedActivitySetFromString(
|
mAllowedActivitySet = getDeniedOrAllowedActivitySetFromString(
|
||||||
allowlistString, packageName);
|
allowlistString, packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mShouldIncludeAllViewsWithAutofillTypeNotNoneInAssistStructure
|
||||||
|
= AutofillFeatureFlags.shouldIncludeAllViewsAutofillTypeNotNoneInAssistStructrue();
|
||||||
|
|
||||||
|
mShouldIncludeAllChildrenViewInAssistStructure
|
||||||
|
= AutofillFeatureFlags.shouldIncludeAllChildrenViewInAssistStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -962,6 +974,20 @@ public final class AutofillManager {
|
|||||||
return listString.indexOf(packageName + ":") != -1;
|
return listString.indexOf(packageName + ":") != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean shouldIncludeAllChildrenViewsWithAutofillTypeNotNoneInAssistStructure() {
|
||||||
|
return mShouldIncludeAllViewsWithAutofillTypeNotNoneInAssistStructure;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean shouldIncludeAllChildrenViewInAssistStructure() {
|
||||||
|
return mShouldIncludeAllChildrenViewInAssistStructure;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the denied or allowed activitiy names under specified package from the list string and
|
* Get the denied or allowed activitiy names under specified package from the list string and
|
||||||
* set it in fields accordingly
|
* set it in fields accordingly
|
||||||
|
|||||||
Reference in New Issue
Block a user