LayoutLib: update logs to use new data bundle

Also change some resource.resolve tags to resource.format

Change-Id: I3f0b0d2eb69a5ec98375e4014a3bb1bfceb8c855
This commit is contained in:
Xavier Ducrohet
2011-01-14 16:40:43 -08:00
parent 0831b3fae5
commit 51a7e5447d
22 changed files with 89 additions and 91 deletions

View File

@ -353,7 +353,7 @@ public class BitmapFactory {
If it happened on close, bm is still valid. If it happened on close, bm is still valid.
*/ */
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ, 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 { } finally {
try { try {
if (is != null) is.close(); if (is != null) is.close();
@ -454,7 +454,7 @@ public class BitmapFactory {
if (is instanceof AssetManager.AssetInputStream) { if (is instanceof AssetManager.AssetInputStream) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.decodeStream: " + "Bitmap.decodeStream: " +
"InputStream is unsupported (AssetManager.AssetInputStream)"); "InputStream is unsupported (AssetManager.AssetInputStream)", null /*data*/);
return null; return null;
} else { } else {
// pass some temp storage down to the native code. 1024 is made up, // pass some temp storage down to the native code. 1024 is made up,

View File

@ -114,7 +114,7 @@ public class BitmapShader_Delegate extends Shader_Delegate {
canvasMatrix = xform.createInverse(); canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) { } catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE, 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(); canvasMatrix = new java.awt.geom.AffineTransform();
} }
@ -123,7 +123,7 @@ public class BitmapShader_Delegate extends Shader_Delegate {
localMatrix = localMatrix.createInverse(); localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) { } catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE, 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(); localMatrix = new java.awt.geom.AffineTransform();
} }

View File

@ -250,7 +250,7 @@ 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(LayoutLog.TAG_UNSUPPORTED, Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.compress() is not supported"); "Bitmap.compress() is not supported", null /*data*/);
return true; return true;
} }
@ -386,7 +386,8 @@ public final class Bitmap_Delegate {
// 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(LayoutLog.TAG_UNSUPPORTED, 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; return null;
} }
@ -395,7 +396,8 @@ public final class Bitmap_Delegate {
// 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(LayoutLog.TAG_UNSUPPORTED, 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; return false;
} }
@ -412,7 +414,7 @@ public final class Bitmap_Delegate {
if (paint != null && paint.getMaskFilter() != null) { if (paint != null && paint.getMaskFilter() != null) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER, Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER,
"MaskFilter not supported in Bitmap.extractAlpha", "MaskFilter not supported in Bitmap.extractAlpha",
null); null, null /*data*/);
} }
int alpha = paint != null ? paint.getAlpha() : 0xFF; int alpha = paint != null ? paint.getAlpha() : 0xFF;

View File

@ -425,7 +425,7 @@ public final class Canvas_Delegate {
assert false; assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE, Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE,
"android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " + "android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " +
"supports affine transformations.", null); "supports affine transformations.", null, null /*data*/);
} }
} }
@ -494,7 +494,7 @@ public final class Canvas_Delegate {
if (filterDelegate.isSupported() == false) { if (filterDelegate.isSupported() == false) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_DRAWFILTER, Bridge.getLog().fidelityWarning(LayoutLog.TAG_DRAWFILTER,
filterDelegate.getSupportMessage(), null); filterDelegate.getSupportMessage(), null, null /*data*/);
} }
} }

View File

@ -137,7 +137,7 @@ public final class LinearGradient_Delegate extends Gradient_Delegate {
canvasMatrix = xform.createInverse(); canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) { } catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE, 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(); canvasMatrix = new java.awt.geom.AffineTransform();
} }
@ -146,7 +146,7 @@ public final class LinearGradient_Delegate extends Gradient_Delegate {
localMatrix = localMatrix.createInverse(); localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) { } catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE, 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(); localMatrix = new java.awt.geom.AffineTransform();
} }

View File

@ -615,7 +615,7 @@ public final class Matrix_Delegate {
// FIXME // FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Matrix.setPolyToPoly is not supported.", "Matrix.setPolyToPoly is not supported.",
null); null, null /*data*/);
return false; return false;
} }

View File

@ -74,7 +74,7 @@ public final class NinePatch_Delegate {
oos = new ObjectOutputStream(baos); oos = new ObjectOutputStream(baos);
oos.writeObject(chunk); oos.writeObject(chunk);
} catch (IOException e) { } 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; return null;
} finally { } finally {
if (oos != null) { if (oos != null) {
@ -198,11 +198,11 @@ public final class NinePatch_Delegate {
} }
} catch (IOException e) { } catch (IOException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, Bridge.getLog().error(LayoutLog.TAG_BROKEN,
"Failed to deserialize NinePatchChunk content.", e); "Failed to deserialize NinePatchChunk content.", e, null /*data*/);
return null; return null;
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, Bridge.getLog().error(LayoutLog.TAG_BROKEN,
"Failed to deserialize NinePatchChunk class.", e); "Failed to deserialize NinePatchChunk class.", e, null /*data*/);
return null; return null;
} finally { } finally {
if (ois != null) { if (ois != null) {

View File

@ -182,7 +182,7 @@ public class Paint_Delegate {
} else { } else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_PATHEFFECT, Bridge.getLog().fidelityWarning(LayoutLog.TAG_PATHEFFECT,
effectDelegate.getSupportMessage(), effectDelegate.getSupportMessage(),
null); null, null /*data*/);
} }
} }
@ -377,7 +377,7 @@ public class Paint_Delegate {
int color) { int color) {
// FIXME // FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, 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) { /*package*/ static float getTextSize(Paint thisPaint) {
@ -694,7 +694,7 @@ public class Paint_Delegate {
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(LayoutLog.TAG_COLORFILTER, Bridge.getLog().fidelityWarning(LayoutLog.TAG_COLORFILTER,
filterDelegate.getSupportMessage(), null); filterDelegate.getSupportMessage(), null, null /*data*/);
} }
return filter; return filter;
@ -733,7 +733,7 @@ public class Paint_Delegate {
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(LayoutLog.TAG_MASKFILTER, Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER,
filterDelegate.getSupportMessage(), null); filterDelegate.getSupportMessage(), null, null /*data*/);
} }
return maskfilter; return maskfilter;
@ -764,7 +764,7 @@ public class Paint_Delegate {
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(LayoutLog.TAG_RASTERIZER, Bridge.getLog().fidelityWarning(LayoutLog.TAG_RASTERIZER,
rasterizerDelegate.getSupportMessage(), null); rasterizerDelegate.getSupportMessage(), null, null /*data*/);
} }
return rasterizer; return rasterizer;

View File

@ -698,7 +698,7 @@ public final class Path_Delegate {
assert false; assert false;
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE, Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE,
"android.graphics.Path#transform() only " + "android.graphics.Path#transform() only " +
"supports affine transformations.", null); "supports affine transformations.", null, null /*data*/);
} }
GeneralPath newPath = new GeneralPath(); GeneralPath newPath = new GeneralPath();

View File

@ -74,7 +74,7 @@ public class PorterDuffXfermode_Delegate extends Xfermode_Delegate {
} }
Bridge.getLog().error(LayoutLog.TAG_BROKEN, Bridge.getLog().error(LayoutLog.TAG_BROKEN,
String.format("Unknown PorterDuff.Mode: %d", mode)); String.format("Unknown PorterDuff.Mode: %d", mode), null /*data*/);
assert false; assert false;
return PorterDuff.Mode.SRC_OVER; return PorterDuff.Mode.SRC_OVER;
} }
@ -118,7 +118,7 @@ public class PorterDuffXfermode_Delegate extends Xfermode_Delegate {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN, Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN,
String.format("Unsupported PorterDuff Mode: %s", mode.name()), String.format("Unsupported PorterDuff Mode: %s", mode.name()),
null); null, null /*data*/);
return AlphaComposite.getInstance(AlphaComposite.SRC_OVER, falpha); return AlphaComposite.getInstance(AlphaComposite.SRC_OVER, falpha);
} }

View File

@ -126,7 +126,7 @@ public class RadialGradient_Delegate extends Gradient_Delegate {
canvasMatrix = xform.createInverse(); canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) { } catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE, 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(); canvasMatrix = new java.awt.geom.AffineTransform();
} }
@ -135,7 +135,7 @@ public class RadialGradient_Delegate extends Gradient_Delegate {
localMatrix = localMatrix.createInverse(); localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) { } catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE, 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(); localMatrix = new java.awt.geom.AffineTransform();
} }

View File

@ -417,7 +417,8 @@ public class Region_Delegate {
// 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(LayoutLog.TAG_UNSUPPORTED, 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; return 0;
} }
@ -426,7 +427,8 @@ public class Region_Delegate {
// 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(LayoutLog.TAG_UNSUPPORTED, 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; return false;
} }

View File

@ -118,7 +118,7 @@ public class SweepGradient_Delegate extends Gradient_Delegate {
canvasMatrix = xform.createInverse(); canvasMatrix = xform.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) { } catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE, 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(); canvasMatrix = new java.awt.geom.AffineTransform();
} }
@ -127,7 +127,7 @@ public class SweepGradient_Delegate extends Gradient_Delegate {
localMatrix = localMatrix.createInverse(); localMatrix = localMatrix.createInverse();
} catch (java.awt.geom.NoninvertibleTransformException e) { } catch (java.awt.geom.NoninvertibleTransformException e) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE, 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(); localMatrix = new java.awt.geom.AffineTransform();
} }

View File

@ -127,13 +127,13 @@ 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(LayoutLog.TAG_UNSUPPORTED, Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Typeface.createFromAsset() is not supported.", null); "Typeface.createFromAsset() is not supported.", null /*throwable*/, null /*data*/);
return 0; return 0;
} }
/*package*/ static synchronized int nativeCreateFromFile(String path) { /*package*/ static synchronized int nativeCreateFromFile(String path) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Typeface.createFromFile() is not supported.", null); "Typeface.createFromFile() is not supported.", null /*throwable*/, null /*data*/);
return 0; return 0;
} }

View File

@ -137,17 +137,17 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge {
*/ */
private final static LayoutLog sDefaultLog = new LayoutLog() { private final static LayoutLog sDefaultLog = new LayoutLog() {
@Override @Override
public void error(String tag, String message) { public void error(String tag, String message, Object data) {
System.err.println(message); System.err.println(message);
} }
@Override @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); System.err.println(message);
} }
@Override @Override
public void warning(String tag, String message) { public void warning(String tag, String message, Object data) {
System.out.println(message); System.out.println(message);
} }
}; };
@ -207,7 +207,7 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge {
@Override @Override
public void onInvokeV(String signature, boolean isNative, Object caller) { public void onInvokeV(String signature, boolean isNative, Object caller) {
sDefaultLog.error(null, "Missing Stub: " + signature + sDefaultLog.error(null, "Missing Stub: " + signature +
(isNative ? " (native)" : "")); (isNative ? " (native)" : ""), null /*data*/);
if (debug.equalsIgnoreCase("throw")) { if (debug.equalsIgnoreCase("throw")) {
// Throwing this exception doesn't seem that useful. It breaks // Throwing this exception doesn't seem that useful. It breaks

View File

@ -343,7 +343,7 @@ public final class BridgeContext extends Activity {
} 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(LayoutLog.TAG_BROKEN, Bridge.getLog().error(LayoutLog.TAG_BROKEN,
"Parser is not a BridgeXmlBlockParser!"); "Parser is not a BridgeXmlBlockParser!", null /*data*/);
return null; return null;
} }
@ -391,7 +391,8 @@ public final class BridgeContext extends Activity {
} else { } else {
Bridge.getLog().error(null, Bridge.getLog().error(null,
String.format( String.format(
"Failed to find style '%s' in current theme", defStyleName)); "Failed to find style '%s' in current theme", defStyleName),
null /*data*/);
} }
} }
} }
@ -726,7 +727,8 @@ public final class BridgeContext extends Activity {
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(LayoutLog.TAG_RESOURCES_RESOLVE, Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
"Couldn't resolve resource @" + "Couldn't resolve resource @" +
(frameworkOnly ? "android:" : "") + resType + "/" + resName); (frameworkOnly ? "android:" : "") + resType + "/" + resName,
new ResourceValue(resType, resName, frameworkOnly));
} }
return null; return null;
} }

View File

@ -180,7 +180,7 @@ public final class BridgeInflater extends LayoutInflater {
return inflate(bridgeParser, root); return inflate(bridgeParser, root);
} catch (Exception e) { } catch (Exception e) {
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ, 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; return null;
} }

View File

@ -143,7 +143,8 @@ 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(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e); Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e,
null /*data*/);
return 0; return 0;
} }
} }
@ -176,13 +177,13 @@ public final class BridgeResources extends Resources {
new BridgeXmlBlockParser(parser, mContext, resValue.isFramework())); new BridgeXmlBlockParser(parser, mContext, resValue.isFramework()));
} catch (XmlPullParserException e) { } catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, 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. // 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(LayoutLog.TAG_RESOURCES_READ, Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
"Failed to parse file " + value, e); "Failed to parse file " + value, e, null /*data*/);
return null; return null;
} }
@ -193,7 +194,8 @@ public final class BridgeResources extends Resources {
return ColorStateList.valueOf(color); return ColorStateList.valueOf(color);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, 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; return null;
} }
} }
@ -253,7 +255,7 @@ public final class BridgeResources extends Resources {
} }
} catch (XmlPullParserException e) { } catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, 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. // we'll return null below.
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// this shouldn't happen since we check above. // this shouldn't happen since we check above.
@ -288,7 +290,7 @@ public final class BridgeResources extends Resources {
} }
} catch (XmlPullParserException e) { } catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, 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. // we'll return null below.
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// this shouldn't happen since we check above. // this shouldn't happen since we check above.

View File

@ -207,10 +207,10 @@ public final class BridgeTypedArray extends TypedArray {
if (i != null) { if (i != null) {
result |= i.intValue(); result |= i.intValue();
} else { } else {
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE, Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format( String.format(
"Unknown constant \"%s\" in attribute \"%2$s\"", "\"%s\" in attribute \"%2$s\" is not a valid value",
keyword, mNames[index])); keyword, mNames[index]), null /*data*/);
} }
} }
return result; return result;
@ -238,10 +238,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(LayoutLog.TAG_RESOURCES_RESOLVE, Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format( String.format(
"Unable to convert \"%s\" into a float in attribute \"%2$s\"", "\"%s\" in attribute \"%2$s\" cannot be converted to float.",
s, mNames[index])); s, mNames[index]), null /*data*/);
// we'll return the default value below. // we'll return the default value below.
} }
@ -271,7 +271,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().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. // we'll return the default value below.
} }
@ -315,13 +315,13 @@ public final class BridgeTypedArray extends TypedArray {
return colorStateList; return colorStateList;
} catch (XmlPullParserException e) { } catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, Bridge.getLog().error(LayoutLog.TAG_BROKEN,
"Failed to configure parser for " + value, e); "Failed to configure parser for " + value, e, null /*data*/);
return null; return null;
} 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(LayoutLog.TAG_RESOURCES_READ, Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
"Failed to parse file " + value, e); "Failed to parse file " + value, e, null /*data*/);
return null; return null;
} }
@ -331,7 +331,7 @@ public final class BridgeTypedArray extends TypedArray {
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(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e); Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e, null /*data*/);
} }
assert false; assert false;
@ -360,10 +360,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(LayoutLog.TAG_RESOURCES_RESOLVE, Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format( String.format(
"Unable to convert \"%s\" into a integer in attribute \"%2$s\"", "\"%s\" in attribute \"%2$s\" cannont be converted to an integer.",
s, mNames[index])); s, mNames[index]), null /*data*/);
// The default value is returned below. // The default value is returned below.
} }
@ -410,10 +410,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(LayoutLog.TAG_RESOURCES_RESOLVE, Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format( String.format(
"Unable to resolve dimension value \"%1$s\" in attribute \"%2$s\"", "\"%1$s\" in attribute \"%2$s\" is not a valid format.",
s, mNames[index])); s, mNames[index]), null /*data*/);
assert false; assert false;
@ -542,10 +542,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(LayoutLog.TAG_RESOURCES_RESOLVE, Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format( String.format(
"Unable to resolve fraction value \"%1$s\" in attribute \"%2$s\"", "\"%1$s\" in attribute \"%2$s\" cannont be converted to a fraction.",
value, mNames[index])); value, mNames[index]), null /*data*/);
assert false; assert false;
@ -656,7 +656,8 @@ public final class BridgeTypedArray extends TypedArray {
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE, Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
String.format( 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; assert false;
@ -685,21 +686,7 @@ public final class BridgeTypedArray extends TypedArray {
return null; return null;
} }
Drawable d = ResourceHelper.getDrawable(value, mContext, mResourceData[index].isFramework()); return 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;
} }
@ -724,10 +711,10 @@ public final class BridgeTypedArray extends TypedArray {
return new CharSequence[] { value }; return new CharSequence[] { value };
} }
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE, Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
String.format( String.format(
String.format("Unknown value for getTextArray(%d) => %s", //DEBUG String.format("Unknown value for getTextArray(%d) => %s", //DEBUG
index, mResourceData[index].getName()))); index, mResourceData[index].getName())), null /*data*/);
return null; return null;
} }

View File

@ -730,7 +730,7 @@ public class GcSnapshot {
} else { } else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_SHADER, Bridge.getLog().fidelityWarning(LayoutLog.TAG_SHADER,
shaderDelegate.getSupportMessage(), shaderDelegate.getSupportMessage(),
null); null /*throwable*/, null /*data*/);
} }
} }
@ -764,7 +764,7 @@ public class GcSnapshot {
} else { } else {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE, Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE,
xfermodeDelegate.getSupportMessage(), xfermodeDelegate.getSupportMessage(),
null); null /*throwable*/, null /*data*/);
} }
} }

View File

@ -1046,7 +1046,8 @@ public class RenderSessionImpl {
assert false; assert false;
mParams.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE, 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; return null;
} }

View File

@ -166,7 +166,7 @@ public final class ResourceHelper {
} 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(LayoutLog.TAG_RESOURCES_READ, Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
"Failed lot load " + file.getAbsolutePath(), e); "Failed lot load " + file.getAbsolutePath(), e, null /*data*/);
} }
} }
@ -197,11 +197,12 @@ public final class ResourceHelper {
} 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(null, "Failed to parse file " + value, e, null /*data*/);
} }
} else { } else {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, 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; return null;
@ -228,7 +229,7 @@ public final class ResourceHelper {
} catch (IOException e) { } catch (IOException e) {
// we'll return null below // we'll return null below
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ, Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
"Failed lot load " + bmpFile.getAbsolutePath(), e); "Failed lot load " + bmpFile.getAbsolutePath(), e, null /*data*/);
} }
} else { } else {
// attempt to get a color from the value // attempt to get a color from the value
@ -238,7 +239,8 @@ public final class ResourceHelper {
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// we'll return null below. // we'll return null below.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, 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*/);
} }
} }
} }