Merge "Revert "Don't trigger auto-fill request if mode is manual""
This commit is contained in:
committed by
Android (Google) Code Review
commit
8716ef9419
@@ -953,7 +953,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
public @interface AutoFillMode {}
|
||||
|
||||
/**
|
||||
* This view inherits the auto-fill state from it's parent. If there is no parent it is
|
||||
* This view inherits the autofill state from it's parent. If there is no parent it is
|
||||
* {@link #AUTO_FILL_MODE_AUTO}.
|
||||
* Use with {@link #setAutoFillMode(int)} and <a href="#attr_android:autoFillMode">
|
||||
* {@code android:autoFillMode}.
|
||||
@@ -968,11 +968,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
public static final int AUTO_FILL_MODE_AUTO = 1;
|
||||
|
||||
/**
|
||||
* Do not trigger an auto-fill request if this view is focused. The user can still force
|
||||
* an auto-fill request.
|
||||
* <p>This does not prevent this field from being auto-filled if an auto-fill operation is
|
||||
* triggered from a different view.</p>
|
||||
*
|
||||
* Require the user to manually force an auto-fill request.
|
||||
* Use with {@link #setAutoFillMode(int)} and <a href="#attr_android:autoFillMode">{@code
|
||||
* android:autoFillMode}.
|
||||
*/
|
||||
@@ -6527,12 +6523,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
if (isAutoFillable()) {
|
||||
AutoFillManager afm = getAutoFillManager();
|
||||
if (afm != null) {
|
||||
boolean adjGainFocus = gainFocus;
|
||||
if (adjGainFocus && getResolvedAutoFillMode() == AUTO_FILL_MODE_MANUAL) {
|
||||
adjGainFocus = false;
|
||||
}
|
||||
|
||||
afm.focusChanged(this, adjGainFocus);
|
||||
afm.focusChanged(this, gainFocus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9315,30 +9306,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
return (mPrivateFlags3 & PFLAG3_AUTO_FILL_MODE_MASK) >> PFLAG3_AUTO_FILL_MODE_SHIFT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resolved auto-fill mode for this view.
|
||||
*
|
||||
* This is the same as {@link #getAutoFillMode()} but if the mode is
|
||||
* {@link #AUTO_FILL_MODE_INHERIT} the parents auto-fill mode will be returned.
|
||||
*
|
||||
* @return One of {@link #AUTO_FILL_MODE_AUTO}, or {@link #AUTO_FILL_MODE_MANUAL}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @AutoFillMode int getResolvedAutoFillMode() {
|
||||
@AutoFillMode int autoFillMode = getAutoFillMode();
|
||||
|
||||
if (autoFillMode == AUTO_FILL_MODE_INHERIT) {
|
||||
if (mParent == null) {
|
||||
throw new IllegalStateException("View is detached, cannot resolve autoFillMode");
|
||||
} else {
|
||||
return mParent.getResolvedAutoFillMode();
|
||||
}
|
||||
} else {
|
||||
return autoFillMode;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the nearest view in the specified direction that can take focus.
|
||||
* This does not actually give focus to that view.
|
||||
|
||||
@@ -659,17 +659,4 @@ public interface ViewParent {
|
||||
* @return true if the action was consumed by this ViewParent
|
||||
*/
|
||||
public boolean onNestedPrePerformAccessibilityAction(View target, int action, Bundle arguments);
|
||||
|
||||
/**
|
||||
* Return the resolved auto-fill mode.
|
||||
*
|
||||
* @return The resolved auto-fill mode
|
||||
*
|
||||
* @see View#getResolvedAutoFillMode()
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
default @View.AutoFillMode int getResolvedAutoFillMode() {
|
||||
return View.AUTO_FILL_MODE_AUTO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2289,14 +2289,12 @@
|
||||
|
||||
<!-- Controls the auto-fill behavior for this view -->
|
||||
<attr name="autoFillMode">
|
||||
<!-- Inherit the behavior from the parent. If there is no parent it is auto. This is the
|
||||
default value for this attribute.-->
|
||||
<!-- Inherit the behavior from the parent. If there is no parent it is auto. -->
|
||||
<enum name="inherit" value="0" />
|
||||
<!-- Allows this view to automatically trigger an auto-fill request when it get focus.
|
||||
-->
|
||||
<enum name="auto" value="1" />
|
||||
<!-- Do not trigger an auto-fill request when this view is focused. The user can still
|
||||
manually force an auto-fill request for this view. -->
|
||||
<!-- The user has to manually force an auto-fill request for this view. -->
|
||||
<enum name="manual" value="2" />
|
||||
</attr>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user