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

Commit 4562f0bc authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Fix drawable CTS breakages" into mnc-dev

parents 1cd7e4c3 b63b93de
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -149,6 +149,23 @@ public class ClipDrawable extends DrawableWrapper {
        return true;
    }

    @Override
    public int getOpacity() {
        final Drawable dr = getDrawable();
        final int opacity = dr.getOpacity();
        if (opacity == PixelFormat.TRANSPARENT || dr.getLevel() == 0) {
            return PixelFormat.TRANSPARENT;
        }

        final int level = getLevel();
        if (level >= MAX_LEVEL) {
            return dr.getOpacity();
        }

        // Some portion of non-transparent drawable is showing.
        return PixelFormat.TRANSLUCENT;
    }

    @Override
    public void draw(Canvas canvas) {
        final Drawable dr = getDrawable();
+5 −8
Original line number Diff line number Diff line
@@ -180,7 +180,8 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb
    @Override
    public int getChangingConfigurations() {
        return super.getChangingConfigurations()
                | (mState != null ? mState.getChangingConfigurations() : 0);
                | (mState != null ? mState.getChangingConfigurations() : 0)
                | mDrawable.getChangingConfigurations();
    }

    @Override
@@ -366,15 +367,12 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb
    }

    /**
     * Called during inflation to inflate the child element.
     * Called during inflation to inflate the child element. The last valid
     * child element will take precedence over any other child elements or
     * explicit drawable attribute.
     */
    void inflateChildDrawable(Resources r, XmlPullParser parser, AttributeSet attrs,
            Resources.Theme theme) throws XmlPullParserException, IOException {
        // Drawable specified on the root element takes precedence.
        if (getDrawable() != null) {
            return;
        }

        // Seek to the first child element.
        Drawable dr = null;
        int type;
@@ -383,7 +381,6 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb
                && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
            if (type == XmlPullParser.START_TAG) {
                dr = Drawable.createFromXmlInner(r, parser, attrs, theme);
                break;
            }
        }