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

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

Make autofilled highlight an attribute

Fixes: 37738299
Test: - CtsAutoFillServiceTestCases
      - CtsUiRenderingTestCases:.testclasses.AutofillHighlightTests

Change-Id: I6106f7b2e44d18cd8c80c084f25737e43cbc44de
parent 5ee9a1df
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -312,6 +312,7 @@ package android {
    field public static final int autoUrlDetect = 16843404; // 0x101028c
    field public static final int autoVerify = 16844014; // 0x10104ee
    field public static final int autofillHints = 16844121; // 0x1010559
    field public static final int autofilledHighlight = 16844139; // 0x101056b
    field public static final int background = 16842964; // 0x10100d4
    field public static final int backgroundDimAmount = 16842802; // 0x1010032
    field public static final int backgroundDimEnabled = 16843295; // 0x101021f
@@ -1611,7 +1612,6 @@ package android {
    field public static final int alert_light_frame = 17301505; // 0x1080001
    field public static final int arrow_down_float = 17301506; // 0x1080002
    field public static final int arrow_up_float = 17301507; // 0x1080003
    field public static final int autofilled_highlight = 17301684; // 0x10800b4
    field public static final int bottom_bar = 17301658; // 0x108009a
    field public static final int btn_default = 17301508; // 0x1080004
    field public static final int btn_default_small = 17301509; // 0x1080005
+1 −1
Original line number Diff line number Diff line
@@ -432,6 +432,7 @@ package android {
    field public static final int autoUrlDetect = 16843404; // 0x101028c
    field public static final int autoVerify = 16844014; // 0x10104ee
    field public static final int autofillHints = 16844121; // 0x1010559
    field public static final int autofilledHighlight = 16844139; // 0x101056b
    field public static final int background = 16842964; // 0x10100d4
    field public static final int backgroundDimAmount = 16842802; // 0x1010032
    field public static final int backgroundDimEnabled = 16843295; // 0x101021f
@@ -1737,7 +1738,6 @@ package android {
    field public static final int alert_light_frame = 17301505; // 0x1080001
    field public static final int arrow_down_float = 17301506; // 0x1080002
    field public static final int arrow_up_float = 17301507; // 0x1080003
    field public static final int autofilled_highlight = 17301684; // 0x10800b4
    field public static final int bottom_bar = 17301658; // 0x108009a
    field public static final int btn_default = 17301508; // 0x1080004
    field public static final int btn_default_small = 17301509; // 0x1080005
+1 −1
Original line number Diff line number Diff line
@@ -312,6 +312,7 @@ package android {
    field public static final int autoUrlDetect = 16843404; // 0x101028c
    field public static final int autoVerify = 16844014; // 0x10104ee
    field public static final int autofillHints = 16844121; // 0x1010559
    field public static final int autofilledHighlight = 16844139; // 0x101056b
    field public static final int background = 16842964; // 0x10100d4
    field public static final int backgroundDimAmount = 16842802; // 0x1010032
    field public static final int backgroundDimEnabled = 16843295; // 0x101021f
@@ -1611,7 +1612,6 @@ package android {
    field public static final int alert_light_frame = 17301505; // 0x1080001
    field public static final int arrow_down_float = 17301506; // 0x1080002
    field public static final int arrow_up_float = 17301507; // 0x1080003
    field public static final int autofilled_highlight = 17301684; // 0x10800b4
    field public static final int bottom_bar = 17301658; // 0x108009a
    field public static final int btn_default = 17301508; // 0x1080004
    field public static final int btn_default_small = 17301509; // 0x1080005
+20 −10
Original line number Diff line number Diff line
@@ -804,6 +804,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    public static final int LAST_APP_ACCESSIBILITY_ID = Integer.MAX_VALUE / 2;
    /**
     * Attribute to find the autofilled highlight
     *
     * @see #getAutofilledDrawable()
     */
    private static final int[] AUTOFILL_HIGHLIGHT_ATTR =
            new int[]{android.R.attr.autofilledHighlight};
    /**
     * Signals that compatibility booleans have been initialized according to
     * target SDK versions.
@@ -7471,10 +7479,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * <p>See {@link #autofill(AutofillValue)} and
     * {@link #onProvideAutofillVirtualStructure(ViewStructure, int)} for more info.
     * <p>To indicate that a virtual view was autofilled
     * <code>@android:drawable/autofilled_highlight</code> should be drawn over it until the data
     * <code>?android:attr/autofilledHighlight</code> should be drawn over it until the data
     * changes.
     *
     * @param values map of values to be autofilled, keyed by virtual child id.
     *
     * @attr ref android.R.styleable#Theme_autofilledHighlight
     */
    public void autofill(@NonNull @SuppressWarnings("unused") SparseArray<AutofillValue> values) {
    }
@@ -20406,15 +20416,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @throws IllegalStateException if the drawable could not be found.
     */
    @NonNull private Drawable getAutofilledDrawable() {
    @Nullable private Drawable getAutofilledDrawable() {
        // Lazily load the isAutofilled drawable.
        if (mAttachInfo.mAutofilledDrawable == null) {
            mAttachInfo.mAutofilledDrawable = mContext.getDrawable(R.drawable.autofilled_highlight);
            if (mAttachInfo.mAutofilledDrawable == null) {
                throw new IllegalStateException(
                        "Could not find android:drawable/autofilled_highlight");
            }
            TypedArray a = mContext.getTheme().obtainStyledAttributes(AUTOFILL_HIGHLIGHT_ATTR);
            int attributeResourceId = a.getResourceId(0, 0);
            mAttachInfo.mAutofilledDrawable = mContext.getDrawable(attributeResourceId);
            a.recycle();
        }
        return mAttachInfo.mAutofilledDrawable;
@@ -20429,10 +20437,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        if (isAutofilled()) {
            Drawable autofilledHighlight = getAutofilledDrawable();
            if (autofilledHighlight != null) {
                autofilledHighlight.setBounds(0, 0, getWidth(), getHeight());
                autofilledHighlight.draw(canvas);
            }
        }
    }
    /**
     * Draw any foreground content for this view.
+3 −0
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@
             mode. -->
        <attr name="colorMultiSelectHighlight" format="color" />

        <!-- Drawable to be drawn over the view to mark it as autofilled-->
        <attr name="autofilledHighlight" format="reference" />

        <!-- Default disabled alpha for widgets that set enabled/disabled alpha programmatically. -->
        <attr name="disabledAlpha" format="float" />
        <!-- The alpha applied to the foreground color to create the primary text color. -->
Loading