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

Commit 8f35ba46 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Add autoFillMode attribute to View

Bug: 34077687
Test: Ran ViewAttributesTest
Change-Id: I76cfd04efa63e30d2e7bb22ff59c4e7db7c620bb
parent 1d30bd9e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -298,6 +298,7 @@ package android {
    field public static final int authorities = 16842776; // 0x1010018
    field public static final int autoAdvanceViewId = 16843535; // 0x101030f
    field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b
    field public static final int autoFillMode = 16844116; // 0x1010554
    field public static final int autoLink = 16842928; // 0x10100b0
    field public static final int autoMirrored = 16843754; // 0x10103ea
    field public static final int autoRemoveFromRecents = 16843847; // 0x1010447
@@ -24025,12 +24026,12 @@ package android.media.tv {
    field public static final java.lang.String COLUMN_DISPLAY_NAME = "display_name";
    field public static final java.lang.String COLUMN_DISPLAY_NUMBER = "display_number";
    field public static final java.lang.String COLUMN_INPUT_ID = "input_id";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_NETWORK_AFFILIATION = "network_affiliation";
    field public static final java.lang.String COLUMN_ORIGINAL_NETWORK_ID = "original_network_id";
    field public static final java.lang.String COLUMN_SEARCHABLE = "searchable";
@@ -44541,6 +44542,7 @@ package android.view {
    method public float getAlpha();
    method public android.view.animation.Animation getAnimation();
    method public android.os.IBinder getApplicationWindowToken();
    method public int getAutoFillMode();
    method public android.view.autofill.AutoFillType getAutoFillType();
    method public android.view.autofill.AutoFillValue getAutoFillValue();
    method public android.graphics.drawable.Drawable getBackground();
@@ -44856,6 +44858,7 @@ package android.view {
    method public void setActivated(boolean);
    method public void setAlpha(float);
    method public void setAnimation(android.view.animation.Animation);
    method public void setAutoFillMode(int);
    method public void setBackground(android.graphics.drawable.Drawable);
    method public void setBackgroundColor(int);
    method public deprecated void setBackgroundDrawable(android.graphics.drawable.Drawable);
@@ -44996,6 +44999,9 @@ package android.view {
    field public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0; // 0x0
    field public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 1; // 0x1
    field public static final android.util.Property<android.view.View, java.lang.Float> ALPHA;
    field public static final int AUTO_FILL_MODE_AUTO = 1; // 0x1
    field public static final int AUTO_FILL_MODE_INHERIT = 0; // 0x0
    field public static final int AUTO_FILL_MODE_MANUAL = 2; // 0x2
    field public static final int DRAG_FLAG_GLOBAL = 256; // 0x100
    field public static final int DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION = 64; // 0x40
    field public static final int DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION = 128; // 0x80
+7 −1
Original line number Diff line number Diff line
@@ -410,6 +410,7 @@ package android {
    field public static final int authorities = 16842776; // 0x1010018
    field public static final int autoAdvanceViewId = 16843535; // 0x101030f
    field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b
    field public static final int autoFillMode = 16844116; // 0x1010554
    field public static final int autoLink = 16842928; // 0x10100b0
    field public static final int autoMirrored = 16843754; // 0x10103ea
    field public static final int autoRemoveFromRecents = 16843847; // 0x1010447
@@ -25813,12 +25814,12 @@ package android.media.tv {
    field public static final java.lang.String COLUMN_DISPLAY_NAME = "display_name";
    field public static final java.lang.String COLUMN_DISPLAY_NUMBER = "display_number";
    field public static final java.lang.String COLUMN_INPUT_ID = "input_id";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_LOCKED = "locked";
    field public static final java.lang.String COLUMN_NETWORK_AFFILIATION = "network_affiliation";
    field public static final java.lang.String COLUMN_ORIGINAL_NETWORK_ID = "original_network_id";
@@ -47981,6 +47982,7 @@ package android.view {
    method public float getAlpha();
    method public android.view.animation.Animation getAnimation();
    method public android.os.IBinder getApplicationWindowToken();
    method public int getAutoFillMode();
    method public android.view.autofill.AutoFillType getAutoFillType();
    method public android.view.autofill.AutoFillValue getAutoFillValue();
    method public android.graphics.drawable.Drawable getBackground();
@@ -48296,6 +48298,7 @@ package android.view {
    method public void setActivated(boolean);
    method public void setAlpha(float);
    method public void setAnimation(android.view.animation.Animation);
    method public void setAutoFillMode(int);
    method public void setBackground(android.graphics.drawable.Drawable);
    method public void setBackgroundColor(int);
    method public deprecated void setBackgroundDrawable(android.graphics.drawable.Drawable);
@@ -48436,6 +48439,9 @@ package android.view {
    field public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0; // 0x0
    field public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 1; // 0x1
    field public static final android.util.Property<android.view.View, java.lang.Float> ALPHA;
    field public static final int AUTO_FILL_MODE_AUTO = 1; // 0x1
    field public static final int AUTO_FILL_MODE_INHERIT = 0; // 0x0
    field public static final int AUTO_FILL_MODE_MANUAL = 2; // 0x2
    field public static final int DRAG_FLAG_GLOBAL = 256; // 0x100
    field public static final int DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION = 64; // 0x40
    field public static final int DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION = 128; // 0x80
+7 −1
Original line number Diff line number Diff line
@@ -298,6 +298,7 @@ package android {
    field public static final int authorities = 16842776; // 0x1010018
    field public static final int autoAdvanceViewId = 16843535; // 0x101030f
    field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b
    field public static final int autoFillMode = 16844116; // 0x1010554
    field public static final int autoLink = 16842928; // 0x10100b0
    field public static final int autoMirrored = 16843754; // 0x10103ea
    field public static final int autoRemoveFromRecents = 16843847; // 0x1010447
@@ -24120,12 +24121,12 @@ package android.media.tv {
    field public static final java.lang.String COLUMN_DISPLAY_NAME = "display_name";
    field public static final java.lang.String COLUMN_DISPLAY_NUMBER = "display_number";
    field public static final java.lang.String COLUMN_INPUT_ID = "input_id";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
    field public static final java.lang.String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
    field public static final java.lang.String COLUMN_NETWORK_AFFILIATION = "network_affiliation";
    field public static final java.lang.String COLUMN_ORIGINAL_NETWORK_ID = "original_network_id";
    field public static final java.lang.String COLUMN_SEARCHABLE = "searchable";
@@ -44850,6 +44851,7 @@ package android.view {
    method public float getAlpha();
    method public android.view.animation.Animation getAnimation();
    method public android.os.IBinder getApplicationWindowToken();
    method public int getAutoFillMode();
    method public android.view.autofill.AutoFillType getAutoFillType();
    method public android.view.autofill.AutoFillValue getAutoFillValue();
    method public android.graphics.drawable.Drawable getBackground();
@@ -45166,6 +45168,7 @@ package android.view {
    method public void setActivated(boolean);
    method public void setAlpha(float);
    method public void setAnimation(android.view.animation.Animation);
    method public void setAutoFillMode(int);
    method public void setBackground(android.graphics.drawable.Drawable);
    method public void setBackgroundColor(int);
    method public deprecated void setBackgroundDrawable(android.graphics.drawable.Drawable);
@@ -45306,6 +45309,9 @@ package android.view {
    field public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0; // 0x0
    field public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 1; // 0x1
    field public static final android.util.Property<android.view.View, java.lang.Float> ALPHA;
    field public static final int AUTO_FILL_MODE_AUTO = 1; // 0x1
    field public static final int AUTO_FILL_MODE_INHERIT = 0; // 0x0
    field public static final int AUTO_FILL_MODE_MANUAL = 2; // 0x2
    field public static final int DRAG_FLAG_GLOBAL = 256; // 0x100
    field public static final int DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION = 64; // 0x40
    field public static final int DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION = 128; // 0x80
+88 −1
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ import android.widget.FrameLayout;
import android.widget.ScrollBarDrawable;
import com.android.internal.R;
import com.android.internal.util.Preconditions;
import com.android.internal.view.TooltipPopup;
import com.android.internal.view.menu.MenuBuilder;
import com.android.internal.widget.ScrollBarUtils;
@@ -942,6 +943,37 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    private static final int[] VISIBILITY_FLAGS = {VISIBLE, INVISIBLE, GONE};
    /** @hide */
    @IntDef({
            AUTO_FILL_MODE_INHERIT,
            AUTO_FILL_MODE_AUTO,
            AUTO_FILL_MODE_MANUAL
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface AutoFillMode {}
    /**
     * 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}.
     */
    public static final int AUTO_FILL_MODE_INHERIT = 0;
    /**
     * Allows this view to automatically trigger an auto-fill request when it get focus.
     * Use with {@link #setAutoFillMode(int)} and <a href="#attr_android:autoFillMode">
     * {@code android:autoFillMode}.
     */
    public static final int AUTO_FILL_MODE_AUTO = 1;
    /**
     * Require the user to manually force an auto-fill request.
     * Use with {@link #setAutoFillMode(int)} and <a href="#attr_android:autoFillMode">{@code
     * android:autoFillMode}.
     */
    public static final int AUTO_FILL_MODE_MANUAL = 2;
    /**
     * This view is enabled. Interpretation varies by subclass.
     * Use with ENABLED_MASK when calling setFlags.
@@ -2512,7 +2544,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *                 x                 * NO LONGER NEEDED, SHOULD BE REUSED *
     *                1                  PFLAG3_FINGER_DOWN
     *               1                   PFLAG3_FOCUSED_BY_DEFAULT
     *           xxxx                    * NO LONGER NEEDED, SHOULD BE REUSED *
     *             11                    PFLAG3_AUTO_FILL_MODE_MASK
     *           xx                      * NO LONGER NEEDED, SHOULD BE REUSED *
     *          1                        PFLAG3_OVERLAPPING_RENDERING_FORCED_VALUE
     *         1                         PFLAG3_HAS_OVERLAPPING_RENDERING_FORCED
     *        1                          PFLAG3_TEMPORARY_DETACH
@@ -2732,6 +2765,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private static final int PFLAG3_FOCUSED_BY_DEFAULT = 0x40000;
    /**
     * Shift for the place where the auto-fill mode is stored in the pflags
     *
     * @see #getAutoFillMode()
     * @see #setAutoFillMode(int)
     */
    private static final int PFLAG3_AUTO_FILL_MODE_SHIFT = 19;
    /**
     * Mask for auto-fill modes
     *
     * @see #getAutoFillMode()
     * @see #setAutoFillMode(int)
     */
    private static final int PFLAG3_AUTO_FILL_MODE_MASK = (AUTO_FILL_MODE_INHERIT
            | AUTO_FILL_MODE_AUTO | AUTO_FILL_MODE_MANUAL) << PFLAG3_AUTO_FILL_MODE_SHIFT;
    /**
     * Whether this view has rendered elements that overlap (see {@link
     * #hasOverlappingRendering()}, {@link #forceHasOverlappingRendering(boolean)}, and
@@ -4747,6 +4797,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                        setFocusedByDefault(a.getBoolean(attr, true));
                    }
                    break;
                case com.android.internal.R.styleable.View_autoFillMode:
                    if (a.peekValue(attr) != null) {
                        setAutoFillMode(a.getInt(attr, AUTO_FILL_MODE_INHERIT));
                    }
                    break;
            }
        }
@@ -8613,6 +8668,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * Set auto-fill mode for the view.
     *
     * @param autoFillMode One of {@link #AUTO_FILL_MODE_INHERIT}, {@link #AUTO_FILL_MODE_AUTO},
     *                     or {@link #AUTO_FILL_MODE_MANUAL}.
     * @attr ref android.R.styleable#View_autoFillMode
     */
    public void setAutoFillMode(@AutoFillMode int autoFillMode) {
        Preconditions.checkArgumentInRange(autoFillMode, AUTO_FILL_MODE_INHERIT,
                AUTO_FILL_MODE_MANUAL, "autoFillMode");
        mPrivateFlags3 &= ~PFLAG3_AUTO_FILL_MODE_MASK;
        mPrivateFlags3 |= autoFillMode << PFLAG3_AUTO_FILL_MODE_SHIFT;
    }
    /**
     * Set whether this view should have sound effects enabled for events such as
     * clicking and touching.
@@ -9216,6 +9286,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        return FOCUSABLE_IN_TOUCH_MODE == (mViewFlags & FOCUSABLE_IN_TOUCH_MODE);
    }
    /**
     * Returns the auto-fill mode for this view.
     *
     * @return One of {@link #AUTO_FILL_MODE_INHERIT}, {@link #AUTO_FILL_MODE_AUTO}, or
     * {@link #AUTO_FILL_MODE_MANUAL}.
     * @attr ref android.R.styleable#View_autoFillMode
     */
    @ViewDebug.ExportedProperty(mapping = {
            @ViewDebug.IntToString(from = AUTO_FILL_MODE_INHERIT, to = "AUTO_FILL_MODE_INHERIT"),
            @ViewDebug.IntToString(from = AUTO_FILL_MODE_AUTO, to = "AUTO_FILL_MODE_AUTO"),
            @ViewDebug.IntToString(from = AUTO_FILL_MODE_MANUAL, to = "AUTO_FILL_MODE_MANUAL")
            })
    @AutoFillMode
    public int getAutoFillMode() {
        return (mPrivateFlags3 & PFLAG3_AUTO_FILL_MODE_MASK) >> PFLAG3_AUTO_FILL_MODE_SHIFT;
    }
    /**
     * Find the nearest view in the specified direction that can take focus.
     * This does not actually give focus to that view.
+11 −0
Original line number Diff line number Diff line
@@ -2287,6 +2287,17 @@
            <enum name="auto" value="0x00000010" />
        </attr>

        <!-- 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. -->
            <enum name="inherit" value="0" />
            <!-- Allows this view to automatically trigger an auto-fill request when it get focus.
                 -->
            <enum name="auto" value="1" />
            <!-- The user has to manually force an auto-fill request for this view. -->
            <enum name="manual" value="2" />
        </attr>

        <!-- Boolean that controls whether a view can take focus while in touch mode.
             If this is true for a view, that view can gain focus when clicked on, and can keep
             focus if another view is clicked on that doesn't have this attribute set to true. -->
Loading