diff options
22 files changed, 89 insertions, 91 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java index 7020d9cbfcea..db3cf44d89c8 100644 --- a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java +++ b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java @@ -353,7 +353,7 @@ public class BitmapFactory { 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(); @@ -454,7 +454,7 @@ public class BitmapFactory { 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, diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java index 03d65b2ed969..73c5a1aceab4 100644 --- a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java @@ -114,7 +114,7 @@ public class BitmapShader_Delegate extends Shader_Delegate { 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(); } @@ -123,7 +123,7 @@ public class BitmapShader_Delegate extends Shader_Delegate { 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(); } diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java index 18bf4b58ff08..108d1838db7b 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java @@ -250,7 +250,7 @@ public final class Bitmap_Delegate { /*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; } @@ -386,7 +386,8 @@ public final class Bitmap_Delegate { // 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; } @@ -395,7 +396,8 @@ public final class Bitmap_Delegate { // 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; } @@ -412,7 +414,7 @@ public final class Bitmap_Delegate { 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; diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java index 8bfaf4041200..5a6902c074dc 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java @@ -425,7 +425,7 @@ public final class Canvas_Delegate { 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*/); } } @@ -494,7 +494,7 @@ public final class Canvas_Delegate { if (filterDelegate.isSupported() == false) { Bridge.getLog().fidelityWarning(LayoutLog.TAG_DRAWFILTER, - filterDelegate.getSupportMessage(), null); + filterDelegate.getSupportMessage(), null, null /*data*/); } } diff --git a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java index aab310aa626e..9525dcf8e049 100644 --- a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java @@ -137,7 +137,7 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { 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(); } @@ -146,7 +146,7 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { 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(); } diff --git a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java index 0c934fccaa4d..2d77d40f6f54 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java @@ -615,7 +615,7 @@ public final class Matrix_Delegate { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Matrix.setPolyToPoly is not supported.", - null); + null, null /*data*/); return false; } diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java index 049ac454c165..7a6da95dbb89 100644 --- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java @@ -74,7 +74,7 @@ public final class NinePatch_Delegate { 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) { @@ -198,11 +198,11 @@ public final class NinePatch_Delegate { } } 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) { diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java index 67afecae3493..87164fb42e0b 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java @@ -182,7 +182,7 @@ public class Paint_Delegate { } else { Bridge.getLog().fidelityWarning(LayoutLog.TAG_PATHEFFECT, effectDelegate.getSupportMessage(), - null); + null, null /*data*/); } } @@ -377,7 +377,7 @@ public class Paint_Delegate { 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) { @@ -694,7 +694,7 @@ public class Paint_Delegate { 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; @@ -733,7 +733,7 @@ public class Paint_Delegate { 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; @@ -764,7 +764,7 @@ public class Paint_Delegate { 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; diff --git a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java index 62ea62230061..a4e43c111879 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java @@ -698,7 +698,7 @@ public final class Path_Delegate { 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(); diff --git a/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java index 314dcff212a9..147e1d0e7607 100644 --- a/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java @@ -74,7 +74,7 @@ public class PorterDuffXfermode_Delegate extends Xfermode_Delegate { } 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; } @@ -118,7 +118,7 @@ public class PorterDuffXfermode_Delegate extends Xfermode_Delegate { 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); } diff --git a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java index 2c26175d75d9..ffdf5ddb02c9 100644 --- a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java @@ -126,7 +126,7 @@ public class RadialGradient_Delegate extends Gradient_Delegate { 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(); } @@ -135,7 +135,7 @@ public class RadialGradient_Delegate extends Gradient_Delegate { 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(); } diff --git a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java index f86c56cc2a2c..9b6fb82a6329 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java @@ -417,7 +417,8 @@ public class Region_Delegate { // 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; } @@ -426,7 +427,8 @@ public class Region_Delegate { // 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; } diff --git a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java index e812f7f0031e..048990a21a75 100644 --- a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java @@ -118,7 +118,7 @@ public class SweepGradient_Delegate extends Gradient_Delegate { 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(); } @@ -127,7 +127,7 @@ public class SweepGradient_Delegate extends Gradient_Delegate { 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(); } diff --git a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java index 44275d6ab928..00a2a57951dd 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java @@ -127,13 +127,13 @@ public final class Typeface_Delegate { /*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; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java index 6e9f4d5ab76e..37576b4ec9c0 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java @@ -137,17 +137,17 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge { */ 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); } }; @@ -207,7 +207,7 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge { @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 diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index f5fc036ef773..82e217a677ab 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -343,7 +343,7 @@ public final class BridgeContext extends Activity { } 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; } @@ -391,7 +391,8 @@ public final class BridgeContext extends Activity { } 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*/); } } } @@ -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$ 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; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java index 61ac81bee4a6..e95d295bb608 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java @@ -180,7 +180,7 @@ public final class BridgeInflater extends LayoutInflater { 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; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java index 8446a990a9c3..23d81a2b7ba7 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java @@ -143,7 +143,8 @@ public final class BridgeResources extends Resources { 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; } } @@ -176,13 +177,13 @@ public final class BridgeResources extends Resources { 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; } @@ -193,7 +194,8 @@ public final class BridgeResources extends Resources { 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; } } @@ -253,7 +255,7 @@ public final class BridgeResources extends Resources { } } 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. @@ -288,7 +290,7 @@ public final class BridgeResources extends Resources { } } 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. diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java index 42f05e381594..84bb4d1dd304 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java @@ -207,10 +207,10 @@ public final class BridgeTypedArray extends TypedArray { 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; @@ -238,10 +238,10 @@ public final class BridgeTypedArray extends TypedArray { 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. } @@ -271,7 +271,7 @@ public final class BridgeTypedArray extends TypedArray { 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. } @@ -315,13 +315,13 @@ public final class BridgeTypedArray extends TypedArray { 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; } @@ -331,7 +331,7 @@ public final class BridgeTypedArray extends TypedArray { 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; @@ -360,10 +360,10 @@ public final class BridgeTypedArray extends TypedArray { 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. } @@ -410,10 +410,10 @@ public final class BridgeTypedArray extends TypedArray { } // 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; @@ -542,10 +542,10 @@ public final class BridgeTypedArray extends TypedArray { } // 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; @@ -656,7 +656,8 @@ public final class BridgeTypedArray extends TypedArray { 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; @@ -685,21 +686,7 @@ public final class BridgeTypedArray extends TypedArray { 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()); } @@ -724,10 +711,10 @@ public final class BridgeTypedArray extends TypedArray { 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; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java index c4ebb8a9e682..21d6b1a67505 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java @@ -730,7 +730,7 @@ public class GcSnapshot { } else { Bridge.getLog().fidelityWarning(LayoutLog.TAG_SHADER, shaderDelegate.getSupportMessage(), - null); + null /*throwable*/, null /*data*/); } } @@ -764,7 +764,7 @@ public class GcSnapshot { } else { Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE, xfermodeDelegate.getSupportMessage(), - null); + null /*throwable*/, null /*data*/); } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java index 566d4d4a87f8..2439791f0097 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java @@ -1046,7 +1046,8 @@ public class RenderSessionImpl { 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; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java index 4e331d1f9368..475b4be25314 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java @@ -166,7 +166,7 @@ public final class ResourceHelper { } 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*/); } } @@ -197,11 +197,12 @@ public final class ResourceHelper { } 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; @@ -228,7 +229,7 @@ public final class ResourceHelper { } 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 @@ -238,7 +239,8 @@ public final class ResourceHelper { } 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*/); } } } |