If it happened on close, bm is still valid.
*/
Bridge.getLog().error(LayoutLog.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, null /*data*/);
} finally {
try {
if (is != null) is.close();
if (is instanceof AssetManager.AssetInputStream) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.decodeStream: " +
- "InputStream is unsupported (AssetManager.AssetInputStream)");
+ "InputStream is unsupported (AssetManager.AssetInputStream)", null /*data*/);
return null;
} else {
// pass some temp storage down to the native code. 1024 is made up,
canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in BitmapShader", e);
+ "Unable to inverse matrix in BitmapShader", e, null /*data*/);
canvasMatrix = new java.awt.geom.AffineTransform();
}
localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in BitmapShader", e);
+ "Unable to inverse matrix in BitmapShader", e, null /*data*/);
localMatrix = new java.awt.geom.AffineTransform();
}
/*package*/ static boolean nativeCompress(int nativeBitmap, int format, int quality,
OutputStream stream, byte[] tempStorage) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
- "Bitmap.compress() is not supported");
+ "Bitmap.compress() is not supported", null /*data*/);
return true;
}
// This is only called by Bitmap.CREATOR (Parcelable.Creator<Bitmap>), which is only
// used during aidl call so really this should not be called.
Bridge.getLog().error(LayoutLog.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.",
+ null /*data*/);
return null;
}
// This is only called when sending a bitmap through aidl, so really this should not
// be called.
Bridge.getLog().error(LayoutLog.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.",
+ null /*data*/);
return false;
}
if (paint != null && paint.getMaskFilter() != null) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER,
"MaskFilter not supported in Bitmap.extractAlpha",
- null);
+ null, null /*data*/);
}
int alpha = paint != null ? paint.getAlpha() : 0xFF;
assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE,
"android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " +
- "supports affine transformations.", null);
+ "supports affine transformations.", null, null /*data*/);
}
}
if (filterDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_DRAWFILTER,
- filterDelegate.getSupportMessage(), null);
+ filterDelegate.getSupportMessage(), null, null /*data*/);
}
}
canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in LinearGradient", e);
+ "Unable to inverse matrix in LinearGradient", e, null /*data*/);
canvasMatrix = new java.awt.geom.AffineTransform();
}
localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in LinearGradient", e);
+ "Unable to inverse matrix in LinearGradient", e, null /*data*/);
localMatrix = new java.awt.geom.AffineTransform();
}
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Matrix.setPolyToPoly is not supported.",
- null);
+ null, null /*data*/);
return false;
}
oos = new ObjectOutputStream(baos);
oos.writeObject(chunk);
} catch (IOException e) {
- Bridge.getLog().error(null, "Failed to serialize NinePatchChunk.", e);
+ Bridge.getLog().error(null, "Failed to serialize NinePatchChunk.", e, null /*data*/);
return null;
} finally {
if (oos != null) {
}
} catch (IOException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to deserialize NinePatchChunk content.", e);
+ "Failed to deserialize NinePatchChunk content.", e, null /*data*/);
return null;
} catch (ClassNotFoundException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to deserialize NinePatchChunk class.", e);
+ "Failed to deserialize NinePatchChunk class.", e, null /*data*/);
return null;
} finally {
if (ois != null) {
} else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_PATHEFFECT,
effectDelegate.getSupportMessage(),
- null);
+ null, null /*data*/);
}
}
int color) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
- "Paint.setShadowLayer is not supported.", null);
+ "Paint.setShadowLayer is not supported.", null, null /*data*/);
}
/*package*/ static float getTextSize(Paint thisPaint) {
ColorFilter_Delegate filterDelegate = delegate.getColorFilter();
if (filterDelegate != null && filterDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_COLORFILTER,
- filterDelegate.getSupportMessage(), null);
+ filterDelegate.getSupportMessage(), null, null /*data*/);
}
return filter;
MaskFilter_Delegate filterDelegate = delegate.getMaskFilter();
if (filterDelegate != null && filterDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER,
- filterDelegate.getSupportMessage(), null);
+ filterDelegate.getSupportMessage(), null, null /*data*/);
}
return maskfilter;
Rasterizer_Delegate rasterizerDelegate = delegate.getRasterizer();
if (rasterizerDelegate != null && rasterizerDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_RASTERIZER,
- rasterizerDelegate.getSupportMessage(), null);
+ rasterizerDelegate.getSupportMessage(), null, null /*data*/);
}
return rasterizer;
assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE,
"android.graphics.Path#transform() only " +
- "supports affine transformations.", null);
+ "supports affine transformations.", null, null /*data*/);
}
GeneralPath newPath = new GeneralPath();
}
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- String.format("Unknown PorterDuff.Mode: %d", mode));
+ String.format("Unknown PorterDuff.Mode: %d", mode), null /*data*/);
assert false;
return PorterDuff.Mode.SRC_OVER;
}
Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN,
String.format("Unsupported PorterDuff Mode: %s", mode.name()),
- null);
+ null, null /*data*/);
return AlphaComposite.getInstance(AlphaComposite.SRC_OVER, falpha);
}
canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in RadialGradient", e);
+ "Unable to inverse matrix in RadialGradient", e, null /*data*/);
canvasMatrix = new java.awt.geom.AffineTransform();
}
localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in RadialGradient", e);
+ "Unable to inverse matrix in RadialGradient", e, null /*data*/);
localMatrix = new java.awt.geom.AffineTransform();
}
// This is only called by Region.CREATOR (Parcelable.Creator<Region>), which is only
// used during aidl call so really this should not be called.
Bridge.getLog().error(LayoutLog.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.",
+ null /*data*/);
return 0;
}
// This is only called when sending a region through aidl, so really this should not
// be called.
Bridge.getLog().error(LayoutLog.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.",
+ null /*data*/);
return false;
}
canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in SweepGradient", e);
+ "Unable to inverse matrix in SweepGradient", e, null /*data*/);
canvasMatrix = new java.awt.geom.AffineTransform();
}
localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
- "Unable to inverse matrix in SweepGradient", e);
+ "Unable to inverse matrix in SweepGradient", e, null /*data*/);
localMatrix = new java.awt.geom.AffineTransform();
}
/*package*/ static synchronized int nativeCreateFromAsset(AssetManager mgr, String path) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
- "Typeface.createFromAsset() is not supported.", null);
+ "Typeface.createFromAsset() is not supported.", null /*throwable*/, null /*data*/);
return 0;
}
/*package*/ static synchronized int nativeCreateFromFile(String path) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
- "Typeface.createFromFile() is not supported.", null);
+ "Typeface.createFromFile() is not supported.", null /*throwable*/, null /*data*/);
return 0;
}
*/
private final static LayoutLog sDefaultLog = new LayoutLog() {
@Override
- public void error(String tag, String message) {
+ public void error(String tag, String message, Object data) {
System.err.println(message);
}
@Override
- public void error(String tag, String message, Throwable throwable) {
+ public void error(String tag, String message, Throwable throwable, Object data) {
System.err.println(message);
}
@Override
- public void warning(String tag, String message) {
+ public void warning(String tag, String message, Object data) {
System.out.println(message);
}
};
@Override
public void onInvokeV(String signature, boolean isNative, Object caller) {
sDefaultLog.error(null, "Missing Stub: " + signature +
- (isNative ? " (native)" : ""));
+ (isNative ? " (native)" : ""), null /*data*/);
if (debug.equalsIgnoreCase("throw")) {
// Throwing this exception doesn't seem that useful. It breaks
} else if (set != null) { // null parser is ok
// really this should not be happening since its instantiated in Bridge
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Parser is not a BridgeXmlBlockParser!");
+ "Parser is not a BridgeXmlBlockParser!", null /*data*/);
return null;
}
} else {
Bridge.getLog().error(null,
String.format(
- "Failed to find style '%s' in current theme", defStyleName));
+ "Failed to find style '%s' in current theme", defStyleName),
+ null /*data*/);
}
}
}
if ("+id".equals(resType) == false && "+android:id".equals(resType) == false) { //$NON-NLS-1$ //$NON-NLS-2$
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
"Couldn't resolve resource @" +
- (frameworkOnly ? "android:" : "") + resType + "/" + resName);
+ (frameworkOnly ? "android:" : "") + resType + "/" + resName,
+ new ResourceValue(resType, resName, frameworkOnly));
}
return null;
}
return inflate(bridgeParser, root);
} catch (Exception e) {
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed to parse file " + f.getAbsolutePath(), e);
+ "Failed to parse file " + f.getAbsolutePath(), e, null /*data*/);
return null;
}
try {
return ResourceHelper.getColor(value.getValue());
} catch (NumberFormatException e) {
- Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e);
+ Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e,
+ null /*data*/);
return 0;
}
}
new BridgeXmlBlockParser(parser, mContext, resValue.isFramework()));
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to configure parser for " + value, e);
+ "Failed to configure parser for " + value, e, null /*data*/);
// we'll return null below.
} catch (Exception e) {
// this is an error and not warning since the file existence is checked before
// attempting to parse it.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed to parse file " + value, e);
+ "Failed to parse file " + value, e, null /*data*/);
return null;
}
return ColorStateList.valueOf(color);
} catch (NumberFormatException e) {
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
- "Failed to convert " + value + " into a ColorStateList", e);
+ "Failed to convert " + value + " into a ColorStateList", e,
+ null /*data*/);
return null;
}
}
}
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to configure parser for " + value.getValue(), e);
+ "Failed to configure parser for " + value.getValue(), e, null /*data*/);
// we'll return null below.
} catch (FileNotFoundException e) {
// this shouldn't happen since we check above.
}
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to configure parser for " + value.getValue(), e);
+ "Failed to configure parser for " + value.getValue(), e, null /*data*/);
// we'll return null below.
} catch (FileNotFoundException e) {
// this shouldn't happen since we check above.
if (i != null) {
result |= i.intValue();
} else {
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unknown constant \"%s\" in attribute \"%2$s\"",
- keyword, mNames[index]));
+ "\"%s\" in attribute \"%2$s\" is not a valid value",
+ keyword, mNames[index]), null /*data*/);
}
}
return result;
try {
return Float.parseFloat(s);
} catch (NumberFormatException e) {
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unable to convert \"%s\" into a float in attribute \"%2$s\"",
- s, mNames[index]));
+ "\"%s\" in attribute \"%2$s\" cannot be converted to float.",
+ s, mNames[index]), null /*data*/);
// we'll return the default value below.
}
try {
return ResourceHelper.getColor(s);
} catch (NumberFormatException e) {
- Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e);
+ Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e, null /*data*/);
// we'll return the default value below.
}
return colorStateList;
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Failed to configure parser for " + value, e);
+ "Failed to configure parser for " + value, e, null /*data*/);
return null;
} catch (Exception e) {
// this is an error and not warning since the file existence is checked before
// attempting to parse it.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed to parse file " + value, e);
+ "Failed to parse file " + value, e, null /*data*/);
return null;
}
int color = ResourceHelper.getColor(value);
return ColorStateList.valueOf(color);
} catch (NumberFormatException e) {
- Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e);
+ Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e, null /*data*/);
}
assert false;
try {
return Integer.parseInt(s);
} catch (NumberFormatException e) {
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unable to convert \"%s\" into a integer in attribute \"%2$s\"",
- s, mNames[index]));
+ "\"%s\" in attribute \"%2$s\" cannont be converted to an integer.",
+ s, mNames[index]), null /*data*/);
// The default value is returned below.
}
}
// looks like we were unable to resolve the dimension value
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unable to resolve dimension value \"%1$s\" in attribute \"%2$s\"",
- s, mNames[index]));
+ "\"%1$s\" in attribute \"%2$s\" is not a valid format.",
+ s, mNames[index]), null /*data*/);
assert false;
}
// looks like we were unable to resolve the fraction value
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
- "Unable to resolve fraction value \"%1$s\" in attribute \"%2$s\"",
- value, mNames[index]));
+ "\"%1$s\" in attribute \"%2$s\" cannont be converted to a fraction.",
+ value, mNames[index]), null /*data*/);
assert false;
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
String.format(
- "Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index]));
+ "Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index]),
+ resValue);
assert false;
return null;
}
- Drawable d = ResourceHelper.getDrawable(value, mContext, mResourceData[index].isFramework());
-
- if (d != null) {
- return d;
- }
-
- // looks like we were unable to resolve the drawable
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
- String.format(
- "Unable to resolve drawable \"%1$s\" in attribute \"%2$s\"", stringValue,
- mNames[index]));
-
- assert false;
-
- return null;
+ return ResourceHelper.getDrawable(value, mContext, mResourceData[index].isFramework());
}
return new CharSequence[] { value };
}
- Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
+ Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format(
String.format("Unknown value for getTextArray(%d) => %s", //DEBUG
- index, mResourceData[index].getName())));
+ index, mResourceData[index].getName())), null /*data*/);
return null;
}
} else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_SHADER,
shaderDelegate.getSupportMessage(),
- null);
+ null /*throwable*/, null /*data*/);
}
}
} else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE,
xfermodeDelegate.getSupportMessage(),
- null);
+ null /*throwable*/, null /*data*/);
}
}
assert false;
mParams.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE,
- String.format("Unable to resolve parent style name: %s", parentName));
+ String.format("Unable to resolve parent style name: %s", parentName),
+ null /*data*/);
return null;
}
} catch (IOException e) {
// failed to read the file, we'll return null below.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed lot load " + file.getAbsolutePath(), e);
+ "Failed lot load " + file.getAbsolutePath(), e, null /*data*/);
}
}
} catch (Exception e) {
// this is an error and not warning since the file existence is checked before
// attempting to parse it.
- Bridge.getLog().error(null, "Failed to parse file " + value, e);
+ Bridge.getLog().error(null, "Failed to parse file " + value, e, null /*data*/);
}
} else {
Bridge.getLog().error(LayoutLog.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),
+ null /*data*/);
}
return null;
} catch (IOException e) {
// we'll return null below
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
- "Failed lot load " + bmpFile.getAbsolutePath(), e);
+ "Failed lot load " + bmpFile.getAbsolutePath(), e, null /*data*/);
}
} else {
// attempt to get a color from the value
} catch (NumberFormatException e) {
// we'll return null below.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
- "Failed to convert " + stringValue + " into a drawable", e);
+ "Failed to convert " + stringValue + " into a drawable", e,
+ null /*data*/);
}
}
}