Loading core/java/android/view/View.java +2 −2 Original line number Diff line number Diff line Loading @@ -8207,12 +8207,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // becomes true where it should issue notifyViewEntered(). afm.notifyViewEntered(this); } else { afm.enableFillRequestActivityStarted(); afm.enableFillRequestActivityStarted(this); } } else if (!enter && !isFocused()) { afm.notifyViewExited(this); } else if (enter) { afm.enableFillRequestActivityStarted(); afm.enableFillRequestActivityStarted(this); } } } core/java/android/view/autofill/AutofillManager.java +54 −5 Original line number Diff line number Diff line Loading @@ -488,6 +488,25 @@ public final class AutofillManager { public static final String DEVICE_CONFIG_AUTOFILL_DIALOG_ENABLED = "autofill_dialog_enabled"; /** * Sets the autofill hints allowed list for the fields that can trigger the fill dialog * feature at Activity starting. * * The list of autofill hints is {@code ":"} colon delimited. * * <p>For example, a list with 3 hints {@code password}, {@code phone}, and * {@code emailAddress}, would be {@code password:phone:emailAddress} * * Note: By default the password field is enabled even there is no password hint in the list * * @see View#setAutofillHints(String...) * @hide */ public static final String DEVICE_CONFIG_AUTOFILL_DIALOG_HINTS = "autofill_dialog_hints"; private static final String DIALOG_HINTS_DELIMITER = ":"; /** @hide */ public static final int RESULT_OK = 0; /** @hide */ Loading Loading @@ -537,6 +556,7 @@ public final class AutofillManager { public static final int NO_SESSION = Integer.MAX_VALUE; private static final boolean HAS_FILL_DIALOG_UI_FEATURE_DEFAULT = false; private static final String FILL_DIALOG_ENABLED_DEFAULT_HINTS = ""; private final IAutoFillManager mService; Loading Loading @@ -652,6 +672,8 @@ public final class AutofillManager { // Indicates whether called the showAutofillDialog() method. private boolean mShowAutofillDialogCalled = false; private final String[] mFillDialogEnabledHints; /** @hide */ public interface AutofillClient { /** Loading Loading @@ -796,8 +818,10 @@ public final class AutofillManager { DeviceConfig.NAMESPACE_AUTOFILL, DEVICE_CONFIG_AUTOFILL_DIALOG_ENABLED, HAS_FILL_DIALOG_UI_FEATURE_DEFAULT); mFillDialogEnabledHints = getFillDialogEnabledHints(); if (sDebug) { Log.d(TAG, "Fill dialog is enabled:" + mIsFillDialogEnabled); Log.d(TAG, "Fill dialog is enabled:" + mIsFillDialogEnabled + ", hints=" + Arrays.toString(mFillDialogEnabledHints)); } if (mOptions != null) { Loading @@ -806,6 +830,19 @@ public final class AutofillManager { } } private String[] getFillDialogEnabledHints() { final String dialogHints = DeviceConfig.getString( DeviceConfig.NAMESPACE_AUTOFILL, DEVICE_CONFIG_AUTOFILL_DIALOG_HINTS, FILL_DIALOG_ENABLED_DEFAULT_HINTS); if (TextUtils.isEmpty(dialogHints)) { return new String[0]; } return ArrayUtils.filter(dialogHints.split(DIALOG_HINTS_DELIMITER), String[]::new, (str) -> !TextUtils.isEmpty(str)); } /** * @hide */ Loading Loading @@ -1076,17 +1113,27 @@ public final class AutofillManager { } /** * The view is autofillable, marked to perform a fill request after layout if * The view have the allowed autofill hints, marked to perform a fill request after layout if * the field does not trigger a fill request. * * @hide */ public void enableFillRequestActivityStarted() { public void enableFillRequestActivityStarted(View v) { if (mRequireAutofill) { return; } if (mIsFillDialogEnabled || ArrayUtils.containsAny(v.getAutofillHints(), mFillDialogEnabledHints)) { if (sDebug) { Log.d(TAG, "Trigger fill request at starting"); } mRequireAutofill = true; } } private boolean hasFillDialogUiFeature() { return mIsFillDialogEnabled; return mIsFillDialogEnabled || !ArrayUtils.isEmpty(mFillDialogEnabledHints); } /** Loading Loading @@ -2977,6 +3024,8 @@ public final class AutofillManager { pw.print(pfx); pw.print("compat mode enabled: "); synchronized (mLock) { pw.print(pfx); pw.print("fill dialog enabled: "); pw.println(mIsFillDialogEnabled); pw.print(pfx); pw.print("fill dialog enabled hints: "); pw.println(Arrays.toString(mFillDialogEnabledHints)); if (mCompatibilityBridge != null) { final String pfx2 = pfx + " "; pw.println("true"); Loading Loading
core/java/android/view/View.java +2 −2 Original line number Diff line number Diff line Loading @@ -8207,12 +8207,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // becomes true where it should issue notifyViewEntered(). afm.notifyViewEntered(this); } else { afm.enableFillRequestActivityStarted(); afm.enableFillRequestActivityStarted(this); } } else if (!enter && !isFocused()) { afm.notifyViewExited(this); } else if (enter) { afm.enableFillRequestActivityStarted(); afm.enableFillRequestActivityStarted(this); } } }
core/java/android/view/autofill/AutofillManager.java +54 −5 Original line number Diff line number Diff line Loading @@ -488,6 +488,25 @@ public final class AutofillManager { public static final String DEVICE_CONFIG_AUTOFILL_DIALOG_ENABLED = "autofill_dialog_enabled"; /** * Sets the autofill hints allowed list for the fields that can trigger the fill dialog * feature at Activity starting. * * The list of autofill hints is {@code ":"} colon delimited. * * <p>For example, a list with 3 hints {@code password}, {@code phone}, and * {@code emailAddress}, would be {@code password:phone:emailAddress} * * Note: By default the password field is enabled even there is no password hint in the list * * @see View#setAutofillHints(String...) * @hide */ public static final String DEVICE_CONFIG_AUTOFILL_DIALOG_HINTS = "autofill_dialog_hints"; private static final String DIALOG_HINTS_DELIMITER = ":"; /** @hide */ public static final int RESULT_OK = 0; /** @hide */ Loading Loading @@ -537,6 +556,7 @@ public final class AutofillManager { public static final int NO_SESSION = Integer.MAX_VALUE; private static final boolean HAS_FILL_DIALOG_UI_FEATURE_DEFAULT = false; private static final String FILL_DIALOG_ENABLED_DEFAULT_HINTS = ""; private final IAutoFillManager mService; Loading Loading @@ -652,6 +672,8 @@ public final class AutofillManager { // Indicates whether called the showAutofillDialog() method. private boolean mShowAutofillDialogCalled = false; private final String[] mFillDialogEnabledHints; /** @hide */ public interface AutofillClient { /** Loading Loading @@ -796,8 +818,10 @@ public final class AutofillManager { DeviceConfig.NAMESPACE_AUTOFILL, DEVICE_CONFIG_AUTOFILL_DIALOG_ENABLED, HAS_FILL_DIALOG_UI_FEATURE_DEFAULT); mFillDialogEnabledHints = getFillDialogEnabledHints(); if (sDebug) { Log.d(TAG, "Fill dialog is enabled:" + mIsFillDialogEnabled); Log.d(TAG, "Fill dialog is enabled:" + mIsFillDialogEnabled + ", hints=" + Arrays.toString(mFillDialogEnabledHints)); } if (mOptions != null) { Loading @@ -806,6 +830,19 @@ public final class AutofillManager { } } private String[] getFillDialogEnabledHints() { final String dialogHints = DeviceConfig.getString( DeviceConfig.NAMESPACE_AUTOFILL, DEVICE_CONFIG_AUTOFILL_DIALOG_HINTS, FILL_DIALOG_ENABLED_DEFAULT_HINTS); if (TextUtils.isEmpty(dialogHints)) { return new String[0]; } return ArrayUtils.filter(dialogHints.split(DIALOG_HINTS_DELIMITER), String[]::new, (str) -> !TextUtils.isEmpty(str)); } /** * @hide */ Loading Loading @@ -1076,17 +1113,27 @@ public final class AutofillManager { } /** * The view is autofillable, marked to perform a fill request after layout if * The view have the allowed autofill hints, marked to perform a fill request after layout if * the field does not trigger a fill request. * * @hide */ public void enableFillRequestActivityStarted() { public void enableFillRequestActivityStarted(View v) { if (mRequireAutofill) { return; } if (mIsFillDialogEnabled || ArrayUtils.containsAny(v.getAutofillHints(), mFillDialogEnabledHints)) { if (sDebug) { Log.d(TAG, "Trigger fill request at starting"); } mRequireAutofill = true; } } private boolean hasFillDialogUiFeature() { return mIsFillDialogEnabled; return mIsFillDialogEnabled || !ArrayUtils.isEmpty(mFillDialogEnabledHints); } /** Loading Loading @@ -2977,6 +3024,8 @@ public final class AutofillManager { pw.print(pfx); pw.print("compat mode enabled: "); synchronized (mLock) { pw.print(pfx); pw.print("fill dialog enabled: "); pw.println(mIsFillDialogEnabled); pw.print(pfx); pw.print("fill dialog enabled hints: "); pw.println(Arrays.toString(mFillDialogEnabledHints)); if (mCompatibilityBridge != null) { final String pfx2 = pfx + " "; pw.println("true"); Loading