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

Commit 6e083aea authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am 58248d04: Merge "Update drawables to fix CTS test failures" into lmp-preview-dev

* commit '58248d049e8b17dd60e4e94e784c09b00e0a7e9d':
  Update drawables to fix CTS test failures
parents f7807bf5 f2dc2d14
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 {