Merge "LayoutLib: use tags in logs." into honeycomb
This commit is contained in:
committed by
Android (Google) Code Review
commit
cb27d4b2f5
@@ -18,6 +18,7 @@ package android.graphics;
|
|||||||
|
|
||||||
import com.android.ide.common.rendering.api.ResourceDensity;
|
import com.android.ide.common.rendering.api.ResourceDensity;
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
|
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -351,7 +352,7 @@ public class BitmapFactory {
|
|||||||
If the exception happened on open, bm will be null.
|
If the exception happened on open, bm will be null.
|
||||||
If it happened on close, bm is still valid.
|
If it happened on close, bm is still valid.
|
||||||
*/
|
*/
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_READ,
|
||||||
String.format("Error decoding bitmap of id 0x%x", id), e);
|
String.format("Error decoding bitmap of id 0x%x", id), e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
@@ -451,7 +452,7 @@ public class BitmapFactory {
|
|||||||
Bitmap bm;
|
Bitmap bm;
|
||||||
|
|
||||||
if (is instanceof AssetManager.AssetInputStream) {
|
if (is instanceof AssetManager.AssetInputStream) {
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
"Bitmap.decodeStream: " +
|
"Bitmap.decodeStream: " +
|
||||||
"InputStream is unsupported (AssetManager.AssetInputStream)");
|
"InputStream is unsupported (AssetManager.AssetInputStream)");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import android.graphics.Shader.TileMode;
|
import android.graphics.Shader.TileMode;
|
||||||
@@ -112,7 +113,8 @@ public class BitmapShader_Delegate extends Shader_Delegate {
|
|||||||
try {
|
try {
|
||||||
canvasMatrix = xform.createInverse();
|
canvasMatrix = xform.createInverse();
|
||||||
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
||||||
Bridge.getLog().error(null, "Unable to inverse matrix in BitmapShader", e);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
|
"Unable to inverse matrix in BitmapShader", e);
|
||||||
canvasMatrix = new java.awt.geom.AffineTransform();
|
canvasMatrix = new java.awt.geom.AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +122,8 @@ public class BitmapShader_Delegate extends Shader_Delegate {
|
|||||||
try {
|
try {
|
||||||
localMatrix = localMatrix.createInverse();
|
localMatrix = localMatrix.createInverse();
|
||||||
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
||||||
Bridge.getLog().error(null, "Unable to inverse matrix in BitmapShader", e);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
|
"Unable to inverse matrix in BitmapShader", e);
|
||||||
localMatrix = new java.awt.geom.AffineTransform();
|
localMatrix = new java.awt.geom.AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package android.graphics;
|
|||||||
|
|
||||||
import com.android.ide.common.rendering.api.ResourceDensity;
|
import com.android.ide.common.rendering.api.ResourceDensity;
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import android.graphics.Bitmap.Config;
|
import android.graphics.Bitmap.Config;
|
||||||
@@ -248,7 +249,8 @@ public final class Bitmap_Delegate {
|
|||||||
|
|
||||||
/*package*/ static boolean nativeCompress(int nativeBitmap, int format, int quality,
|
/*package*/ static boolean nativeCompress(int nativeBitmap, int format, int quality,
|
||||||
OutputStream stream, byte[] tempStorage) {
|
OutputStream stream, byte[] tempStorage) {
|
||||||
Bridge.getLog().error(null, "Bitmap.compress() is not supported");
|
Bridge.getLog().error(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
|
"Bitmap.compress() is not supported");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +385,7 @@ public final class Bitmap_Delegate {
|
|||||||
/*package*/ static Bitmap nativeCreateFromParcel(Parcel p) {
|
/*package*/ static Bitmap nativeCreateFromParcel(Parcel p) {
|
||||||
// This is only called by Bitmap.CREATOR (Parcelable.Creator<Bitmap>), which is only
|
// This is only called by Bitmap.CREATOR (Parcelable.Creator<Bitmap>), which is only
|
||||||
// used during aidl call so really this should not be called.
|
// used during aidl call so really this should not be called.
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
"AIDL is not suppored, and therefore Bitmaps cannot be created from parcels.");
|
"AIDL is not suppored, and therefore Bitmaps cannot be created from parcels.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -392,7 +394,7 @@ public final class Bitmap_Delegate {
|
|||||||
int density, Parcel p) {
|
int density, Parcel p) {
|
||||||
// This is only called when sending a bitmap through aidl, so really this should not
|
// This is only called when sending a bitmap through aidl, so really this should not
|
||||||
// be called.
|
// be called.
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
"AIDL is not suppored, and therefore Bitmaps cannot be written to parcels.");
|
"AIDL is not suppored, and therefore Bitmaps cannot be written to parcels.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -408,7 +410,7 @@ public final class Bitmap_Delegate {
|
|||||||
Paint_Delegate paint = Paint_Delegate.getDelegate(nativePaint);
|
Paint_Delegate paint = Paint_Delegate.getDelegate(nativePaint);
|
||||||
|
|
||||||
if (paint != null && paint.getMaskFilter() != null) {
|
if (paint != null && paint.getMaskFilter() != null) {
|
||||||
Bridge.getLog().fidelityWarning(null,
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MASKFILTER,
|
||||||
"MaskFilter not supported in Bitmap.extractAlpha",
|
"MaskFilter not supported in Bitmap.extractAlpha",
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
import com.android.layoutlib.bridge.impl.GcSnapshot;
|
import com.android.layoutlib.bridge.impl.GcSnapshot;
|
||||||
|
|
||||||
@@ -422,7 +423,7 @@ public final class Canvas_Delegate {
|
|||||||
|
|
||||||
if (matrixDelegate.hasPerspective()) {
|
if (matrixDelegate.hasPerspective()) {
|
||||||
assert false;
|
assert false;
|
||||||
Bridge.getLog().fidelityWarning(null,
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
"android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " +
|
"android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " +
|
||||||
"supports affine transformations.", null);
|
"supports affine transformations.", null);
|
||||||
}
|
}
|
||||||
@@ -492,7 +493,8 @@ public final class Canvas_Delegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (filterDelegate.isSupported() == false) {
|
if (filterDelegate.isSupported() == false) {
|
||||||
Bridge.getLog().fidelityWarning(null, filterDelegate.getSupportMessage(), null);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_DRAWFILTER,
|
||||||
|
filterDelegate.getSupportMessage(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import android.graphics.Shader.TileMode;
|
import android.graphics.Shader.TileMode;
|
||||||
@@ -135,7 +136,8 @@ public final class LinearGradient_Delegate extends Gradient_Delegate {
|
|||||||
try {
|
try {
|
||||||
canvasMatrix = xform.createInverse();
|
canvasMatrix = xform.createInverse();
|
||||||
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
||||||
Bridge.getLog().error(null, "Unable to inverse matrix in LinearGradient", e);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
|
"Unable to inverse matrix in LinearGradient", e);
|
||||||
canvasMatrix = new java.awt.geom.AffineTransform();
|
canvasMatrix = new java.awt.geom.AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +145,8 @@ public final class LinearGradient_Delegate extends Gradient_Delegate {
|
|||||||
try {
|
try {
|
||||||
localMatrix = localMatrix.createInverse();
|
localMatrix = localMatrix.createInverse();
|
||||||
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
||||||
Bridge.getLog().error(null, "Unable to inverse matrix in LinearGradient", e);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
|
"Unable to inverse matrix in LinearGradient", e);
|
||||||
localMatrix = new java.awt.geom.AffineTransform();
|
localMatrix = new java.awt.geom.AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package android.graphics;
|
|||||||
|
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import android.graphics.Matrix.ScaleToFit;
|
import android.graphics.Matrix.ScaleToFit;
|
||||||
@@ -612,7 +613,7 @@ public final class Matrix_Delegate {
|
|||||||
/*package*/ static boolean native_setPolyToPoly(int native_object, float[] src, int srcIndex,
|
/*package*/ static boolean native_setPolyToPoly(int native_object, float[] src, int srcIndex,
|
||||||
float[] dst, int dstIndex, int pointCount) {
|
float[] dst, int dstIndex, int pointCount) {
|
||||||
// FIXME
|
// FIXME
|
||||||
Bridge.getLog().fidelityWarning(null,
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
"Matrix.setPolyToPoly is not supported.",
|
"Matrix.setPolyToPoly is not supported.",
|
||||||
null);
|
null);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
import com.android.layoutlib.bridge.impl.GcSnapshot;
|
import com.android.layoutlib.bridge.impl.GcSnapshot;
|
||||||
import com.android.ninepatch.NinePatchChunk;
|
import com.android.ninepatch.NinePatchChunk;
|
||||||
@@ -196,10 +197,12 @@ public final class NinePatch_Delegate {
|
|||||||
sChunkCache.put(array, new SoftReference<NinePatchChunk>(chunk));
|
sChunkCache.put(array, new SoftReference<NinePatchChunk>(chunk));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Bridge.getLog().error(null, "Failed to deserialize NinePatchChunk content.", e);
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
|
"Failed to deserialize NinePatchChunk content.", e);
|
||||||
return null;
|
return null;
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
Bridge.getLog().error(null, "Failed to deserialize NinePatchChunk class.", e);
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
|
"Failed to deserialize NinePatchChunk class.", e);
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
if (ois != null) {
|
if (ois != null) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import android.graphics.Paint.FontMetrics;
|
import android.graphics.Paint.FontMetrics;
|
||||||
@@ -179,7 +180,7 @@ public class Paint_Delegate {
|
|||||||
return stroke;
|
return stroke;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Bridge.getLog().fidelityWarning(null,
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_PATHEFFECT,
|
||||||
effectDelegate.getSupportMessage(),
|
effectDelegate.getSupportMessage(),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
@@ -375,7 +376,8 @@ public class Paint_Delegate {
|
|||||||
/*package*/ static void nSetShadowLayer(Paint thisPaint, float radius, float dx, float dy,
|
/*package*/ static void nSetShadowLayer(Paint thisPaint, float radius, float dx, float dy,
|
||||||
int color) {
|
int color) {
|
||||||
// FIXME
|
// FIXME
|
||||||
Bridge.getLog().fidelityWarning(null, "Paint.setShadowLayer is not supported.", null);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
|
"Paint.setShadowLayer is not supported.", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*package*/ static float getTextSize(Paint thisPaint) {
|
/*package*/ static float getTextSize(Paint thisPaint) {
|
||||||
@@ -691,7 +693,8 @@ public class Paint_Delegate {
|
|||||||
// since none of those are supported, display a fidelity warning right away
|
// since none of those are supported, display a fidelity warning right away
|
||||||
ColorFilter_Delegate filterDelegate = delegate.getColorFilter();
|
ColorFilter_Delegate filterDelegate = delegate.getColorFilter();
|
||||||
if (filterDelegate != null && filterDelegate.isSupported() == false) {
|
if (filterDelegate != null && filterDelegate.isSupported() == false) {
|
||||||
Bridge.getLog().fidelityWarning(null, filterDelegate.getSupportMessage(), null);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_COLORFILTER,
|
||||||
|
filterDelegate.getSupportMessage(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return filter;
|
return filter;
|
||||||
@@ -729,7 +732,8 @@ public class Paint_Delegate {
|
|||||||
// since none of those are supported, display a fidelity warning right away
|
// since none of those are supported, display a fidelity warning right away
|
||||||
MaskFilter_Delegate filterDelegate = delegate.getMaskFilter();
|
MaskFilter_Delegate filterDelegate = delegate.getMaskFilter();
|
||||||
if (filterDelegate != null && filterDelegate.isSupported() == false) {
|
if (filterDelegate != null && filterDelegate.isSupported() == false) {
|
||||||
Bridge.getLog().fidelityWarning(null, filterDelegate.getSupportMessage(), null);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MASKFILTER,
|
||||||
|
filterDelegate.getSupportMessage(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return maskfilter;
|
return maskfilter;
|
||||||
@@ -759,7 +763,8 @@ public class Paint_Delegate {
|
|||||||
// since none of those are supported, display a fidelity warning right away
|
// since none of those are supported, display a fidelity warning right away
|
||||||
Rasterizer_Delegate rasterizerDelegate = delegate.getRasterizer();
|
Rasterizer_Delegate rasterizerDelegate = delegate.getRasterizer();
|
||||||
if (rasterizerDelegate != null && rasterizerDelegate.isSupported() == false) {
|
if (rasterizerDelegate != null && rasterizerDelegate.isSupported() == false) {
|
||||||
Bridge.getLog().fidelityWarning(null, rasterizerDelegate.getSupportMessage(), null);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_RASTERIZER,
|
||||||
|
rasterizerDelegate.getSupportMessage(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rasterizer;
|
return rasterizer;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import android.graphics.Path.Direction;
|
import android.graphics.Path.Direction;
|
||||||
@@ -695,7 +696,7 @@ public final class Path_Delegate {
|
|||||||
public void transform(Matrix_Delegate matrix, Path_Delegate dst) {
|
public void transform(Matrix_Delegate matrix, Path_Delegate dst) {
|
||||||
if (matrix.hasPerspective()) {
|
if (matrix.hasPerspective()) {
|
||||||
assert false;
|
assert false;
|
||||||
Bridge.getLog().fidelityWarning(null,
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
"android.graphics.Path#transform() only " +
|
"android.graphics.Path#transform() only " +
|
||||||
"supports affine transformations.", null);
|
"supports affine transformations.", null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
@@ -72,7 +73,8 @@ public class PorterDuffXfermode_Delegate extends Xfermode_Delegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bridge.getLog().error(null, String.format("Unknown PorterDuff.Mode: %d", mode));
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
|
String.format("Unknown PorterDuff.Mode: %d", mode));
|
||||||
assert false;
|
assert false;
|
||||||
return PorterDuff.Mode.SRC_OVER;
|
return PorterDuff.Mode.SRC_OVER;
|
||||||
}
|
}
|
||||||
@@ -114,7 +116,7 @@ public class PorterDuffXfermode_Delegate extends Xfermode_Delegate {
|
|||||||
return AlphaComposite.getInstance(AlphaComposite.XOR, falpha);
|
return AlphaComposite.getInstance(AlphaComposite.XOR, falpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bridge.getLog().fidelityWarning(null,
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_BROKEN,
|
||||||
String.format("Unsupported PorterDuff Mode: %s", mode.name()),
|
String.format("Unsupported PorterDuff Mode: %s", mode.name()),
|
||||||
null);
|
null);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import android.graphics.Shader.TileMode;
|
import android.graphics.Shader.TileMode;
|
||||||
@@ -124,7 +125,8 @@ public class RadialGradient_Delegate extends Gradient_Delegate {
|
|||||||
try {
|
try {
|
||||||
canvasMatrix = xform.createInverse();
|
canvasMatrix = xform.createInverse();
|
||||||
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
||||||
Bridge.getLog().error(null, "Unable to inverse matrix in RadialGradient", e);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
|
"Unable to inverse matrix in RadialGradient", e);
|
||||||
canvasMatrix = new java.awt.geom.AffineTransform();
|
canvasMatrix = new java.awt.geom.AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +134,8 @@ public class RadialGradient_Delegate extends Gradient_Delegate {
|
|||||||
try {
|
try {
|
||||||
localMatrix = localMatrix.createInverse();
|
localMatrix = localMatrix.createInverse();
|
||||||
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
||||||
Bridge.getLog().error(null, "Unable to inverse matrix in RadialGradient", e);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
|
"Unable to inverse matrix in RadialGradient", e);
|
||||||
localMatrix = new java.awt.geom.AffineTransform();
|
localMatrix = new java.awt.geom.AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
@@ -415,7 +416,7 @@ public class Region_Delegate {
|
|||||||
/*package*/ static int nativeCreateFromParcel(Parcel p) {
|
/*package*/ static int nativeCreateFromParcel(Parcel p) {
|
||||||
// This is only called by Region.CREATOR (Parcelable.Creator<Region>), which is only
|
// This is only called by Region.CREATOR (Parcelable.Creator<Region>), which is only
|
||||||
// used during aidl call so really this should not be called.
|
// used during aidl call so really this should not be called.
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
"AIDL is not suppored, and therefore Regions cannot be created from parcels.");
|
"AIDL is not suppored, and therefore Regions cannot be created from parcels.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -424,7 +425,7 @@ public class Region_Delegate {
|
|||||||
Parcel p) {
|
Parcel p) {
|
||||||
// This is only called when sending a region through aidl, so really this should not
|
// This is only called when sending a region through aidl, so really this should not
|
||||||
// be called.
|
// be called.
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
"AIDL is not suppored, and therefore Regions cannot be written to parcels.");
|
"AIDL is not suppored, and therefore Regions cannot be written to parcels.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +117,8 @@ public class SweepGradient_Delegate extends Gradient_Delegate {
|
|||||||
try {
|
try {
|
||||||
canvasMatrix = xform.createInverse();
|
canvasMatrix = xform.createInverse();
|
||||||
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
||||||
Bridge.getLog().error(null, "Unable to inverse matrix in SweepGradient", e);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
|
"Unable to inverse matrix in SweepGradient", e);
|
||||||
canvasMatrix = new java.awt.geom.AffineTransform();
|
canvasMatrix = new java.awt.geom.AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +126,8 @@ public class SweepGradient_Delegate extends Gradient_Delegate {
|
|||||||
try {
|
try {
|
||||||
localMatrix = localMatrix.createInverse();
|
localMatrix = localMatrix.createInverse();
|
||||||
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
} catch (java.awt.geom.NoninvertibleTransformException e) {
|
||||||
Bridge.getLog().error(null, "Unable to inverse matrix in SweepGradient", e);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_MATRIX,
|
||||||
|
"Unable to inverse matrix in SweepGradient", e);
|
||||||
localMatrix = new java.awt.geom.AffineTransform();
|
localMatrix = new java.awt.geom.AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics;
|
package android.graphics;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.impl.DelegateManager;
|
import com.android.layoutlib.bridge.impl.DelegateManager;
|
||||||
import com.android.layoutlib.bridge.impl.FontLoader;
|
import com.android.layoutlib.bridge.impl.FontLoader;
|
||||||
|
|
||||||
@@ -125,12 +126,14 @@ public final class Typeface_Delegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*package*/ static synchronized int nativeCreateFromAsset(AssetManager mgr, String path) {
|
/*package*/ static synchronized int nativeCreateFromAsset(AssetManager mgr, String path) {
|
||||||
Bridge.getLog().fidelityWarning(null, "Typeface.createFromAsset() is not supported.", null);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
|
"Typeface.createFromAsset() is not supported.", null);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*package*/ static synchronized int nativeCreateFromFile(String path) {
|
/*package*/ static synchronized int nativeCreateFromFile(String path) {
|
||||||
Bridge.getLog().fidelityWarning(null, "Typeface.createFromFile() is not supported.", null);
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_UNSUPPORTED,
|
||||||
|
"Typeface.createFromFile() is not supported.", null);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge {
|
|||||||
}
|
}
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
if (log != null) {
|
if (log != null) {
|
||||||
log.error(null,
|
log.error(BridgeConstants.TAG_BROKEN,
|
||||||
"Failed to load com.android.internal.R from the layout library jar",
|
"Failed to load com.android.internal.R from the layout library jar",
|
||||||
throwable);
|
throwable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,4 +64,18 @@ public class BridgeConstants {
|
|||||||
public final static String MATCH_PARENT = "match_parent";
|
public final static String MATCH_PARENT = "match_parent";
|
||||||
public final static String FILL_PARENT = "fill_parent";
|
public final static String FILL_PARENT = "fill_parent";
|
||||||
public final static String WRAP_CONTENT = "wrap_content";
|
public final static String WRAP_CONTENT = "wrap_content";
|
||||||
|
|
||||||
|
public final static String TAG_UNSUPPORTED = "unsupported";
|
||||||
|
public static final String TAG_BROKEN = "broken";
|
||||||
|
public final static String TAG_RESOURCES_RESOLVE = "resources.resolve";
|
||||||
|
public final static String TAG_RESOURCES_READ = "resources.read";
|
||||||
|
public final static String TAG_RESOURCES_FORMAT = "resources.format";
|
||||||
|
public static final String TAG_MATRIX = "matrix";
|
||||||
|
public final static String TAG_MASKFILTER = "maskfilter";
|
||||||
|
public static final String TAG_DRAWFILTER = "drawfilter";
|
||||||
|
public static final String TAG_PATHEFFECT = "patheffect";
|
||||||
|
public static final String TAG_COLORFILTER = "colorfilter";
|
||||||
|
public static final String TAG_RASTERIZER = "rasterizer";
|
||||||
|
public static final String TAG_SHADER = "shader";
|
||||||
|
public static final String TAG_XFERMODE = "xfermode";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -336,7 +336,8 @@ public final class BridgeContext extends Activity {
|
|||||||
isPlatformFile = false;
|
isPlatformFile = false;
|
||||||
} else if (set != null) { // null parser is ok
|
} else if (set != null) { // null parser is ok
|
||||||
// really this should not be happening since its instantiated in Bridge
|
// really this should not be happening since its instantiated in Bridge
|
||||||
Bridge.getLog().error(null, "Parser is not a BridgeXmlBlockParser!");
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
|
"Parser is not a BridgeXmlBlockParser!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,7 +706,7 @@ public final class BridgeContext extends Activity {
|
|||||||
// This is normal if the resource is an ID that is generated automatically.
|
// This is normal if the resource is an ID that is generated automatically.
|
||||||
// For other resources, we output a warning
|
// For other resources, we output a warning
|
||||||
if ("+id".equals(resType) == false && "+android:id".equals(resType) == false) { //$NON-NLS-1$ //$NON-NLS-2$
|
if ("+id".equals(resType) == false && "+android:id".equals(resType) == false) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
Bridge.getLog().warning("resources", //$NON-NLS-1$
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
"Couldn't resolve resource @" +
|
"Couldn't resolve resource @" +
|
||||||
(frameworkOnly ? "android:" : "") + resType + "/" + resName);
|
(frameworkOnly ? "android:" : "") + resType + "/" + resName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ public final class BridgeInflater extends LayoutInflater {
|
|||||||
|
|
||||||
return inflate(bridgeParser, root);
|
return inflate(bridgeParser, root);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_READ,
|
||||||
"Failed to parse file " + f.getAbsolutePath(), e);
|
"Failed to parse file " + f.getAbsolutePath(), e);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ public final class BridgeResources extends Resources {
|
|||||||
try {
|
try {
|
||||||
return ResourceHelper.getColor(value.getValue());
|
return ResourceHelper.getColor(value.getValue());
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_FORMAT, e.getMessage(), e);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,10 +173,15 @@ public final class BridgeResources extends Resources {
|
|||||||
|
|
||||||
return ColorStateList.createFromXml(this,
|
return ColorStateList.createFromXml(this,
|
||||||
new BridgeXmlBlockParser(parser, mContext, resValue.isFramework()));
|
new BridgeXmlBlockParser(parser, mContext, resValue.isFramework()));
|
||||||
|
} catch (XmlPullParserException e) {
|
||||||
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
|
"Failed to configure parser for " + value, e);
|
||||||
|
// we'll return null below.
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// this is an error and not warning since the file existence is checked before
|
// this is an error and not warning since the file existence is checked before
|
||||||
// attempting to parse it.
|
// attempting to parse it.
|
||||||
Bridge.getLog().error(null, "Failed to parse file " + value, e);
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_READ,
|
||||||
|
"Failed to parse file " + value, e);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -185,6 +191,8 @@ public final class BridgeResources extends Resources {
|
|||||||
int color = ResourceHelper.getColor(value);
|
int color = ResourceHelper.getColor(value);
|
||||||
return ColorStateList.valueOf(color);
|
return ColorStateList.valueOf(color);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_FORMAT,
|
||||||
|
"Failed to convert " + value + " into a ColorStateList", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +251,7 @@ public final class BridgeResources extends Resources {
|
|||||||
return new BridgeXmlBlockParser(parser, mContext, mPlatformResourceFlag[0]);
|
return new BridgeXmlBlockParser(parser, mContext, mPlatformResourceFlag[0]);
|
||||||
}
|
}
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
"Failed to configure parser for " + value.getValue(), e);
|
"Failed to configure parser for " + value.getValue(), e);
|
||||||
// we'll return null below.
|
// we'll return null below.
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
@@ -278,7 +286,7 @@ public final class BridgeResources extends Resources {
|
|||||||
return new BridgeXmlBlockParser(parser, mContext, mPlatformResourceFlag[0]);
|
return new BridgeXmlBlockParser(parser, mContext, mPlatformResourceFlag[0]);
|
||||||
}
|
}
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
"Failed to configure parser for " + value.getValue(), e);
|
"Failed to configure parser for " + value.getValue(), e);
|
||||||
// we'll return null below.
|
// we'll return null below.
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.android.layoutlib.bridge.impl.ResourceHelper;
|
|||||||
|
|
||||||
import org.kxml2.io.KXmlParser;
|
import org.kxml2.io.KXmlParser;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@@ -205,9 +206,10 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
if (i != null) {
|
if (i != null) {
|
||||||
result |= i.intValue();
|
result |= i.intValue();
|
||||||
} else {
|
} else {
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
"Unknown constant \"%s\" in attribute \"%2$s\"",
|
String.format(
|
||||||
keyword, mNames[index]));
|
"Unknown constant \"%s\" in attribute \"%2$s\"",
|
||||||
|
keyword, mNames[index]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -235,9 +237,10 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
try {
|
try {
|
||||||
return Float.parseFloat(s);
|
return Float.parseFloat(s);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
"Unable to convert \"%s\" into a float in attribute \"%2$s\"",
|
String.format(
|
||||||
s, mNames[index]));
|
"Unable to convert \"%s\" into a float in attribute \"%2$s\"",
|
||||||
|
s, mNames[index]));
|
||||||
|
|
||||||
// we'll return the default value below.
|
// we'll return the default value below.
|
||||||
}
|
}
|
||||||
@@ -267,9 +270,7 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
try {
|
try {
|
||||||
return ResourceHelper.getColor(s);
|
return ResourceHelper.getColor(s);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_FORMAT, e.getMessage(), e);
|
||||||
"Unable to convert \"%s\" into a color in attribute \"%2$s\"",
|
|
||||||
s, mNames[index]));
|
|
||||||
|
|
||||||
// we'll return the default value below.
|
// we'll return the default value below.
|
||||||
}
|
}
|
||||||
@@ -298,17 +299,10 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
int color = ResourceHelper.getColor(value);
|
|
||||||
return ColorStateList.valueOf(color);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
// if it's not a color value, we'll attempt to read the xml based color below.
|
|
||||||
}
|
|
||||||
|
|
||||||
// let the framework inflate the ColorStateList from the XML file.
|
// let the framework inflate the ColorStateList from the XML file.
|
||||||
try {
|
File f = new File(value);
|
||||||
File f = new File(value);
|
if (f.isFile()) {
|
||||||
if (f.isFile()) {
|
try {
|
||||||
KXmlParser parser = new KXmlParser();
|
KXmlParser parser = new KXmlParser();
|
||||||
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
|
||||||
parser.setInput(new FileReader(f));
|
parser.setInput(new FileReader(f));
|
||||||
@@ -318,19 +312,26 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
// FIXME: we need to know if this resource is platform or not
|
// FIXME: we need to know if this resource is platform or not
|
||||||
new BridgeXmlBlockParser(parser, mContext, false));
|
new BridgeXmlBlockParser(parser, mContext, false));
|
||||||
return colorStateList;
|
return colorStateList;
|
||||||
}
|
} catch (XmlPullParserException e) {
|
||||||
} catch (Exception e) {
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
// this is an error and not warning since the file existence is checked before
|
"Failed to configure parser for " + value, e);
|
||||||
// attempting to parse it.
|
return null;
|
||||||
Bridge.getLog().error(null, "Failed to parse file " + value, e);
|
} catch (Exception e) {
|
||||||
|
// this is an error and not warning since the file existence is checked before
|
||||||
|
// attempting to parse it.
|
||||||
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_READ,
|
||||||
|
"Failed to parse file " + value, e);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// looks like were unable to resolve the color value.
|
try {
|
||||||
Bridge.getLog().warning(null, String.format(
|
int color = ResourceHelper.getColor(value);
|
||||||
"Unable to resolve color value \"%1$s\" in attribute \"%2$s\"",
|
return ColorStateList.valueOf(color);
|
||||||
value, mNames[index]));
|
} catch (NumberFormatException e) {
|
||||||
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_FORMAT, e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
assert false;
|
assert false;
|
||||||
|
|
||||||
@@ -358,9 +359,10 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
try {
|
try {
|
||||||
return Integer.parseInt(s);
|
return Integer.parseInt(s);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
"Unable to convert \"%s\" into a integer in attribute \"%2$s\"",
|
String.format(
|
||||||
s, mNames[index]));
|
"Unable to convert \"%s\" into a integer in attribute \"%2$s\"",
|
||||||
|
s, mNames[index]));
|
||||||
|
|
||||||
// The default value is returned below.
|
// The default value is returned below.
|
||||||
}
|
}
|
||||||
@@ -407,9 +409,10 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// looks like we were unable to resolve the dimension value
|
// looks like we were unable to resolve the dimension value
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
"Unable to resolve dimension value \"%1$s\" in attribute \"%2$s\"",
|
String.format(
|
||||||
s, mNames[index]));
|
"Unable to resolve dimension value \"%1$s\" in attribute \"%2$s\"",
|
||||||
|
s, mNames[index]));
|
||||||
|
|
||||||
assert false;
|
assert false;
|
||||||
|
|
||||||
@@ -538,9 +541,10 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// looks like we were unable to resolve the fraction value
|
// looks like we were unable to resolve the fraction value
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
"Unable to resolve fraction value \"%1$s\" in attribute \"%2$s\"",
|
String.format(
|
||||||
value, mNames[index]));
|
"Unable to resolve fraction value \"%1$s\" in attribute \"%2$s\"",
|
||||||
|
value, mNames[index]));
|
||||||
|
|
||||||
assert false;
|
assert false;
|
||||||
|
|
||||||
@@ -649,8 +653,9 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
return idValue.intValue();
|
return idValue.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
"Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index]));
|
String.format(
|
||||||
|
"Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index]));
|
||||||
|
|
||||||
assert false;
|
assert false;
|
||||||
|
|
||||||
@@ -686,9 +691,10 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// looks like we were unable to resolve the drawable
|
// looks like we were unable to resolve the drawable
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
"Unable to resolve drawable \"%1$s\" in attribute \"%2$s\"", stringValue,
|
String.format(
|
||||||
mNames[index]));
|
"Unable to resolve drawable \"%1$s\" in attribute \"%2$s\"", stringValue,
|
||||||
|
mNames[index]));
|
||||||
|
|
||||||
assert false;
|
assert false;
|
||||||
|
|
||||||
@@ -717,9 +723,10 @@ public final class BridgeTypedArray extends TypedArray {
|
|||||||
return new CharSequence[] { value };
|
return new CharSequence[] { value };
|
||||||
}
|
}
|
||||||
|
|
||||||
Bridge.getLog().warning(null, String.format(
|
Bridge.getLog().warning(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
String.format("Unknown value for getTextArray(%d) => %s", //DEBUG
|
String.format(
|
||||||
index, mResourceData[index].getName())));
|
String.format("Unknown value for getTextArray(%d) => %s", //DEBUG
|
||||||
|
index, mResourceData[index].getName())));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,6 @@ public abstract class AnimationThread extends Thread {
|
|||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
// can't use Bridge.getLog() as the exception might be thrown outside
|
// can't use Bridge.getLog() as the exception might be thrown outside
|
||||||
// of an acquire/release block.
|
// of an acquire/release block.
|
||||||
mSession.getLog().error(null, "Error playing animation", throwable);
|
|
||||||
mListener.done(Status.ERROR_UNKNOWN.createResult("Error playing animation", throwable));
|
mListener.done(Status.ERROR_UNKNOWN.createResult("Error playing animation", throwable));
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.layoutlib.bridge.impl;
|
package com.android.layoutlib.bridge.impl;
|
||||||
|
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
|
|
||||||
import android.graphics.Bitmap_Delegate;
|
import android.graphics.Bitmap_Delegate;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@@ -728,7 +729,7 @@ public class GcSnapshot {
|
|||||||
customShader = true;
|
customShader = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Bridge.getLog().fidelityWarning(null,
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_SHADER,
|
||||||
shaderDelegate.getSupportMessage(),
|
shaderDelegate.getSupportMessage(),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
@@ -762,7 +763,7 @@ public class GcSnapshot {
|
|||||||
customXfermode = true;
|
customXfermode = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Bridge.getLog().fidelityWarning(null,
|
Bridge.getLog().fidelityWarning(BridgeConstants.TAG_XFERMODE,
|
||||||
xfermodeDelegate.getSupportMessage(),
|
xfermodeDelegate.getSupportMessage(),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -364,9 +364,6 @@ public class RenderSessionImpl {
|
|||||||
t = t.getCause();
|
t = t.getCause();
|
||||||
}
|
}
|
||||||
|
|
||||||
// log it
|
|
||||||
mParams.getLog().error(null, "Scene inflate failed", t);
|
|
||||||
|
|
||||||
return ERROR_INFLATION.createResult(t.getMessage(), t);
|
return ERROR_INFLATION.createResult(t.getMessage(), t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -480,9 +477,6 @@ public class RenderSessionImpl {
|
|||||||
t = t.getCause();
|
t = t.getCause();
|
||||||
}
|
}
|
||||||
|
|
||||||
// log it
|
|
||||||
mParams.getLog().error(null, "Scene Render failed", t);
|
|
||||||
|
|
||||||
return ERROR_UNKNOWN.createResult(t.getMessage(), t);
|
return ERROR_UNKNOWN.createResult(t.getMessage(), t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1051,7 +1045,7 @@ public class RenderSessionImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert false;
|
assert false;
|
||||||
mParams.getLog().error(null,
|
mParams.getLog().error(BridgeConstants.TAG_RESOURCES_RESOLVE,
|
||||||
String.format("Unable to resolve parent style name: %s", parentName));
|
String.format("Unable to resolve parent style name: %s", parentName));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.android.ide.common.rendering.api.DensityBasedResourceValue;
|
|||||||
import com.android.ide.common.rendering.api.ResourceDensity;
|
import com.android.ide.common.rendering.api.ResourceDensity;
|
||||||
import com.android.ide.common.rendering.api.ResourceValue;
|
import com.android.ide.common.rendering.api.ResourceValue;
|
||||||
import com.android.layoutlib.bridge.Bridge;
|
import com.android.layoutlib.bridge.Bridge;
|
||||||
|
import com.android.layoutlib.bridge.BridgeConstants;
|
||||||
import com.android.layoutlib.bridge.android.BridgeContext;
|
import com.android.layoutlib.bridge.android.BridgeContext;
|
||||||
import com.android.layoutlib.bridge.android.BridgeXmlBlockParser;
|
import com.android.layoutlib.bridge.android.BridgeXmlBlockParser;
|
||||||
import com.android.ninepatch.NinePatch;
|
import com.android.ninepatch.NinePatch;
|
||||||
@@ -64,14 +65,18 @@ public final class ResourceHelper {
|
|||||||
public static int getColor(String value) {
|
public static int getColor(String value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
if (value.startsWith("#") == false) {
|
if (value.startsWith("#") == false) {
|
||||||
throw new NumberFormatException();
|
throw new NumberFormatException(
|
||||||
|
String.format("Color value '%s' must start with #", value));
|
||||||
}
|
}
|
||||||
|
|
||||||
value = value.substring(1);
|
value = value.substring(1);
|
||||||
|
|
||||||
// make sure it's not longer than 32bit
|
// make sure it's not longer than 32bit
|
||||||
if (value.length() > 8) {
|
if (value.length() > 8) {
|
||||||
throw new NumberFormatException();
|
throw new NumberFormatException(String.format(
|
||||||
|
"Color value '%s' is too long. Format is either" +
|
||||||
|
"#AARRGGBB, #RRGGBB, #RGB, or #ARGB",
|
||||||
|
value));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.length() == 3) { // RGB format
|
if (value.length() == 3) { // RGB format
|
||||||
@@ -160,7 +165,8 @@ public final class ResourceHelper {
|
|||||||
// URL is wrong, we'll return null below
|
// URL is wrong, we'll return null below
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// failed to read the file, we'll return null below.
|
// failed to read the file, we'll return null below.
|
||||||
Bridge.getLog().error(null, "Failed lot load " + file.getAbsolutePath(), e);
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_READ,
|
||||||
|
"Failed lot load " + file.getAbsolutePath(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +200,7 @@ public final class ResourceHelper {
|
|||||||
Bridge.getLog().error(null, "Failed to parse file " + value, e);
|
Bridge.getLog().error(null, "Failed to parse file " + value, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_BROKEN,
|
||||||
String.format("File %s does not exist (or is not a file)", stringValue));
|
String.format("File %s does not exist (or is not a file)", stringValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +227,8 @@ public final class ResourceHelper {
|
|||||||
return new BitmapDrawable(context.getResources(), bitmap);
|
return new BitmapDrawable(context.getResources(), bitmap);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// we'll return null below
|
// we'll return null below
|
||||||
Bridge.getLog().error(null, "Failed lot load " + bmpFile.getAbsolutePath(), e);
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_READ,
|
||||||
|
"Failed lot load " + bmpFile.getAbsolutePath(), e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// attempt to get a color from the value
|
// attempt to get a color from the value
|
||||||
@@ -230,8 +237,8 @@ public final class ResourceHelper {
|
|||||||
return new ColorDrawable(color);
|
return new ColorDrawable(color);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
// we'll return null below.
|
// we'll return null below.
|
||||||
Bridge.getLog().error(null,
|
Bridge.getLog().error(BridgeConstants.TAG_RESOURCES_FORMAT,
|
||||||
"failed to convert " + stringValue + " into a drawable");
|
"Failed to convert " + stringValue + " into a drawable", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user