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

Commit 0d895396 authored by Diego Perez's avatar Diego Perez Committed by android-build-merger
Browse files

Merge "Make layoutlib more lenient with recoverable errors" into oc-dev am: 3134462c

am: 510916c1

Change-Id: I3c02fde71a2fc7b955b9ad124fe81eccf5a983a3
parents 86d1e9e2 510916c1
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -740,9 +740,11 @@ public final class BridgeTypedArray extends TypedArray {
        }
        int id = getResourceId(index, 0);
        String resIdMessage = id > 0 ? " (resource id 0x" + Integer.toHexString(id) + ')' : "";
        throw new NotFoundException(
                String.format("%1$s in %2$s%3$s is not a valid array resource.",
                        resVal.getValue(), mNames[index], resIdMessage));
        assert false :
                String.format("%1$s in %2$s%3$s is not a valid array resource.", resVal.getValue(),
                        mNames[index], resIdMessage);

        return new CharSequence[0];
    }

    @Override
+17 −4
Original line number Diff line number Diff line
@@ -88,8 +88,9 @@ public final class BlendComposite implements Composite {

    private void setAlpha(float alpha) {
        if (alpha < 0.0f || alpha > 1.0f) {
            throw new IllegalArgumentException(
                    "alpha must be comprised between 0.0f and 1.0f");
            assert false : "alpha must be comprised between 0.0f and 1.0f";
            alpha = Math.min(alpha, 1.0f);
            alpha = Math.max(alpha, 0.0f);
        }

        this.alpha = alpha;
@@ -266,9 +267,21 @@ public final class BlendComposite implements Composite {
                            return result;
                        }
                    };
                default:
                    assert false : "Blender not implement for " + composite.getMode().name();

                    // Ignore the blend
                    return new Blender() {
                        @Override
                        public int[] blend(int[] src, int[] dst, int[] result) {
                            result[0] = dst[0];
                            result[1] = dst[1];
                            result[2] = dst[2];
                            result[3] = dst[3];
                            return result;
                        }
                    };
            }
            throw new IllegalArgumentException("Blender not implement for " +
                                               composite.getMode().name());
        }
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -252,7 +252,8 @@ public class FontFamily_Delegate {
    /*package*/ static boolean addFont(FontFamily thisFontFamily, String path, int ttcIndex,
            FontConfig.Axis[] axes, int weight, int italic) {
        if (thisFontFamily.mBuilderPtr == 0) {
            throw new IllegalStateException("Unable to call addFont after freezing.");
            assert false : "Unable to call addFont after freezing.";
            return false;
        }
        final FontFamily_Delegate delegate = getDelegate(thisFontFamily.mBuilderPtr);
        return delegate != null && delegate.addFont(path, ttcIndex, weight, italic);
+6 −8
Original line number Diff line number Diff line
@@ -49,12 +49,7 @@ public abstract class Gradient_Delegate extends Shader_Delegate {
     */
    protected Gradient_Delegate(long nativeMatrix, int colors[], float positions[]) {
        super(nativeMatrix);
        if (colors.length < 2) {
            throw new IllegalArgumentException("needs >= 2 number of colors");
        }
        if (positions != null && colors.length != positions.length) {
            throw new IllegalArgumentException("color and position arrays must be of equal length");
        }
        assert colors.length >= 2 : "needs >= 2 number of colors";

        if (positions == null) {
            float spacing = 1.f / (colors.length - 1);
@@ -64,6 +59,9 @@ public abstract class Gradient_Delegate extends Shader_Delegate {
            for (int i = 1; i < colors.length - 1; i++) {
                positions[i] = spacing * i;
            }
        } else {
            assert colors.length == positions.length :
                    "color and position " + "arrays must be of equal length";
        }

        mColors = colors;
+4 −3
Original line number Diff line number Diff line
@@ -548,10 +548,11 @@ public final class Path_Delegate {
            case EVEN_ODD:
            case INVERSE_EVEN_ODD:
                return GeneralPath.WIND_EVEN_ODD;
        }

            default:
                assert false;
        throw new IllegalArgumentException();
                return GeneralPath.WIND_NON_ZERO;
        }
    }

    @NonNull
Loading