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

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

Merge "Update drawables to fix CTS test failures" into lmp-preview-dev

parents 2987eefe 06318a08
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -706,9 +706,23 @@ public class BitmapDrawable extends Drawable {

        final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.BitmapDrawable);
        updateStateFromTypedArray(a);
        verifyState(a);
        a.recycle();
    }

    /**
     * Ensures all required attributes are set.
     *
     * @throws XmlPullParserException if any required attributes are missing
     */
    private void verifyState(TypedArray a) throws XmlPullParserException {
        final BitmapState state = mBitmapState;
        if (state.mBitmap == null) {
            throw new XmlPullParserException(a.getPositionDescription() +
                    ": <bitmap> requires a valid src attribute");
        }
    }

    /**
     * Updates the constant state from the values in the typed array.
     */
@@ -912,6 +926,7 @@ public class BitmapDrawable extends Drawable {
     */
    private BitmapDrawable(BitmapState state, Resources res, Theme theme) {
        if (theme != null && state.canApplyTheme()) {
            // If we need to apply a theme, implicitly mutate.
            mBitmapState = new BitmapState(state);
            applyTheme(theme);
        } else {
+4 −1
Original line number Diff line number Diff line
@@ -1662,9 +1662,12 @@ public class GradientDrawable extends Drawable {
     * @param theme Theme to apply to the drawable
     */
    private GradientDrawable(GradientState state, Theme theme) {
        mGradientState = new GradientState(state);
        if (theme != null && state.canApplyTheme()) {
            // If we need to apply a theme, implicitly mutate.
            mGradientState = new GradientState(state);
            applyTheme(theme);
        } else {
            mGradientState = state;
        }

        initializeWithState(state);
+1 −0
Original line number Diff line number Diff line
@@ -659,6 +659,7 @@ public class NinePatchDrawable extends Drawable {
     */
    private NinePatchDrawable(NinePatchState state, Resources res, Theme theme) {
        if (theme != null && state.canApplyTheme()) {
            // If we need to apply a theme, implicitly mutate.
            mNinePatchState = new NinePatchState(state);
            applyTheme(theme);
        } else {