Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3056c611 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't run autoFill on detached view or mode=manual"

parents 3c64ca7d 4461181f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -44918,6 +44918,7 @@ package android.view {
    method public float getPivotX();
    method public float getPivotY();
    method public android.view.PointerIcon getPointerIcon();
    method public int getResolvedAutoFillMode();
    method public android.content.res.Resources getResources();
    method public final boolean getRevealOnFocusHint();
    method public final int getRight();
@@ -45865,6 +45866,7 @@ package android.view {
    method public abstract int getLayoutDirection();
    method public abstract android.view.ViewParent getParent();
    method public abstract android.view.ViewParent getParentForAccessibility();
    method public default int getResolvedAutoFillMode();
    method public abstract int getTextAlignment();
    method public abstract int getTextDirection();
    method public abstract deprecated void invalidateChild(android.view.View, android.graphics.Rect);
@@ -47215,10 +47217,12 @@ package android.view.autofill {
  }
  public final class AutoFillManager {
    method public void focusChanged(android.view.View, boolean);
    method public void reset();
    method public void startAutoFillRequest(android.view.View);
    method public void startAutoFillRequestOnVirtualView(android.view.View, int, android.graphics.Rect);
    method public void stopAutoFillRequest(android.view.View);
    method public void stopAutoFillRequestOnVirtualView(android.view.View, int);
    method public void valueChanged(android.view.View);
    method public void virtualFocusChanged(android.view.View, int, android.graphics.Rect, boolean);
    method public void virtualValueChanged(android.view.View, int, android.view.autofill.AutoFillValue);
    field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
    field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
+6 −2
Original line number Diff line number Diff line
@@ -48306,6 +48306,7 @@ package android.view {
    method public float getPivotX();
    method public float getPivotY();
    method public android.view.PointerIcon getPointerIcon();
    method public int getResolvedAutoFillMode();
    method public android.content.res.Resources getResources();
    method public final boolean getRevealOnFocusHint();
    method public final int getRight();
@@ -49253,6 +49254,7 @@ package android.view {
    method public abstract int getLayoutDirection();
    method public abstract android.view.ViewParent getParent();
    method public abstract android.view.ViewParent getParentForAccessibility();
    method public default int getResolvedAutoFillMode();
    method public abstract int getTextAlignment();
    method public abstract int getTextDirection();
    method public abstract deprecated void invalidateChild(android.view.View, android.graphics.Rect);
@@ -50606,10 +50608,12 @@ package android.view.autofill {
  }
  public final class AutoFillManager {
    method public void focusChanged(android.view.View, boolean);
    method public void reset();
    method public void startAutoFillRequest(android.view.View);
    method public void startAutoFillRequestOnVirtualView(android.view.View, int, android.graphics.Rect);
    method public void stopAutoFillRequest(android.view.View);
    method public void stopAutoFillRequestOnVirtualView(android.view.View, int);
    method public void valueChanged(android.view.View);
    method public void virtualFocusChanged(android.view.View, int, android.graphics.Rect, boolean);
    method public void virtualValueChanged(android.view.View, int, android.view.autofill.AutoFillValue);
    field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
    field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
+6 −2
Original line number Diff line number Diff line
@@ -45274,6 +45274,7 @@ package android.view {
    method public float getPivotX();
    method public float getPivotY();
    method public android.view.PointerIcon getPointerIcon();
    method public int getResolvedAutoFillMode();
    method public android.content.res.Resources getResources();
    method public final boolean getRevealOnFocusHint();
    method public final int getRight();
@@ -46228,6 +46229,7 @@ package android.view {
    method public abstract int getLayoutDirection();
    method public abstract android.view.ViewParent getParent();
    method public abstract android.view.ViewParent getParentForAccessibility();
    method public default int getResolvedAutoFillMode();
    method public abstract int getTextAlignment();
    method public abstract int getTextDirection();
    method public abstract deprecated void invalidateChild(android.view.View, android.graphics.Rect);
@@ -47580,10 +47582,12 @@ package android.view.autofill {
  }
  public final class AutoFillManager {
    method public void focusChanged(android.view.View, boolean);
    method public void reset();
    method public void startAutoFillRequest(android.view.View);
    method public void startAutoFillRequestOnVirtualView(android.view.View, int, android.graphics.Rect);
    method public void stopAutoFillRequest(android.view.View);
    method public void stopAutoFillRequestOnVirtualView(android.view.View, int);
    method public void valueChanged(android.view.View);
    method public void virtualFocusChanged(android.view.View, int, android.graphics.Rect, boolean);
    method public void virtualValueChanged(android.view.View, int, android.view.autofill.AutoFillValue);
    field public static final java.lang.String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
    field public static final java.lang.String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
+61 −11
Original line number Diff line number Diff line
@@ -953,7 +953,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    public @interface AutoFillMode {}
    /**
     * This view inherits the autofill state from it's parent. If there is no parent it is
     * This view inherits the auto-fill 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,7 +968,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    public static final int AUTO_FILL_MODE_AUTO = 1;
    /**
     * Require the user to manually force an auto-fill request.
     * 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>
     *
     * Use with {@link #setAutoFillMode(int)} and <a href="#attr_android:autoFillMode">{@code
     * android:autoFillMode}.
     */
@@ -6670,13 +6674,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            imm.focusIn(this);
        }
        if (isAutoFillable()) {
            AutoFillManager afm = getAutoFillManager();
            if (afm != null) {
                afm.focusChanged(this, gainFocus);
            }
        }
        invalidate(true);
        ListenerInfo li = mListenerInfo;
        if (li != null && li.mOnFocusChangeListener != null) {
@@ -6686,6 +6683,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        if (mAttachInfo != null) {
            mAttachInfo.mKeyDispatchState.reset(this);
        }
        if (isAutoFillable() && isAttachedToWindow()
                && getResolvedAutoFillMode() == AUTO_FILL_MODE_AUTO) {
            AutoFillManager afm = getAutoFillManager();
            if (afm != null) {
                if (gainFocus) {
                    afm.startAutoFillRequest(this);
                } else {
                    afm.stopAutoFillRequest(this);
                }
            }
        }
    }
    /**
@@ -7248,8 +7257,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * <ol>
     * <li>Also implement {@link #autoFillVirtual(int, AutoFillValue)} to auto-fill the virtual
     * children.
     * <li>Call {@link android.view.autofill.AutoFillManager#virtualFocusChanged(View, int, Rect,
     * boolean)} when the focus inside the view changed.
     * <li>Call
     * {@link android.view.autofill.AutoFillManager#startAutoFillRequestOnVirtualView} and
     * {@link android.view.autofill.AutoFillManager#stopAutoFillRequestOnVirtualView(View, int)}
     * when the focus inside the view changed.
     * <li>Call {@link android.view.autofill.AutoFillManager#virtualValueChanged(View, int,
     * AutoFillValue)} when the value of a child changed.
     * <li>Call {@link android.view.autofill.AutoFillManager#reset()} when the auto-fill context
@@ -9483,6 +9494,31 @@ 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}. If the auto-
     *         fill mode can not be resolved e.g. {@link #getAutoFillMode()} is
     *         {@link #AUTO_FILL_MODE_INHERIT} and the {@link View} is detached
     *         {@link #AUTO_FILL_MODE_AUTO} is returned.
     */
    public @AutoFillMode int getResolvedAutoFillMode() {
        @AutoFillMode int autoFillMode = getAutoFillMode();
        if (autoFillMode == AUTO_FILL_MODE_INHERIT) {
            if (mParent == null) {
                return AUTO_FILL_MODE_AUTO;
            } 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.
@@ -16619,6 +16655,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            refreshDrawableState();
        }
        needGlobalAttributesUpdate(false);
        if (isAutoFillable() && isFocused() && getResolvedAutoFillMode() == AUTO_FILL_MODE_AUTO) {
            AutoFillManager afm = getAutoFillManager();
            if (afm != null) {
                afm.startAutoFillRequest(this);
            }
        }
    }
    void dispatchDetachedFromWindow() {
@@ -16665,6 +16708,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        if (mOverlay != null) {
            mOverlay.getOverlayView().dispatchDetachedFromWindow();
        }
        if (isAutoFillable() && isFocused() && getResolvedAutoFillMode() == AUTO_FILL_MODE_AUTO) {
            AutoFillManager afm = getAutoFillManager();
            if (afm != null) {
                afm.stopAutoFillRequest(this);
            }
        }
    }
    /**
+13 −0
Original line number Diff line number Diff line
@@ -659,4 +659,17 @@ 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 One of {@link View#AUTO_FILL_MODE_AUTO}, {@link View#AUTO_FILL_MODE_MANUAL} if the
     *         auto-fill mode can be resolved. If the auto-fill mode cannot be resolved
     *         {@link View#AUTO_FILL_MODE_AUTO}.
     *
     * @see View#getResolvedAutoFillMode()
     */
    default @View.AutoFillMode int getResolvedAutoFillMode() {
        return View.AUTO_FILL_MODE_AUTO;
    }
}
Loading