Merge "Fix AnalogClock rendering" into lmp-dev
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeAssetManager.java b/tools/layoutlib/bridge/src/android/content/res/BridgeAssetManager.java
index 93814b2..c41a4ee 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeAssetManager.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeAssetManager.java
@@ -23,7 +23,7 @@
 public class BridgeAssetManager extends AssetManager {
 
     /**
-     * This initializes the static field {@link AssetManager#mSystem} which is used
+     * This initializes the static field {@link AssetManager#sSystem} which is used
      * by methods who get a global asset manager using {@link AssetManager#getSystem()}.
      * <p/>
      * They will end up using our bridge asset manager.
diff --git a/tools/layoutlib/bridge/src/android/graphics/FontFamily_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/FontFamily_Delegate.java
index 4993262..ab79664 100644
--- a/tools/layoutlib/bridge/src/android/graphics/FontFamily_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/FontFamily_Delegate.java
@@ -282,7 +282,7 @@
     @LayoutlibDelegate
     /*package*/ static boolean nAddFontFromAsset(long nativeFamily, AssetManager mgr, String path) {
         Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
-                "FontFamily.addFontFromAsset is not supported.", null, null);
+                "Typeface.createFromAsset is not supported.", null, null);
         return false;
     }
 
diff --git a/tools/layoutlib/bridge/src/android/text/format/Time_Delegate.java b/tools/layoutlib/bridge/src/android/text/format/Time_Delegate.java
deleted file mode 100644
index ed8498f..0000000
--- a/tools/layoutlib/bridge/src/android/text/format/Time_Delegate.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.text.format;
-
-import java.util.Calendar;
-import java.util.TimeZone;
-import java.util.UnknownFormatConversionException;
-import java.util.regex.Pattern;
-
-import com.android.ide.common.rendering.api.LayoutLog;
-import com.android.layoutlib.bridge.Bridge;
-import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
-
-/**
- * Delegate used to provide new implementation for native methods of {@link Time}
- *
- * Through the layoutlib_create tool, some native methods of Time have been replaced by calls to
- * methods of the same name in this delegate class.
- */
-public class Time_Delegate {
-
-    // Regex to match odd number of '%'.
-    private static final Pattern p = Pattern.compile("(?<!%)(%%)*%(?!%)");
-
-    // Format used by toString()
-    private static final String FORMAT = "%1$tY%1$tm%1$tdT%1$tH%1$tM%1$tS<%1$tZ>";
-
-    // ---- private helper methods ----
-
-    private static Calendar timeToCalendar(Time time) {
-        Calendar calendar = getCalendarInstance(time);
-        calendar.set(time.year, time.month, time.monthDay, time.hour, time.minute, time.second);
-        return calendar;
-    }
-
-    private static void calendarToTime(Calendar c, Time time) {
-        time.timezone = c.getTimeZone().getID();
-        time.set(c.get(Calendar.SECOND), c.get(Calendar.MINUTE), c.get(Calendar.HOUR_OF_DAY),
-                c.get(Calendar.DATE), c.get(Calendar.MONTH), c.get(Calendar.YEAR));
-        time.weekDay = c.get(Calendar.DAY_OF_WEEK);
-        time.yearDay = c.get(Calendar.DAY_OF_YEAR);
-        time.isDst = c.getTimeZone().inDaylightTime(c.getTime()) ? 1 : 0;
-        // gmtoff is in seconds and TimeZone.getOffset() returns milliseconds.
-        time.gmtoff = c.getTimeZone().getOffset(c.getTimeInMillis()) / DateUtils.SECOND_IN_MILLIS;
-    }
-
-    /**
-     * Return a calendar instance with the correct timezone.
-     *
-     * @param time Time to obtain the timezone from.
-     */
-    private static Calendar getCalendarInstance(Time time) {
-        // TODO: Check platform code to make sure the behavior is same for null/invalid timezone.
-        if (time == null || time.timezone == null) {
-            // Default to local timezone.
-            return Calendar.getInstance();
-        }
-        // If timezone is invalid, use GMT.
-        return Calendar.getInstance(TimeZone.getTimeZone(time.timezone));
-    }
-}
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 ec78712..0af04ec 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -36,6 +36,7 @@
 import com.android.tools.layoutlib.create.OverrideMethod;
 import com.android.util.Pair;
 import com.ibm.icu.util.ULocale;
+import libcore.io.MemoryMappedFile_Delegate;
 
 import android.content.res.BridgeAssetManager;
 import android.graphics.Bitmap;
@@ -252,6 +253,7 @@
 
         // load the fonts.
         FontFamily_Delegate.setFontLocation(fontLocation.getAbsolutePath());
+        MemoryMappedFile_Delegate.setDataDir(fontLocation.getAbsoluteFile().getParentFile());
 
         // now parse com.android.internal.R (and only this one as android.R is a subset of
         // the internal version), and put the content in the maps.
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/libcore/io/BridgeBufferIterator.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/libcore/io/BridgeBufferIterator.java
new file mode 100644
index 0000000..2075989
--- /dev/null
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/libcore/io/BridgeBufferIterator.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutlib.bridge.libcore.io;
+
+import java.nio.MappedByteBuffer;
+
+import libcore.io.BufferIterator;
+
+/**
+ * Provides an implementation of {@link BufferIterator} over a {@link MappedByteBuffer}.
+ */
+public class BridgeBufferIterator extends BufferIterator {
+
+    private int mPosition;
+    private final long mSize;
+    private final MappedByteBuffer mMappedByteBuffer;
+
+    public BridgeBufferIterator(long size, MappedByteBuffer buffer) {
+        mSize = size;
+        mMappedByteBuffer = buffer;
+    }
+
+    @Override
+    public void seek(int offset) {
+        assert offset < mSize;
+       mPosition = offset;
+    }
+
+    @Override
+    public void skip(int byteCount) {
+        assert mPosition + byteCount <= mSize;
+        mPosition += byteCount;
+    }
+
+    @Override
+    public void readByteArray(byte[] dst, int dstOffset, int byteCount) {
+        assert dst.length >= dstOffset + byteCount;
+        mMappedByteBuffer.position(mPosition);
+        mMappedByteBuffer.get(dst, dstOffset, byteCount);
+        mPosition = mMappedByteBuffer.position();
+    }
+
+    @Override
+    public byte readByte() {
+        mMappedByteBuffer.position(mPosition);
+        byte b = mMappedByteBuffer.get();
+        mPosition = mMappedByteBuffer.position();
+        return b;
+    }
+
+    @Override
+    public int readInt() {
+        mMappedByteBuffer.position(mPosition);
+        int i = mMappedByteBuffer.getInt();
+        mPosition = mMappedByteBuffer.position();
+        return i;
+    }
+
+    @Override
+    public void readIntArray(int[] dst, int dstOffset, int intCount) {
+        mMappedByteBuffer.position(mPosition);
+        while (--intCount >= 0) {
+            dst[dstOffset++] = mMappedByteBuffer.getInt();
+        }
+        mPosition = mMappedByteBuffer.position();
+    }
+
+    @Override
+    public short readShort() {
+        mMappedByteBuffer.position(mPosition);
+        short s = mMappedByteBuffer.getShort();
+        mPosition = mMappedByteBuffer.position();
+        return s;
+    }
+}
diff --git a/tools/layoutlib/bridge/src/libcore/io/MemoryMappedFile_Delegate.java b/tools/layoutlib/bridge/src/libcore/io/MemoryMappedFile_Delegate.java
new file mode 100644
index 0000000..3c18bd3
--- /dev/null
+++ b/tools/layoutlib/bridge/src/libcore/io/MemoryMappedFile_Delegate.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.io;
+
+import com.android.layoutlib.bridge.impl.DelegateManager;
+import com.android.layoutlib.bridge.libcore.io.BridgeBufferIterator;
+import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
+
+import android.system.ErrnoException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel.MapMode;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Delegate used to provide alternate implementation of select methods of {@link MemoryMappedFile}.
+ */
+public class MemoryMappedFile_Delegate {
+
+    private static final DelegateManager<MemoryMappedFile_Delegate> sManager = new
+            DelegateManager<MemoryMappedFile_Delegate>(MemoryMappedFile_Delegate.class);
+
+    private static final Map<MemoryMappedFile, Long> sMemoryMappedFileMap =
+            new HashMap<MemoryMappedFile, Long>();
+
+    private final MappedByteBuffer mMappedByteBuffer;
+    private final long mSize;
+
+    /** Path on the target device where the data file is available. */
+    private static final String TARGET_PATH = System.getenv("ANDROID_ROOT") + "/usr/share/zoneinfo";
+    /** Path on the host (inside the SDK) where the data files are available. */
+    private static File sRootPath;
+
+    @LayoutlibDelegate
+    static MemoryMappedFile mmapRO(String path) throws ErrnoException {
+        if (!path.startsWith(TARGET_PATH)) {
+            throw new ErrnoException("Custom timezone data files are not supported.", 1);
+        }
+        if (sRootPath == null) {
+            throw new ErrnoException("Bridge has not been initialized properly.", 1);
+        }
+        path = path.substring(TARGET_PATH.length());
+        try {
+            RandomAccessFile file = new RandomAccessFile(new File(sRootPath, path), "r");
+            long size = file.length();
+            MemoryMappedFile_Delegate newDelegate = new MemoryMappedFile_Delegate(file);
+            long filePointer = file.getFilePointer();
+            MemoryMappedFile mmFile = new MemoryMappedFile(filePointer, size);
+            long delegateIndex = sManager.addNewDelegate(newDelegate);
+            sMemoryMappedFileMap.put(mmFile, delegateIndex);
+            file.close();  // Also closes the channel opened by the delegate constructor.
+            return mmFile;
+        } catch (IOException e) {
+            throw new ErrnoException("mmapRO", 1, e);
+        }
+    }
+
+    @LayoutlibDelegate
+    static void close(MemoryMappedFile thisFile) throws ErrnoException {
+        Long index = sMemoryMappedFileMap.get(thisFile);
+        if (index != null) {
+            sMemoryMappedFileMap.remove(thisFile);
+            sManager.removeJavaReferenceFor(index);
+        }
+    }
+
+    @LayoutlibDelegate
+    static BufferIterator bigEndianIterator(MemoryMappedFile file) {
+        MemoryMappedFile_Delegate delegate = getDelegate(file);
+        return new BridgeBufferIterator(delegate.mSize, delegate.mMappedByteBuffer);
+    }
+
+    // TODO: implement littleEndianIterator()
+
+    public MemoryMappedFile_Delegate(RandomAccessFile file) throws IOException {
+        mSize = file.length();
+        // It's weird that map() takes size as long, but returns MappedByteBuffer which uses an int
+        // to store the marker to the position.
+        mMappedByteBuffer = file.getChannel().map(MapMode.READ_ONLY, 0, mSize);
+    }
+
+    public static void setDataDir(File path) {
+        sRootPath = path;
+    }
+
+    private static MemoryMappedFile_Delegate getDelegate(MemoryMappedFile file) {
+        Long index = sMemoryMappedFileMap.get(file);
+        return index == null ? null : sManager.getDelegate(index);
+    }
+
+}
diff --git a/tools/layoutlib/bridge/src/libcore/util/ZoneInfo_WallTime_Delegate.java b/tools/layoutlib/bridge/src/libcore/util/ZoneInfo_WallTime_Delegate.java
new file mode 100644
index 0000000..f29c5c0
--- /dev/null
+++ b/tools/layoutlib/bridge/src/libcore/util/ZoneInfo_WallTime_Delegate.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.util;
+
+import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
+
+import java.util.GregorianCalendar;
+
+/**
+ * Delegate used to provide alternate implementation of select methods in {@link ZoneInfo.WallTime}
+ */
+public class ZoneInfo_WallTime_Delegate {
+
+    @LayoutlibDelegate
+    static GregorianCalendar createGregorianCalendar() {
+        return new GregorianCalendar();
+    }
+}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index 1f11ac0b..500c338 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -21,6 +21,7 @@
 import com.android.tools.layoutlib.java.Charsets;
 import com.android.tools.layoutlib.java.IntegralToString;
 import com.android.tools.layoutlib.java.Objects;
+import com.android.tools.layoutlib.java.System_Delegate;
 import com.android.tools.layoutlib.java.UnsafeByteSequence;
 
 import java.util.Arrays;
@@ -131,6 +132,7 @@
             IntegralToString.class,
             UnsafeByteSequence.class,
             Charsets.class,
+            System_Delegate.class,
         };
 
     /**
@@ -171,7 +173,11 @@
         "com.android.internal.view.menu.MenuBuilder#createNewMenuItem",
         "com.android.internal.util.XmlUtils#convertValueToInt",
         "com.android.internal.textservice.ITextServicesManager$Stub#asInterface",
-        "dalvik.system.VMRuntime#newUnpaddedArray"
+        "dalvik.system.VMRuntime#newUnpaddedArray",
+        "libcore.io.MemoryMappedFile#mmapRO",
+        "libcore.io.MemoryMappedFile#close",
+        "libcore.io.MemoryMappedFile#bigEndianIterator",
+        "libcore.util.ZoneInfo$WallTime#createGregorianCalendar",
     };
 
     /**
@@ -262,6 +268,7 @@
             "java.nio.charset.Charsets",                       "com.android.tools.layoutlib.java.Charsets",
             "java.lang.IntegralToString",                      "com.android.tools.layoutlib.java.IntegralToString",
             "java.lang.UnsafeByteSequence",                    "com.android.tools.layoutlib.java.UnsafeByteSequence",
+            "java.nio.charset.StandardCharsets",               "com.android.tools.layoutlib.java.Charsets",
         };
 
     private final static String[] EXCLUDED_CLASSES =
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java
index 9c6fbac..1e2623f 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java
@@ -16,6 +16,8 @@
 
 package com.android.tools.layoutlib.create;
 
+import com.android.tools.layoutlib.java.System_Delegate;
+
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
@@ -47,24 +49,25 @@
     private static final String ANDROID_LOCALE_CLASS =
             "com/android/layoutlib/bridge/android/AndroidLocale";
 
-    private static final String JAVA_LOCALE_CLASS = "java/util/Locale";
+    private static final String JAVA_LOCALE_CLASS = Type.getInternalName(java.util.Locale.class);
     private static final Type STRING = Type.getType(String.class);
 
+    private static final String JAVA_LANG_SYSTEM = Type.getInternalName(System.class);
+
     // Static initialization block to initialize METHOD_REPLACERS.
     static {
         // Case 1: java.lang.System.arraycopy()
         METHOD_REPLACERS.add(new MethodReplacer() {
             @Override
             public boolean isNeeded(String owner, String name, String desc) {
-                return "java/lang/System".equals(owner) && "arraycopy".equals(name) &&
+                return JAVA_LANG_SYSTEM.equals(owner) && "arraycopy".equals(name) &&
                         ARRAYCOPY_DESCRIPTORS.contains(desc);
             }
 
             @Override
-            public void replace(int[] opcode, String[] methodInformation) {
-                assert methodInformation.length == 3 && isNeeded(methodInformation[0], methodInformation[1], methodInformation[2])
-                        && opcode.length == 1;
-                methodInformation[2] = "(Ljava/lang/Object;ILjava/lang/Object;II)V";
+            public void replace(MethodInformation mi) {
+                assert isNeeded(mi.owner, mi.name, mi.desc);
+                mi.desc = "(Ljava/lang/Object;ILjava/lang/Object;II)V";
             }
         });
 
@@ -80,12 +83,11 @@
             }
 
             @Override
-            public void replace(int[] opcode, String[] methodInformation) {
-                assert methodInformation.length == 3 && isNeeded(methodInformation[0], methodInformation[1], methodInformation[2])
-                        && opcode.length == 1;
-                opcode[0] = Opcodes.INVOKESTATIC;
-                methodInformation[0] = ANDROID_LOCALE_CLASS;
-                methodInformation[2] = LOCALE_TO_STRING;
+            public void replace(MethodInformation mi) {
+                assert isNeeded(mi.owner, mi.name, mi.desc);
+                mi.opcode = Opcodes.INVOKESTATIC;
+                mi.owner = ANDROID_LOCALE_CLASS;
+                mi.desc = LOCALE_TO_STRING;
             }
         });
 
@@ -104,10 +106,27 @@
             }
 
             @Override
-            public void replace(int[] opcode, String[] methodInformation) {
-                assert methodInformation.length == 3 && isNeeded(methodInformation[0], methodInformation[1], methodInformation[2])
-                        && opcode.length == 1;
-                methodInformation[0] = ANDROID_LOCALE_CLASS;
+            public void replace(MethodInformation mi) {
+                assert isNeeded(mi.owner, mi.name, mi.desc);
+                mi.owner = ANDROID_LOCALE_CLASS;
+            }
+        });
+
+        // Case 4: java.lang.System.log?()
+        METHOD_REPLACERS.add(new MethodReplacer() {
+            @Override
+            public boolean isNeeded(String owner, String name, String desc) {
+                return JAVA_LANG_SYSTEM.equals(owner) && name.length() == 4
+                        && name.startsWith("log");
+            }
+
+            @Override
+            public void replace(MethodInformation mi) {
+                assert isNeeded(mi.owner, mi.name, mi.desc);
+                assert mi.desc.equals("(Ljava/lang/String;Ljava/lang/Throwable;)V")
+                        || mi.desc.equals("(Ljava/lang/String;)V");
+                mi.name = "log";
+                mi.owner = Type.getInternalName(System_Delegate.class);
             }
         });
     }
@@ -141,13 +160,12 @@
         public void visitMethodInsn(int opcode, String owner, String name, String desc) {
             for (MethodReplacer replacer : METHOD_REPLACERS) {
                 if (replacer.isNeeded(owner, name, desc)) {
-                    String[] methodInformation = {owner, name, desc};
-                    int[] opcodeOut = {opcode};
-                    replacer.replace(opcodeOut, methodInformation);
-                    opcode = opcodeOut[0];
-                    owner = methodInformation[0];
-                    name = methodInformation[1];
-                    desc = methodInformation[2];
+                    MethodInformation mi = new MethodInformation(opcode, owner, name, desc);
+                    replacer.replace(mi);
+                    opcode = mi.opcode;
+                    owner = mi.owner;
+                    name = mi.name;
+                    desc = mi.desc;
                     break;
                 }
             }
@@ -155,19 +173,28 @@
         }
     }
 
+    private static class MethodInformation {
+        public int opcode;
+        public String owner;
+        public String name;
+        public String desc;
+
+        public MethodInformation(int opcode, String owner, String name, String desc) {
+            this.opcode = opcode;
+            this.owner = owner;
+            this.name = name;
+            this.desc = desc;
+        }
+    }
+
     private interface MethodReplacer {
         public boolean isNeeded(String owner, String name, String desc);
 
         /**
-         * This method must update the arrays with the new values of the method attributes -
+         * Updates the MethodInformation with the new values of the method attributes -
          * opcode, owner, name and desc.
-         * @param opcode This array should contain the original value of the opcode. The value is
-         *               modified by the method if needed. The size of the array must be 1.
          *
-         * @param methodInformation This array should contain the original values of the method
-         *                          attributes - owner, name and desc in that order. The values
-         *                          may be modified as needed. The size of the array must be 3.
          */
-        public void replace(int[] opcode, String[] methodInformation);
+        public void replace(MethodInformation mi);
     }
 }
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/java/System_Delegate.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/java/System_Delegate.java
new file mode 100644
index 0000000..613c8d9
--- /dev/null
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/java/System_Delegate.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tools.layoutlib.java;
+
+import com.android.tools.layoutlib.create.ReplaceMethodCallsAdapter;
+
+/**
+ * Provides dummy implementation of methods that don't exist on the host VM.
+ *
+ * @see ReplaceMethodCallsAdapter
+ */
+public class System_Delegate {
+    public static void log(String message) {
+        // ignore.
+    }
+
+    public static void log(String message, Throwable th) {
+        // ignore.
+    }
+}