diff options
12 files changed, 114 insertions, 98 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java index 212223c7f669..c36b37bcb9c1 100644 --- a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java +++ b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java @@ -17,6 +17,7 @@ package android.graphics; import com.android.layoutlib.api.IDensityBasedResourceValue.Density; +import com.android.layoutlib.bridge.Bridge; import android.content.res.AssetManager; import android.content.res.Resources; @@ -448,7 +449,9 @@ public class BitmapFactory { Bitmap bm; if (is instanceof AssetManager.AssetInputStream) { - // FIXME: log this. + Bridge.getLog().error(null, + "Bitmap.decodeStream: " + + "InputStream is unsupported (AssetManager.AssetInputStream)"); 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/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java index bc6ad64e228d..b116d2b3bc2d 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java @@ -16,7 +16,7 @@ package android.graphics; -import com.android.layoutlib.api.ILayoutLog; +import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.impl.DelegateManager; import com.android.layoutlib.bridge.impl.Stack; @@ -59,7 +59,6 @@ public class Canvas_Delegate { // ---- delegate data ---- private BufferedImage mBufferedImage; private final Stack<Graphics2D> mGraphicsStack = new Stack<Graphics2D>(); - private ILayoutLog mLogger; // ---- Public Helper methods ---- @@ -78,14 +77,6 @@ public class Canvas_Delegate { } /** - * Sets the layoutlib logger into the canvas. - * @param logger - */ - public void setLogger(ILayoutLog logger) { - mLogger = logger; - } - - /** * Returns the current {@link Graphics2D} used to draw. */ public Graphics2D getGraphics2d() { @@ -408,10 +399,11 @@ public class Canvas_Delegate { // give it to the graphics2D as a new matrix replacing all previous transform g.setTransform(matrixTx); - // FIXME: log -// if (mLogger != null && matrixDelegate.hasPerspective()) { -// mLogger.warning("android.graphics.Canvas#setMatrix(android.graphics.Matrix) only supports affine transformations in the Layout Editor."); -// } + if (matrixDelegate.hasPerspective()) { + Bridge.getLog().warning(null, + "android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " + + "supports affine transformations in the Layout Preview."); + } } /*package*/ static boolean native_clipRect(int nCanvas, @@ -1042,11 +1034,10 @@ public class Canvas_Delegate { g.setPaint(shaderPaint); useColorPaint = false; } else { - if (mLogger != null) { - mLogger.warning(String.format( - "Shader '%1$s' is not supported in the Layout Editor.", + Bridge.getLog().warning(null, + String.format( + "Shader '%1$s' is not supported in the Layout Preview.", shaderDelegate.getClass().getCanonicalName())); - } } } @@ -1089,10 +1080,11 @@ public class Canvas_Delegate { g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // if xfermode wasn't null, then it's something we don't support. log it. - if (mLogger != null && xfermodeDelegate != null) { - mLogger.warning(String.format( - "Xfermode '%1$s' is not supported in the Layout Editor.", - xfermodeDelegate.getClass().getCanonicalName())); + if (xfermodeDelegate != null) { + Bridge.getLog().warning(null, + String.format( + "Xfermode '%1$s' is not supported in the Layout Preview.", + xfermodeDelegate.getClass().getCanonicalName())); } } diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java index 3d26e4704438..a6c6dfdbf30c 100644 --- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java @@ -16,6 +16,7 @@ package android.graphics; +import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.impl.DelegateManager; import com.android.ninepatch.NinePatchChunk; @@ -71,7 +72,7 @@ public class NinePatch_Delegate { oos = new ObjectOutputStream(baos); oos.writeObject(chunk); } catch (IOException e) { - //FIXME log this. + Bridge.getLog().error("Failed to serialize NinePatchChunk.", e); return null; } finally { if (oos != null) { @@ -205,10 +206,10 @@ public class NinePatch_Delegate { sChunkCache.put(array, new SoftReference<NinePatchChunk>(chunk)); } } catch (IOException e) { - // FIXME: log this + Bridge.getLog().error("Failed to deserialize NinePatchChunk content.", e); return null; } catch (ClassNotFoundException e) { - // FIXME: log this + Bridge.getLog().error("Failed to deserialize NinePatchChunk class.", e); return null; } finally { if (ois != null) { 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 2a94774bafbc..38e03cabf144 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java @@ -17,7 +17,7 @@ package com.android.layoutlib.bridge; import com.android.layoutlib.api.Capabilities; -import com.android.layoutlib.api.ILayoutLog; +import com.android.layoutlib.api.LayoutLog; import com.android.layoutlib.api.IProjectCallback; import com.android.layoutlib.api.IResourceValue; import com.android.layoutlib.api.IXmlPullParser; @@ -133,14 +133,16 @@ public final class Bridge extends LayoutBridge { private final static IntArray sIntArrayWrapper = new IntArray(); /** - * A default logger than prints to stdout/stderr. + * A default log than prints to stdout/stderr. */ - private final static ILayoutLog sDefaultLogger = new ILayoutLog() { - public void error(String message) { + private final static LayoutLog sDefaultLog = new LayoutLog() { + @Override + public void error(String tag, String message) { System.err.println(message); } - public void error(Throwable t) { + @Override + public void error(String tag, Throwable t) { String message = t.getMessage(); if (message == null) { message = t.getClass().getName(); @@ -149,11 +151,23 @@ public final class Bridge extends LayoutBridge { System.err.println(message); } - public void warning(String message) { + @Override + public void error(String tag, String message, Throwable throwable) { + System.err.println(message); + } + + @Override + public void warning(String tag, String message) { System.out.println(message); } }; + /** + * Current log. + */ + private static LayoutLog sCurrentLog = sDefaultLog; + + private EnumSet<Capabilities> mCapabilities; @@ -203,7 +217,7 @@ public final class Bridge extends LayoutBridge { OverrideMethod.setDefaultListener(new MethodAdapter() { @Override public void onInvokeV(String signature, boolean isNative, Object caller) { - sDefaultLogger.error("Missing Stub: " + signature + + sDefaultLog.error(null, "Missing Stub: " + signature + (isNative ? " (native)" : "")); if (debug.equalsIgnoreCase("throw")) { @@ -311,7 +325,7 @@ public final class Bridge extends LayoutBridge { @Override public BridgeLayoutScene createScene(SceneParams params) { try { - SceneResult lastResult = SceneStatus.SUCCESS.getResult(); + SceneResult lastResult = SceneStatus.SUCCESS.createResult(); LayoutSceneImpl scene = new LayoutSceneImpl(params); try { prepareThread(); @@ -335,7 +349,7 @@ public final class Bridge extends LayoutBridge { t2 = t.getCause(); } return new BridgeLayoutScene(null, - SceneStatus.ERROR_UNKNOWN.getResult(t2.getMessage(), t2)); + SceneStatus.ERROR_UNKNOWN.createResult(t2.getMessage(), t2)); } } @@ -383,6 +397,23 @@ public final class Bridge extends LayoutBridge { Looper.sThreadLocal.remove(); } + public static LayoutLog getLog() { + return sCurrentLog; + } + + public static void setLog(LayoutLog log) { + // check only the thread currently owning the lock can do this. + if (sLock.isHeldByCurrentThread() == false) { + throw new IllegalStateException("scene must be acquired first. see #acquire(long)"); + } + + if (log != null) { + sCurrentLog = log; + } else { + sCurrentLog = sDefaultLog; + } + } + /** * Returns details of a framework resource from its integer value. * @param value the integer value @@ -391,7 +422,6 @@ public final class Bridge extends LayoutBridge { */ public static String[] resolveResourceValue(int value) { return sRMap.get(value); - } /** 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 688f2406eda3..32b2fd471458 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 @@ -16,7 +16,6 @@ package com.android.layoutlib.bridge.android; -import com.android.layoutlib.api.ILayoutLog; import com.android.layoutlib.api.IProjectCallback; import com.android.layoutlib.api.IResourceValue; import com.android.layoutlib.api.IStyleResourceValue; @@ -97,7 +96,6 @@ public final class BridgeContext extends Activity { private BridgeInflater mInflater; private final IProjectCallback mProjectCallback; - private final ILayoutLog mLogger; private BridgeContentResolver mContentResolver; private final Stack<BridgeXmlBlockParser> mParserStack = new Stack<BridgeXmlBlockParser>(); @@ -122,11 +120,10 @@ public final class BridgeContext extends Activity { Map<String, Map<String, IResourceValue>> projectResources, Map<String, Map<String, IResourceValue>> frameworkResources, Map<IStyleResourceValue, IStyleResourceValue> styleInheritanceMap, - IProjectCallback projectCallback, ILayoutLog logger) { + IProjectCallback projectCallback) { mProjectKey = projectKey; mMetrics = metrics; mProjectCallback = projectCallback; - mLogger = logger; mThemeValues = currentTheme; mProjectResources = projectResources; @@ -183,10 +180,6 @@ public final class BridgeContext extends Activity { return mProjectCallback; } - public ILayoutLog getLogger() { - return mLogger; - } - public Map<String, String> getDefaultPropMap(Object key) { return mDefaultPropMaps.get(key); } @@ -340,7 +333,7 @@ public final class BridgeContext extends Activity { // good, nothing to do. } else if (set != null) { // null parser is ok // really this should not be happening since its instantiated in Bridge - mLogger.error("Parser is not a BridgeXmlBlockParser!"); + Bridge.getLog().error(null, "Parser is not a BridgeXmlBlockParser!"); 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 d9e26e258ba8..057c9c3167c9 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 @@ -178,7 +178,7 @@ public final class BridgeInflater extends LayoutInflater { return inflate(bridgeParser, root); } catch (Exception e) { - bridgeContext.getLogger().error(e); + Bridge.getLog().error(null, e); // return null below. } } 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 affd1c62835c..678be9cc260c 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 @@ -174,11 +174,11 @@ public final class BridgeResources extends Resources { return ColorStateList.createFromXml(this, new BridgeXmlBlockParser(parser, mContext, resValue.isFramework())); } catch (XmlPullParserException e) { - mContext.getLogger().error(e); + Bridge.getLog().error(null, e); } catch (FileNotFoundException e) { // will not happen, since we pre-check } catch (IOException e) { - mContext.getLogger().error(e); + Bridge.getLog().error(null, e); } } else { @@ -245,7 +245,7 @@ public final class BridgeResources extends Resources { return new BridgeXmlBlockParser(parser, mContext, mPlatformResourceFlag[0]); } } catch (XmlPullParserException e) { - mContext.getLogger().error(e); + Bridge.getLog().error(null, e); // we'll return null below. } catch (FileNotFoundException e) { // this shouldn't happen since we check above. @@ -279,7 +279,7 @@ public final class BridgeResources extends Resources { return new BridgeXmlBlockParser(parser, mContext, mPlatformResourceFlag[0]); } } catch (XmlPullParserException e) { - mContext.getLogger().error(e); + Bridge.getLog().error(null, e); // 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 c8dc9e627481..800256b2cd12 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 @@ -205,7 +205,7 @@ public final class BridgeTypedArray extends TypedArray { if (i != null) { result |= i.intValue(); } else { - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unknown constant \"%s\" in attribute \"%2$s\"", keyword, mNames[index])); } @@ -235,7 +235,7 @@ public final class BridgeTypedArray extends TypedArray { try { return Float.parseFloat(s); } catch (NumberFormatException e) { - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unable to convert \"%s\" into a float in attribute \"%2$s\"", s, mNames[index])); @@ -267,7 +267,7 @@ public final class BridgeTypedArray extends TypedArray { try { return ResourceHelper.getColor(s); } catch (NumberFormatException e) { - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unable to convert \"%s\" into a color in attribute \"%2$s\"", s, mNames[index])); @@ -322,13 +322,13 @@ public final class BridgeTypedArray extends TypedArray { } catch (Exception e) { // this is an error and not warning since the file existence is checked before // attempting to parse it. - mContext.getLogger().error(e); + Bridge.getLog().error(null, e); // return null below. } // looks like were unable to resolve the color value. - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unable to resolve color value \"%1$s\" in attribute \"%2$s\"", value, mNames[index])); @@ -356,7 +356,7 @@ public final class BridgeTypedArray extends TypedArray { try { return Integer.parseInt(s); } catch (NumberFormatException e) { - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unable to convert \"%s\" into a integer in attribute \"%2$s\"", s, mNames[index])); @@ -405,7 +405,7 @@ public final class BridgeTypedArray extends TypedArray { } // looks like we were unable to resolve the dimension value - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unable to resolve dimension value \"%1$s\" in attribute \"%2$s\"", s, mNames[index])); @@ -534,7 +534,7 @@ public final class BridgeTypedArray extends TypedArray { } // looks like we were unable to resolve the fraction value - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unable to resolve fraction value \"%1$s\" in attribute \"%2$s\"", value, mNames[index])); @@ -641,7 +641,7 @@ public final class BridgeTypedArray extends TypedArray { return idValue.intValue(); } - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unable to resolve id \"%1$s\" for attribute \"%2$s\"", value, mNames[index])); return defValue; } @@ -675,7 +675,7 @@ public final class BridgeTypedArray extends TypedArray { } // looks like we were unable to resolve the drawable - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( "Unable to resolve drawable \"%1$s\" in attribute \"%2$s\"", stringValue, mNames[index])); @@ -704,7 +704,7 @@ public final class BridgeTypedArray extends TypedArray { return new CharSequence[] { value }; } - mContext.getLogger().warning(String.format( + Bridge.getLog().warning(null, String.format( String.format("Unknown value for getTextArray(%d) => %s", //DEBUG index, mData[index].getName()))); diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java index 400a05fc0ac1..4ee813cf7673 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java @@ -146,7 +146,7 @@ public abstract class AnimationThread extends Thread { } } while (mListener.isCanceled() == false && mQueue.size() > 0); - mListener.done(SceneStatus.SUCCESS.getResult()); + mListener.done(SceneStatus.SUCCESS.createResult()); } finally { postAnimation(); Handler_Delegate.setCallback(null); diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java index 359180f0a2f7..d58cde8541eb 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java @@ -50,7 +50,6 @@ import android.app.Fragment_Delegate; import android.graphics.Bitmap; import android.graphics.Bitmap_Delegate; import android.graphics.Canvas; -import android.graphics.Canvas_Delegate; import android.graphics.drawable.Drawable; import android.os.Handler; import android.util.DisplayMetrics; @@ -174,7 +173,7 @@ public class LayoutSceneImpl { // build the context mContext = new BridgeContext(mParams.getProjectKey(), metrics, mCurrentTheme, mParams.getProjectResources(), mParams.getFrameworkResources(), - styleParentMap, mParams.getProjectCallback(), mParams.getLogger()); + styleParentMap, mParams.getProjectCallback()); // set the current rendering context sCurrentContext = mContext; @@ -202,7 +201,7 @@ public class LayoutSceneImpl { mBlockParser = new BridgeXmlBlockParser(mParams.getLayoutDescription(), mContext, false /* platformResourceFlag */); - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } /** @@ -243,8 +242,9 @@ public class LayoutSceneImpl { // scene mContext.initResources(); sCurrentContext = mContext; + Bridge.setLog(mParams.getLog()); - return SUCCESS.getResult(); + return SUCCESS.createResult(); } /** @@ -267,10 +267,10 @@ public class LayoutSceneImpl { boolean acquired = lock.tryLock(timeout, TimeUnit.MILLISECONDS); if (acquired == false) { - return ERROR_TIMEOUT.getResult(); + return ERROR_TIMEOUT.createResult(); } } catch (InterruptedException e) { - return ERROR_LOCK_INTERRUPTED.getResult(); + return ERROR_LOCK_INTERRUPTED.createResult(); } } else { // This thread holds the lock already. Checks that this wasn't for a different context. @@ -279,7 +279,7 @@ public class LayoutSceneImpl { if (mContext != sCurrentContext) { throw new IllegalStateException("Acquiring different scenes from same thread without releases"); } - return SUCCESS.getResult(); + return SUCCESS.createResult(); } return null; @@ -297,6 +297,7 @@ public class LayoutSceneImpl { if (lock.isHeldByCurrentThread()) { // Make sure to remove static references, otherwise we could not unload the lib mContext.disposeResources(); + Bridge.setLog(null); sCurrentContext = null; lock.unlock(); @@ -344,9 +345,9 @@ public class LayoutSceneImpl { mViewRoot.setBackgroundDrawable(d); } - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } catch (PostInflateException e) { - return SceneStatus.ERROR_INFLATION.getResult(e.getMessage(), e); + return SceneStatus.ERROR_INFLATION.createResult(e.getMessage(), e); } catch (Throwable e) { // get the real cause of the exception. Throwable t = e; @@ -355,9 +356,9 @@ public class LayoutSceneImpl { } // log it - mParams.getLogger().error(t); + mParams.getLog().error("Scene inflate failed", t); - return SceneStatus.ERROR_INFLATION.getResult(t.getMessage(), t); + return SceneStatus.ERROR_INFLATION.createResult(t.getMessage(), t); } } @@ -377,7 +378,7 @@ public class LayoutSceneImpl { try { if (mViewRoot == null) { - return SceneStatus.ERROR_NOT_INFLATED.getResult(); + return SceneStatus.ERROR_NOT_INFLATED.createResult(); } // measure the views int w_spec, h_spec; @@ -457,10 +458,6 @@ public class LayoutSceneImpl { mCanvas.setDensity(mParams.getDensity()); } - // to set the logger, get the native delegate - Canvas_Delegate canvasDelegate = Canvas_Delegate.getDelegate(mCanvas); - canvasDelegate.setLogger(mParams.getLogger()); - long preDrawTime = System.currentTimeMillis(); mViewRoot.draw(mCanvas); @@ -472,7 +469,7 @@ public class LayoutSceneImpl { System.out.println(String.format("rendering (ms): %03d", drawTime - preDrawTime)); // success! - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } catch (Throwable e) { // get the real cause of the exception. Throwable t = e; @@ -481,9 +478,9 @@ public class LayoutSceneImpl { } // log it - mParams.getLogger().error(t); + mParams.getLog().error("Scene Render failed", t); - return SceneStatus.ERROR_UNKNOWN.getResult(t.getMessage(), t); + return SceneStatus.ERROR_UNKNOWN.createResult(t.getMessage(), t); } } @@ -524,7 +521,7 @@ public class LayoutSceneImpl { new PlayAnimationThread(anim, this, animationName, listener).start(); - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } } catch (Exception e) { // get the real cause of the exception. @@ -533,11 +530,11 @@ public class LayoutSceneImpl { t = t.getCause(); } - return SceneStatus.ERROR_UNKNOWN.getResult(t.getMessage(), t); + return SceneStatus.ERROR_UNKNOWN.createResult(t.getMessage(), t); } } - return SceneStatus.ERROR_ANIM_NOT_FOUND.getResult(); + return SceneStatus.ERROR_ANIM_NOT_FOUND.createResult(); } /** @@ -581,7 +578,7 @@ public class LayoutSceneImpl { }.start(); // always return success since the real status will come through the listener. - return SceneStatus.SUCCESS.getResult(child); + return SceneStatus.SUCCESS.createResult(child); } // add it to the parentView in the correct location @@ -612,10 +609,10 @@ public class LayoutSceneImpl { private SceneResult addView(ViewGroup parent, View view, int index) { try { parent.addView(view, index); - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } catch (UnsupportedOperationException e) { // looks like this is a view class that doesn't support children manipulation! - return SceneStatus.ERROR_VIEWGROUP_NO_CHILDREN.getResult(); + return SceneStatus.ERROR_VIEWGROUP_NO_CHILDREN.createResult(); } } @@ -659,7 +656,7 @@ public class LayoutSceneImpl { }.start(); // always return success since the real status will come through the listener. - return SceneStatus.SUCCESS.getResult(layoutParams); + return SceneStatus.SUCCESS.createResult(layoutParams); } SceneResult result = moveView(parentView, childView, index, layoutParams); @@ -701,10 +698,10 @@ public class LayoutSceneImpl { parent.addView(view, index); } - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } catch (UnsupportedOperationException e) { // looks like this is a view class that doesn't support children manipulation! - return SceneStatus.ERROR_VIEWGROUP_NO_CHILDREN.getResult(); + return SceneStatus.ERROR_VIEWGROUP_NO_CHILDREN.createResult(); } } @@ -741,7 +738,7 @@ public class LayoutSceneImpl { }.start(); // always return success since the real status will come through the listener. - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } SceneResult result = removeView(parent, childView); @@ -764,10 +761,10 @@ public class LayoutSceneImpl { private SceneResult removeView(ViewGroup parent, View view) { try { parent.removeView(view); - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } catch (UnsupportedOperationException e) { // looks like this is a view class that doesn't support children manipulation! - return SceneStatus.ERROR_VIEWGROUP_NO_CHILDREN.getResult(); + return SceneStatus.ERROR_VIEWGROUP_NO_CHILDREN.createResult(); } } @@ -927,7 +924,7 @@ public class LayoutSceneImpl { return (IStyleResourceValue)parent; } - mParams.getLogger().error( + mParams.getLog().error(null, String.format("Unable to resolve parent style name: %s", parentName)); return null; diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java index bbc7f4bceaa1..2e2c5f4013e6 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/PlayAnimationThread.java @@ -38,7 +38,7 @@ public class PlayAnimationThread extends AnimationThread { // the queue is filled when this method returns. mAnimator.start(); - return SceneStatus.SUCCESS.getResult(); + return SceneStatus.SUCCESS.createResult(); } @Override 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 ceb8a0d64e11..5a4a0a533c8f 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 @@ -17,8 +17,8 @@ package com.android.layoutlib.bridge.impl; import com.android.layoutlib.api.IDensityBasedResourceValue; -import com.android.layoutlib.api.IDensityBasedResourceValue.Density; import com.android.layoutlib.api.IResourceValue; +import com.android.layoutlib.api.IDensityBasedResourceValue.Density; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.android.BridgeContext; import com.android.layoutlib.bridge.android.BridgeXmlBlockParser; @@ -188,11 +188,11 @@ public final class ResourceHelper { new BridgeXmlBlockParser(parser, context, isFramework)); return d; } catch (XmlPullParserException e) { - context.getLogger().error(e); + Bridge.getLog().error(null, e); } catch (FileNotFoundException e) { // will not happen, since we pre-check } catch (IOException e) { - context.getLogger().error(e); + Bridge.getLog().error(null, e); } } |