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

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

Merge changes from topics 'KeyboardFocusHighlight-oc-dev',...

Merge changes from topics 'KeyboardFocusHighlight-oc-dev', 'KeyboardFocusHighlight_ mDefaultFocusHighlightEnabled-oc-dev', 'KeyboardFocusHighlight_ hasFocusStateSpecified-oc-dev' into oc-dev

* changes:
  Fix broken CTS tests.
  Draw a default focus highlight if needed.
  Add a public API defaultFocusHighlightEnabled.
  Detect unhandled keyboard focused state.
parents c240c9b1 fb62ecb2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -471,6 +471,7 @@ package android {
    field public static final deprecated int dayOfWeekBackground = 16843924; // 0x1010494
    field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495
    field public static final int debuggable = 16842767; // 0x101000f
    field public static final int defaultFocusHighlightEnabled = 16844133; // 0x1010565
    field public static final int defaultHeight = 16844021; // 0x10104f5
    field public static final int defaultToDeviceProtectedStorage = 16844036; // 0x1010504
    field public static final int defaultValue = 16843245; // 0x10101ed
@@ -45343,6 +45344,7 @@ package android.view {
    method public java.lang.CharSequence getContentDescription();
    method public final android.content.Context getContext();
    method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo();
    method public final boolean getDefaultFocusHighlightEnabled();
    method public static int getDefaultSize(int, int);
    method public android.view.Display getDisplay();
    method public final int[] getDrawableState();
@@ -45661,6 +45663,7 @@ package android.view {
    method public void setClipToOutline(boolean);
    method public void setContentDescription(java.lang.CharSequence);
    method public void setContextClickable(boolean);
    method public void setDefaultFocusHighlightEnabled(boolean);
    method public void setDrawingCacheBackgroundColor(int);
    method public void setDrawingCacheEnabled(boolean);
    method public void setDrawingCacheQuality(int);
+3 −0
Original line number Diff line number Diff line
@@ -587,6 +587,7 @@ package android {
    field public static final deprecated int dayOfWeekBackground = 16843924; // 0x1010494
    field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495
    field public static final int debuggable = 16842767; // 0x101000f
    field public static final int defaultFocusHighlightEnabled = 16844133; // 0x1010565
    field public static final int defaultHeight = 16844021; // 0x10104f5
    field public static final int defaultToDeviceProtectedStorage = 16844036; // 0x1010504
    field public static final int defaultValue = 16843245; // 0x10101ed
@@ -48900,6 +48901,7 @@ package android.view {
    method public java.lang.CharSequence getContentDescription();
    method public final android.content.Context getContext();
    method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo();
    method public final boolean getDefaultFocusHighlightEnabled();
    method public static int getDefaultSize(int, int);
    method public android.view.Display getDisplay();
    method public final int[] getDrawableState();
@@ -49218,6 +49220,7 @@ package android.view {
    method public void setClipToOutline(boolean);
    method public void setContentDescription(java.lang.CharSequence);
    method public void setContextClickable(boolean);
    method public void setDefaultFocusHighlightEnabled(boolean);
    method public void setDrawingCacheBackgroundColor(int);
    method public void setDrawingCacheEnabled(boolean);
    method public void setDrawingCacheQuality(int);
+4 −0
Original line number Diff line number Diff line
@@ -471,6 +471,7 @@ package android {
    field public static final deprecated int dayOfWeekBackground = 16843924; // 0x1010494
    field public static final deprecated int dayOfWeekTextAppearance = 16843925; // 0x1010495
    field public static final int debuggable = 16842767; // 0x101000f
    field public static final int defaultFocusHighlightEnabled = 16844133; // 0x1010565
    field public static final int defaultHeight = 16844021; // 0x10104f5
    field public static final int defaultToDeviceProtectedStorage = 16844036; // 0x1010504
    field public static final int defaultValue = 16843245; // 0x10101ed
@@ -14029,6 +14030,7 @@ package android.graphics.drawable {
    method public boolean getPadding(android.graphics.Rect);
    method public int[] getState();
    method public android.graphics.Region getTransparentRegion();
    method public boolean hasFocusStateSpecified();
    method public void inflate(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public void inflate(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method public void invalidateSelf();
@@ -45715,6 +45717,7 @@ package android.view {
    method public java.lang.CharSequence getContentDescription();
    method public final android.content.Context getContext();
    method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo();
    method public final boolean getDefaultFocusHighlightEnabled();
    method public static int getDefaultSize(int, int);
    method public android.view.Display getDisplay();
    method public final int[] getDrawableState();
@@ -46037,6 +46040,7 @@ package android.view {
    method public void setClipToOutline(boolean);
    method public void setContentDescription(java.lang.CharSequence);
    method public void setContextClickable(boolean);
    method public void setDefaultFocusHighlightEnabled(boolean);
    method public void setDrawingCacheBackgroundColor(int);
    method public void setDrawingCacheEnabled(boolean);
    method public void setDrawingCacheQuality(int);
+10 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ import java.util.Arrays;
 * file. An item with no state spec is considered to match any set of states and is generally
 * useful as a final item to be used as a default.
 * <p>
 * If an item with no state spec if placed before other items, those items
 * If an item with no state spec is placed before other items, those items
 * will be ignored.
 *
 * <a name="ItemAttributes"></a>
@@ -520,6 +520,15 @@ public class ColorStateList extends ComplexColor implements Parcelable {
        return mStateSpecs.length >= 1 && mStateSpecs[0].length > 0;
    }

    /**
     * Return whether the state spec list has at least one item explicitly specifying
     * {@link android.R.attr#state_focused}.
     * @hide
     */
    public boolean hasFocusStateSpecified() {
        return StateSet.containsAttribute(mStateSpecs, R.attr.state_focused);
    }

    /**
     * Indicates whether this color state list is opaque, which means that every
     * color returned from {@link #getColorForState(int[], int)} has an alpha
+23 −0
Original line number Diff line number Diff line
@@ -228,6 +228,29 @@ public class StateSet {
        return true;
    }

    /**
     * Check whether a list of state specs has an attribute specified.
     * @param stateSpecs a list of state specs we're checking.
     * @param attr an attribute we're looking for.
     * @return {@code true} if the attribute is contained in the state specs.
     * @hide
     */
    public static boolean containsAttribute(int[][] stateSpecs, int attr) {
        if (stateSpecs != null) {
            for (int[] spec : stateSpecs) {
                if (spec == null) {
                    break;
                }
                for (int specAttr : spec) {
                    if (specAttr == attr || -specAttr == attr) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    public static int[] trimStateSet(int[] states, int newSize) {
        if (states.length == newSize) {
            return states;
Loading