Snap for 8426163 from 1f3f38a0df8cb45d18107fb1a451bb14d793fde8 to mainline-tzdata2-release

Change-Id: I0ee24732a2bde6072af011c646794d2a508a5d9b
diff --git a/.idea/artifacts/studio_android_widgets_jar.xml b/.idea/artifacts/studio_android_widgets_jar.xml
new file mode 100644
index 0000000..0450be3
--- /dev/null
+++ b/.idea/artifacts/studio_android_widgets_jar.xml
@@ -0,0 +1,8 @@
+<component name="ArtifactManager">
+  <artifact type="jar" name="studio-android-widgets:jar">
+    <output-path>$PROJECT_DIR$/out/artifacts/studio_android_widgets_jar</output-path>
+    <root id="archive" name="studio-android-widgets.jar">
+      <element id="module-output" name="studio-android-widgets" />
+    </root>
+  </artifact>
+</component>
\ No newline at end of file
diff --git a/.idea/artifacts/studio_android_widgets_src_jar.xml b/.idea/artifacts/studio_android_widgets_src_jar.xml
new file mode 100644
index 0000000..a844ca3
--- /dev/null
+++ b/.idea/artifacts/studio_android_widgets_src_jar.xml
@@ -0,0 +1,8 @@
+<component name="ArtifactManager">
+  <artifact type="jar" name="studio-android-widgets-src:jar">
+    <output-path>$PROJECT_DIR$/out/artifacts/studio_android_widgets_src_jar</output-path>
+    <root id="archive" name="studio-android-widgets-src.jar">
+      <element id="dir-copy" path="$PROJECT_DIR$/studio-custom-widgets/src" />
+    </root>
+  </artifact>
+</component>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 5210215..50836c1 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -9,6 +9,7 @@
       <module fileurl="file://$PROJECT_DIR$/remote/common/remote common.iml" filepath="$PROJECT_DIR$/remote/common/remote common.iml" group="remote" />
       <module fileurl="file://$PROJECT_DIR$/remote/server/remote server.iml" filepath="$PROJECT_DIR$/remote/server/remote server.iml" group="remote" />
       <module fileurl="file://$PROJECT_DIR$/remote/tests/remote tests.iml" filepath="$PROJECT_DIR$/remote/tests/remote tests.iml" group="remote" />
+      <module fileurl="file://$PROJECT_DIR$/studio-custom-widgets/studio-android-widgets.iml" filepath="$PROJECT_DIR$/studio-custom-widgets/studio-android-widgets.iml" />
       <module fileurl="file://$PROJECT_DIR$/validator/validator.iml" filepath="$PROJECT_DIR$/validator/validator.iml" />
     </modules>
   </component>
diff --git a/Android.bp b/Android.bp
index 048b78e..b38baa2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,42 +20,14 @@
 // transform the framework jar into the temp_layoutlib jar.
 //
 
-package {
-    default_applicable_licenses: ["frameworks_layoutlib_license"],
-}
-
-// Added automatically by a large-scale-change that took the approach of
-// 'apply every license found to every target'. While this makes sure we respect
-// every license restriction, it may not be entirely correct.
-//
-// e.g. GPL in an MIT project might only apply to the contrib/ directory.
-//
-// Please consider splitting the single license below into multiple licenses,
-// taking care not to lose any license_kind information, and overriding the
-// default license using the 'licenses: [...]' property on targets as needed.
-//
-// For unused files, consider creating a 'fileGroup' with "//visibility:private"
-// to attach the license to, and including a comment whether the files may be
-// used in the current project.
-// See: http://go/android-license-faq
-license {
-    name: "frameworks_layoutlib_license",
-    visibility: [":__subpackages__"],
-    license_kinds: [
-        "SPDX-license-identifier-Apache-2.0",
-        "SPDX-license-identifier-EPL",
-    ],
-    // large-scale-change unable to identify any license_text files
-}
-
 java_genrule_host {
     name: "temp_layoutlib",
     tools: ["layoutlib_create"],
     out: ["temp_layoutlib.jar"],
     srcs: [
         ":atf-prebuilt{.jar}",
-        ":core-icu4j-for-host{.jar}",
-        ":core-libart-for-host{.jar}",
+        ":core-icu4j{.jar}",
+        ":core-libart{.jar}",
         ":framework-all{.jar}",
         ":ext{.jar}",
         ":icu4j-icudata-jarjar{.jar}", // HOST
diff --git a/METADATA b/METADATA
deleted file mode 100644
index 487c3e3..0000000
--- a/METADATA
+++ /dev/null
@@ -1,11 +0,0 @@
-third_party {
-  # would be NOTICE save for EPL in:
-  #   create/tests/res/mock_data/mock_android/fake/InnerTest.java
-  #   create/tests/res/mock_data/mock_android/util/EmptyArray.java
-  #   create/tests/res/mock_data/mock_android/view/View.java
-  #   create/tests/res/mock_data/mock_android/view/ViewGroup.java
-  #   create/tests/res/mock_data/mock_android/widget/LinearLayout.java
-  #   create/tests/res/mock_data/mock_android/widget/TableLayout.java
-  #   create/tests/res/mock_data/notjava/lang/JavaClass.java
-  license_type: RECIPROCAL
-}
diff --git a/bridge/Android.bp b/bridge/Android.bp
index 6e86073..fa07cb8 100644
--- a/bridge/Android.bp
+++ b/bridge/Android.bp
@@ -14,10 +14,6 @@
 // limitations under the License.
 //
 
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
 java_library_host {
     name: "layoutlib",
 
@@ -36,11 +32,8 @@
         "ninepatch-prebuilt",
         "layoutlib-common",
         "layoutlib-validator",
-        "sdk-common",
     ],
 
-    jarjar_rules: "jarjar-rules.txt",
-
     dist: {
         targets: ["layoutlib"],
     },
@@ -65,11 +58,8 @@
         "ninepatch-prebuilt",
         "layoutlib-common",
         "layoutlib-validator",
-        "sdk-common",
     ],
 
-    jarjar_rules: "jarjar-rules.txt",
-
     dist: {
         targets: ["layoutlib"],
     },
diff --git a/bridge/bridge.iml b/bridge/bridge.iml
index c9ce012..9358a54 100644
--- a/bridge/bridge.iml
+++ b/bridge/bridge.iml
@@ -102,16 +102,5 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntry type="module-library">
-      <library>
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../prebuilts/misc/common/sdk-common/sdk-common.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES>
-          <root url="jar://$MODULE_DIR$/../../../prebuilts/misc/common/sdk-common/sdk-common-sources.jar!/" />
-        </SOURCES>
-      </library>
-    </orderEntry>
   </component>
 </module>
\ No newline at end of file
diff --git a/bridge/jarjar-rules.txt b/bridge/jarjar-rules.txt
deleted file mode 100644
index 3318faa..0000000
--- a/bridge/jarjar-rules.txt
+++ /dev/null
@@ -1 +0,0 @@
-rule com.google.protobuf.** com.android.layoutlib.protobuf.@1
diff --git a/bridge/src/android/app/ActivityManager_Accessor.java b/bridge/src/android/app/ActivityManager_Accessor.java
deleted file mode 100644
index aa79658..0000000
--- a/bridge/src/android/app/ActivityManager_Accessor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2020 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.app;
-
-import android.annotation.NonNull;
-import android.content.Context;
-
-public class ActivityManager_Accessor {
-    @NonNull
-    public static ActivityManager getActivityManagerInstance(@NonNull Context context) {
-        return new ActivityManager(context, null);
-    }
-}
diff --git a/bridge/src/android/content/res/BridgeTypedArray.java b/bridge/src/android/content/res/BridgeTypedArray.java
index eb603f0..5023dcb 100644
--- a/bridge/src/android/content/res/BridgeTypedArray.java
+++ b/bridge/src/android/content/res/BridgeTypedArray.java
@@ -18,7 +18,7 @@
 
 import com.android.ide.common.rendering.api.ArrayResourceValue;
 import com.android.ide.common.rendering.api.AttrResourceValue;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceNamespace;
 import com.android.ide.common.rendering.api.ResourceNamespace.Resolver;
@@ -26,7 +26,6 @@
 import com.android.ide.common.rendering.api.ResourceValue;
 import com.android.ide.common.rendering.api.StyleResourceValue;
 import com.android.ide.common.rendering.api.TextResourceValue;
-import com.android.ide.common.resources.ValueXmlHelper;
 import com.android.internal.util.XmlUtils;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.android.BridgeContext;
@@ -74,8 +73,6 @@
  * Custom implementation of TypedArray to handle non compiled resources.
  */
 public final class BridgeTypedArray extends TypedArray {
-    private static final String MATCH_PARENT_INT_STRING = String.valueOf(LayoutParams.MATCH_PARENT);
-    private static final String WRAP_CONTENT_INT_STRING = String.valueOf(LayoutParams.WRAP_CONTENT);
 
     private final Resources mBridgeResources;
     private final BridgeContext mContext;
@@ -211,9 +208,7 @@
         ResourceValue resourceValue = mResourceData[index];
         String value = resourceValue.getValue();
         if (resourceValue instanceof TextResourceValue) {
-            String rawValue =
-                    ValueXmlHelper.unescapeResourceString(resourceValue.getRawXmlValue(),
-                            true, false);
+            String rawValue = resourceValue.getRawXmlValue();
             if (rawValue != null && !rawValue.equals(value)) {
                 return Html.fromHtml(rawValue, FROM_HTML_MODE_COMPACT);
             }
@@ -270,7 +265,7 @@
         try {
             return convertValueToInt(s, defValue);
         } catch (NumberFormatException e) {
-            Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_FORMAT,
+            Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
                     String.format("\"%1$s\" in attribute \"%2$s\" is not a valid integer",
                             s, mNames[index]),
                     null, null);
@@ -293,7 +288,7 @@
                     return Float.parseFloat(s);
             }
         } catch (NumberFormatException e) {
-            Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_FORMAT,
+            Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
                     String.format("\"%1$s\" in attribute \"%2$s\" cannot be converted to float.",
                             s, mNames[index]),
                     null, null);
@@ -387,11 +382,13 @@
             return defValue;
         }
         // Check if the value is a magic constant that doesn't require a unit.
-        if (MATCH_PARENT_INT_STRING.equals(s)) {
-            return LayoutParams.MATCH_PARENT;
-        }
-        if (WRAP_CONTENT_INT_STRING.equals(s)) {
-            return LayoutParams.WRAP_CONTENT;
+        try {
+            int i = Integer.parseInt(s);
+            if (i == LayoutParams.MATCH_PARENT || i == LayoutParams.WRAP_CONTENT) {
+                return i;
+            }
+        } catch (NumberFormatException ignored) {
+            // pass
         }
 
         if (ResourceHelper.parseFloatAttribute(mNames[index], s, mValue, true)) {
@@ -443,33 +440,21 @@
      */
     @Override
     public int getDimensionPixelSize(int index, int defValue) {
-        String s = getString(index);
-        if (s == null) {
+        try {
+            return getDimension(index, null);
+        } catch (RuntimeException e) {
+            String s = getString(index);
+
+            if (s != null) {
+                // looks like we were unable to resolve the dimension value
+                Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
+                        String.format("\"%1$s\" in attribute \"%2$s\" is not a valid format.",
+                                s, mNames[index]),
+                        null, null);
+            }
+
             return defValue;
         }
-
-        if (MATCH_PARENT_INT_STRING.equals(s)) {
-            return LayoutParams.MATCH_PARENT;
-        }
-        if (WRAP_CONTENT_INT_STRING.equals(s)) {
-            return LayoutParams.WRAP_CONTENT;
-        }
-
-        if (ResourceHelper.parseFloatAttribute(mNames[index], s, mValue, true)) {
-            float f = mValue.getDimension(mBridgeResources.getDisplayMetrics());
-
-            final int res = (int) (f + 0.5f);
-            if (res != 0) return res;
-            if (f == 0) return 0;
-            if (f > 0) return 1;
-        }
-
-        // looks like we were unable to resolve the dimension value
-        Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_FORMAT,
-                String.format("\"%1$s\" in attribute \"%2$s\" is not a valid format.", s, mNames[index]),
-                null, null);
-
-        return defValue;
     }
 
     /**
@@ -486,34 +471,21 @@
      */
     @Override
     public int getLayoutDimension(int index, String name) {
-        String s = getString(index);
-        if (s != null) {
-            // Check if the value is a magic constant that doesn't require a unit.
-            if (MATCH_PARENT_INT_STRING.equals(s)) {
-                return LayoutParams.MATCH_PARENT;
-            }
-            if (WRAP_CONTENT_INT_STRING.equals(s)) {
-                return LayoutParams.WRAP_CONTENT;
+        try {
+            // this will throw an exception if not found.
+            return getDimension(index, name);
+        } catch (RuntimeException e) {
+
+            if (LayoutInflater_Delegate.sIsInInclude) {
+                throw new RuntimeException("Layout Dimension '" + name + "' not found.");
             }
 
-            if (ResourceHelper.parseFloatAttribute(mNames[index], s, mValue, true)) {
-                float f = mValue.getDimension(mBridgeResources.getDisplayMetrics());
+            Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
+                    "You must supply a " + name + " attribute.",
+                    null, null);
 
-                final int res = (int) (f + 0.5f);
-                if (res != 0) return res;
-                if (f == 0) return 0;
-                if (f > 0) return 1;
-            }
+            return 0;
         }
-
-        if (LayoutInflater_Delegate.sIsInInclude) {
-            throw new RuntimeException("Layout Dimension '" + name + "' not found.");
-        }
-
-        Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_FORMAT,
-                "You must supply a " + name + " attribute.", null, null);
-
-        return 0;
     }
 
     @Override
@@ -521,6 +493,36 @@
         return getDimensionPixelSize(index, defValue);
     }
 
+    /** @param name attribute name, used for error reporting. */
+    private int getDimension(int index, @Nullable String name) {
+        String s = getString(index);
+        if (s == null) {
+            if (name != null) {
+                throw new RuntimeException("Attribute '" + name + "' not found");
+            }
+            throw new RuntimeException();
+        }
+        // Check if the value is a magic constant that doesn't require a unit.
+        try {
+            int i = Integer.parseInt(s);
+            if (i == LayoutParams.MATCH_PARENT || i == LayoutParams.WRAP_CONTENT) {
+                return i;
+            }
+        } catch (NumberFormatException ignored) {
+            // pass
+        }
+        if (ResourceHelper.parseFloatAttribute(mNames[index], s, mValue, true)) {
+            float f = mValue.getDimension(mBridgeResources.getDisplayMetrics());
+
+            final int res = (int)(f+0.5f);
+            if (res != 0) return res;
+            if (f == 0) return 0;
+            if (f > 0) return 1;
+        }
+
+        throw new RuntimeException();
+    }
+
     /**
      * Retrieve a fractional unit attribute at <var>index</var>.
      *
@@ -548,7 +550,7 @@
         }
 
         // looks like we were unable to resolve the fraction value
-        Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_FORMAT,
+        Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
                 String.format(
                         "\"%1$s\" in attribute \"%2$s\" cannot be converted to a fraction.",
                         value, mNames[index]),
@@ -807,9 +809,57 @@
     }
 
     @Override
+    @SuppressWarnings("ResultOfMethodCallIgnored")
     public int getType(int index) {
         String value = getString(index);
-        return getType(value);
+        if (value == null) {
+            return TYPE_NULL;
+        }
+        if (value.startsWith(PREFIX_RESOURCE_REF)) {
+            return TYPE_REFERENCE;
+        }
+        if (value.startsWith(PREFIX_THEME_REF)) {
+            return TYPE_ATTRIBUTE;
+        }
+        try {
+            // Don't care about the value. Only called to check if an exception is thrown.
+            convertValueToInt(value, 0);
+            if (value.startsWith("0x") || value.startsWith("0X")) {
+                return TYPE_INT_HEX;
+            }
+            // is it a color?
+            if (value.startsWith("#")) {
+                int length = value.length() - 1;
+                if (length == 3) {  // rgb
+                    return TYPE_INT_COLOR_RGB4;
+                }
+                if (length == 4) {  // argb
+                    return TYPE_INT_COLOR_ARGB4;
+                }
+                if (length == 6) {  // rrggbb
+                    return TYPE_INT_COLOR_RGB8;
+                }
+                if (length == 8) {  // aarrggbb
+                    return TYPE_INT_COLOR_ARGB8;
+                }
+            }
+            if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false")) {
+                return TYPE_INT_BOOLEAN;
+            }
+            return TYPE_INT_DEC;
+        } catch (NumberFormatException ignored) {
+            try {
+                Float.parseFloat(value);
+                return TYPE_FLOAT;
+            } catch (NumberFormatException ignore) {
+            }
+            // Might be a dimension.
+            if (ResourceHelper.parseFloatAttribute(null, value, new TypedValue(), false)) {
+                return TYPE_DIMENSION;
+            }
+        }
+        // TODO: handle fractions.
+        return TYPE_STRING;
     }
 
     /**
@@ -981,73 +1031,6 @@
         return ((int)Long.parseLong(charSeq.substring(index), base)) * sign;
     }
 
-    protected static int getType(@Nullable String value) {
-        if (value == null) {
-            return TYPE_NULL;
-        }
-        if (value.startsWith(PREFIX_RESOURCE_REF)) {
-            return TYPE_REFERENCE;
-        }
-        if (value.startsWith(PREFIX_THEME_REF)) {
-            return TYPE_ATTRIBUTE;
-        }
-        if (value.equals("true") || value.equals("false")) {
-            return TYPE_INT_BOOLEAN;
-        }
-        if (value.startsWith("0x") || value.startsWith("0X")) {
-            try {
-                // Check if it is a hex value.
-                Long.parseLong(value.substring(2), 16);
-                return TYPE_INT_HEX;
-            } catch (NumberFormatException e) {
-                return TYPE_STRING;
-            }
-        }
-        if (value.startsWith("#")) {
-            try {
-                // Check if it is a color.
-                ResourceHelper.getColor(value);
-                int length = value.length() - 1;
-                if (length == 3) {  // rgb
-                    return TYPE_INT_COLOR_RGB4;
-                }
-                if (length == 4) {  // argb
-                    return TYPE_INT_COLOR_ARGB4;
-                }
-                if (length == 6) {  // rrggbb
-                    return TYPE_INT_COLOR_RGB8;
-                }
-                if (length == 8) {  // aarrggbb
-                    return TYPE_INT_COLOR_ARGB8;
-                }
-            } catch (NumberFormatException e) {
-                return TYPE_STRING;
-            }
-        }
-        if (!Character.isDigit(value.charAt(value.length() - 1))) {
-            // Check if it is a dimension.
-            if (ResourceHelper.parseFloatAttribute(null, value, new TypedValue(), false)) {
-                return TYPE_DIMENSION;
-            } else {
-                return TYPE_STRING;
-            }
-        }
-        try {
-            // Check if it is an int.
-            convertValueToInt(value, 0);
-            return TYPE_INT_DEC;
-        } catch (NumberFormatException ignored) {
-            try {
-                // Check if it is a float.
-                Float.parseFloat(value);
-                return TYPE_FLOAT;
-            } catch (NumberFormatException ignore) {
-            }
-        }
-        // TODO: handle fractions.
-        return TYPE_STRING;
-    }
-
     static TypedArray obtain(Resources res, int len) {
         return new BridgeTypedArray(res, null, len);
     }
diff --git a/bridge/src/android/content/res/Resources_Delegate.java b/bridge/src/android/content/res/Resources_Delegate.java
index 2689acd..a5216bc 100644
--- a/bridge/src/android/content/res/Resources_Delegate.java
+++ b/bridge/src/android/content/res/Resources_Delegate.java
@@ -20,7 +20,7 @@
 import com.android.ide.common.rendering.api.ArrayResourceValue;
 import com.android.ide.common.rendering.api.AssetRepository;
 import com.android.ide.common.rendering.api.DensityBasedResourceValue;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.PluralsResourceValue;
 import com.android.ide.common.rendering.api.RenderResources;
@@ -42,7 +42,7 @@
 import com.android.resources.ResourceUrl;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 import com.android.tools.layoutlib.annotations.VisibleForTesting;
-import com.android.utils.Pair;
+import com.android.util.Pair;
 
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
@@ -71,6 +71,7 @@
 import static com.android.SdkConstants.ANDROID_PKG;
 import static com.android.SdkConstants.PREFIX_RESOURCE_REF;
 
+@SuppressWarnings("deprecation")
 public class Resources_Delegate {
     private static WeakHashMap<Resources, LayoutlibCallback> sLayoutlibCallbacks =
             new WeakHashMap<>();
@@ -225,7 +226,7 @@
                 } else {
                     message = e.getMessage();
                 }
-                Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_FORMAT, message, e, null, null);
+                Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, message, e, null, null);
                 return 0;
             }
         }
@@ -371,16 +372,16 @@
                             values[i] = getInt(element);
                         }
                     } catch (NumberFormatException e) {
-                        Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_FORMAT,
+                        Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
                                 "Integer resource array contains non-integer value: \"" + element +
                                         "\"", null, null);
                     } catch (IllegalArgumentException e) {
-                        Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_FORMAT,
+                        Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
                                 "Integer resource array contains wrong color format: \"" + element +
                                         "\"", null, null);
                     }
                 } else {
-                    Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_FORMAT,
+                    Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
                             "Integer resource array contains non-integer value: \"" +
                                     resValue.getElement(i) + "\"", null, null);
                 }
@@ -394,13 +395,13 @@
             try {
                 return new int[]{getInt(firstValue)};
             } catch (NumberFormatException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_FORMAT,
+                Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
                         "Integer resource array contains non-integer value: \"" + firstValue + "\"",
                         null, null);
                 return new int[1];
             }
         } else {
-            Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_FORMAT,
+            Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT,
                     "Integer resource array contains non-integer value: \"" +
                             rv.getValue() + "\"", null, null);
             return new int[1];
@@ -431,7 +432,7 @@
             if (resValue != null) {
                 final ResourceType type = resValue.getResourceType();
                 if (type != ResourceType.ARRAY) {
-                    Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_RESOLVE,
+                    Bridge.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE,
                             String.format(
                                     "Resource with id 0x%1$X is not an array resource, but %2$s",
                                     id, type == null ? "null" : type.getDisplayName()),
@@ -439,7 +440,7 @@
                     return null;
                 }
                 if (!(resValue instanceof ArrayResourceValue)) {
-                    Bridge.getLog().warning(ILayoutLog.TAG_UNSUPPORTED,
+                    Bridge.getLog().warning(LayoutLog.TAG_UNSUPPORTED,
                             "Obtaining resource arrays via getTextArray, getStringArray or getIntArray is not fully supported in this version of the IDE.",
                             null, null);
                 }
@@ -487,7 +488,7 @@
                     return parser;
                 }
             } catch (XmlPullParserException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                         "Failed to parse " + value.getValue(), e, null, null /*data*/);
                 // we'll return null below.
             }
@@ -510,7 +511,7 @@
             try {
                 return ResourceHelper.getXmlBlockParser(getContext(resources), value);
             } catch (XmlPullParserException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                         "Failed to parse " + value.getValue(), e, null, null /*data*/);
                 // we'll return null below.
             }
@@ -945,7 +946,7 @@
             try {
                 return ResourceHelper.getXmlBlockParser(getContext(resources), value);
             } catch (XmlPullParserException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                         "Failed to parse " + value.getValue(), e, null, null /*data*/);
                 // we'll return null below.
             }
@@ -1077,12 +1078,12 @@
             }
             // We have package but no type
             String pkg = name.substring(0, colonIdx);
-            ResourceType type = ResourceType.fromClassName(defType);
+            ResourceType type = ResourceType.getEnum(defType);
             return type != null ? ResourceUrl.create(pkg, type, name.substring(colonIdx + 1)) :
                     null;
         }
 
-        ResourceType type = ResourceType.fromClassName(name.substring(0, slashIdx));
+        ResourceType type = ResourceType.getEnum(name.substring(0, slashIdx));
         if (type == null) {
             return null;
         }
diff --git a/bridge/src/android/graphics/BaseCanvas_Delegate.java b/bridge/src/android/graphics/BaseCanvas_Delegate.java
index 5a9236c..df28305 100644
--- a/bridge/src/android/graphics/BaseCanvas_Delegate.java
+++ b/bridge/src/android/graphics/BaseCanvas_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.layoutlib.bridge.impl.GcSnapshot;
@@ -29,11 +29,7 @@
 import android.util.imagepool.ImagePool;
 import android.util.imagepool.ImagePoolProvider;
 
-import java.awt.Composite;
-import java.awt.Graphics2D;
-import java.awt.PaintContext;
-import java.awt.RenderingHints;
-import java.awt.Shape;
+import java.awt.*;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Arc2D;
 import java.awt.geom.Area;
@@ -171,7 +167,7 @@
     @LayoutlibDelegate
     /*package*/ static void nDrawPaint(long nativeCanvas, long paint) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawPaint is not supported.", null,null, null /*data*/);
     }
 
@@ -424,7 +420,7 @@
     /*package*/ static void nDrawRegion(long nativeCanvas, long nativeRegion,
             long nativePaint) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Some canvas paths may not be drawn", null, null, null);
     }
 
@@ -516,7 +512,7 @@
             int meshWidth, int meshHeight, float[] verts, int vertOffset, int[] colors,
             int colorOffset, long nPaint) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawBitmapMesh is not supported.", null, null, null /*data*/);
     }
 
@@ -528,7 +524,7 @@
             short[] indices, int indexOffset,
             int indexCount, long nPaint) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawVertices is not supported.", null, null, null /*data*/);
     }
 
@@ -577,7 +573,7 @@
             float vOffset, int bidiFlags,
             long paint) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawTextOnPath is not supported.", null, null, null /*data*/);
     }
 
@@ -588,7 +584,7 @@
             float vOffset,
             int bidiFlags, long paint) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Canvas.drawTextOnPath is not supported.", null, null, null /*data*/);
     }
 
diff --git a/bridge/src/android/graphics/BidiRenderer.java b/bridge/src/android/graphics/BidiRenderer.java
index 40d350b..1de2a45 100644
--- a/bridge/src/android/graphics/BidiRenderer.java
+++ b/bridge/src/android/graphics/BidiRenderer.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 
 import android.annotation.NonNull;
@@ -222,7 +222,7 @@
     }
 
     private static void logFontWarning() {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_BROKEN,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN,
                 "Some fonts could not be loaded. The rendering may not be perfect.", null, null,
                 null);
     }
diff --git a/bridge/src/android/graphics/BitmapFactory_Delegate.java b/bridge/src/android/graphics/BitmapFactory_Delegate.java
index 7a12d38..b344451 100644
--- a/bridge/src/android/graphics/BitmapFactory_Delegate.java
+++ b/bridge/src/android/graphics/BitmapFactory_Delegate.java
@@ -73,9 +73,12 @@
                         npis, true /*is9Patch*/, false /*convert*/);
 
                 // get the bitmap and chunk objects.
+                bm = Bitmap_Delegate.createBitmap(ninePatch.getImage(), bitmapCreateFlags,
+                        density);
                 NinePatchChunk chunk = ninePatch.getChunk();
-                bm = Bitmap_Delegate.createBitmap(ninePatch.getImage(),
-                        NinePatch_Delegate.serialize(chunk), bitmapCreateFlags, density);
+
+                // put the chunk in the bitmap
+                bm.setNinePatchChunk(NinePatch_Delegate.serialize(chunk));
 
                 if (padding != null) {
                     // read the padding
diff --git a/bridge/src/android/graphics/BitmapShader_Delegate.java b/bridge/src/android/graphics/BitmapShader_Delegate.java
index e763824..53b1db6 100644
--- a/bridge/src/android/graphics/BitmapShader_Delegate.java
+++ b/bridge/src/android/graphics/BitmapShader_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -118,7 +118,7 @@
             try {
                 canvasMatrix = xform.createInverse();
             } catch (NoninvertibleTransformException e) {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_INVERSE,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
                         "Unable to inverse matrix in BitmapShader", e, null, null /*data*/);
                 canvasMatrix = new AffineTransform();
             }
@@ -127,7 +127,7 @@
             try {
                 localMatrix = localMatrix.createInverse();
             } catch (NoninvertibleTransformException e) {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_INVERSE,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
                         "Unable to inverse matrix in BitmapShader", e, null, null /*data*/);
                 localMatrix = new AffineTransform();
             }
diff --git a/bridge/src/android/graphics/Bitmap_Delegate.java b/bridge/src/android/graphics/Bitmap_Delegate.java
index bfd00c5..7fc952d 100644
--- a/bridge/src/android/graphics/Bitmap_Delegate.java
+++ b/bridge/src/android/graphics/Bitmap_Delegate.java
@@ -17,7 +17,7 @@
 package android.graphics;
 
 import com.android.ide.common.rendering.api.AssetRepository;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceValue;
 import com.android.layoutlib.bridge.Bridge;
@@ -143,7 +143,7 @@
         Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.ARGB_8888);
         delegate.mIsMutable = createFlags.contains(BitmapCreateFlags.MUTABLE);
 
-        return createBitmap(delegate, createFlags, density.getDpiValue(), null);
+        return createBitmap(delegate, createFlags, density.getDpiValue());
     }
 
     /**
@@ -172,27 +172,11 @@
      */
     public static Bitmap createBitmap(BufferedImage image, Set<BitmapCreateFlags> createFlags,
             Density density) {
-        return createBitmap(image, null, createFlags, density);
-    }
-
-    /**
-     * Creates and returns a {@link Bitmap} initialized with the given {@link BufferedImage}
-     *
-     * @param image the bitmap content
-     * @param ninePatchChunk serialized ninepatch data
-     * @param density the density associated with the bitmap
-     *
-     * @see Bitmap#isPremultiplied()
-     * @see Bitmap#isMutable()
-     * @see Bitmap#getDensity()
-     */
-    public static Bitmap createBitmap(BufferedImage image, byte[] ninePatchChunk,
-            Set<BitmapCreateFlags> createFlags, Density density) {
         // create a delegate with the given image.
         Bitmap_Delegate delegate = new Bitmap_Delegate(image, Config.ARGB_8888);
         delegate.mIsMutable = createFlags.contains(BitmapCreateFlags.MUTABLE);
 
-        return createBitmap(delegate, createFlags, density.getDpiValue(), ninePatchChunk);
+        return createBitmap(delegate, createFlags, density.getDpiValue());
     }
 
     private static int getBufferedImageType() {
@@ -250,7 +234,7 @@
         delegate.mIsMutable = isMutable;
 
         return createBitmap(delegate, getPremultipliedBitmapCreateFlags(isMutable),
-                            Bitmap.getDefaultDensity(), null);
+                            Bitmap.getDefaultDensity());
     }
 
     @LayoutlibDelegate
@@ -280,7 +264,7 @@
         delegate.mIsMutable = isMutable;
 
         return createBitmap(delegate, getPremultipliedBitmapCreateFlags(isMutable),
-                Bitmap.getDefaultDensity(), null);
+                Bitmap.getDefaultDensity());
     }
 
     @LayoutlibDelegate
@@ -315,14 +299,14 @@
     @LayoutlibDelegate
     /*package*/ static void nativeReconfigure(long nativeBitmap, int width, int height,
             int config, boolean isPremultiplied) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "Bitmap.reconfigure() is not supported", null, null /*data*/);
     }
 
     @LayoutlibDelegate
     /*package*/ static boolean nativeCompress(long nativeBitmap, int format, int quality,
             OutputStream stream, byte[] tempStorage) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "Bitmap.compress() is not supported", null, null /*data*/);
         return true;
     }
@@ -442,14 +426,14 @@
     @LayoutlibDelegate
     /*package*/ static void nativeCopyPixelsToBuffer(long nativeBitmap, Buffer dst) {
         // FIXME implement native delegate
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Bitmap.copyPixelsToBuffer is not supported.", null, null, null /*data*/);
     }
 
     @LayoutlibDelegate
     /*package*/ static void nativeCopyPixelsFromBuffer(long nb, Buffer src) {
         // FIXME implement native delegate
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Bitmap.copyPixelsFromBuffer is not supported.", null, null, null /*data*/);
     }
 
@@ -467,7 +451,7 @@
     /*package*/ static Bitmap nativeCreateFromParcel(Parcel p) {
         // 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(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "AIDL is not suppored, and therefore Bitmaps cannot be created from parcels.",
                 null, null /*data*/);
         return null;
@@ -477,7 +461,7 @@
     /*package*/ static boolean nativeWriteToParcel(long nativeBitmap, int density, Parcel p) {
         // This is only called when sending a bitmap through aidl, so really this should not
         // be called.
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "AIDL is not suppored, and therefore Bitmaps cannot be written to parcels.",
                 null, null /*data*/);
         return false;
@@ -495,7 +479,7 @@
         Paint_Delegate paint = Paint_Delegate.getDelegate(nativePaint);
 
         if (paint != null && paint.getMaskFilter() != null) {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MASKFILTER,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER,
                     "MaskFilter not supported in Bitmap.extractAlpha",
                     null, null, null /*data*/);
         }
@@ -509,7 +493,7 @@
 
         // the density doesn't matter, it's set by the Java method.
         return createBitmap(delegate, EnumSet.of(BitmapCreateFlags.MUTABLE),
-                Density.DEFAULT_DENSITY /*density*/, null);
+                Density.DEFAULT_DENSITY /*density*/);
     }
 
     @LayoutlibDelegate
@@ -633,40 +617,47 @@
         delegate.mIsMutable = srcBmpDelegate.mIsMutable;
 
         return createBitmap(delegate, EnumSet.of(BitmapCreateFlags.NONE),
-                Bitmap.getDefaultDensity(), null);
+                Bitmap.getDefaultDensity());
     }
 
     @LayoutlibDelegate
     /*package*/ static Bitmap nativeWrapHardwareBufferBitmap(HardwareBuffer buffer,
             long nativeColorSpace) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "Bitmap.nativeWrapHardwareBufferBitmap() is not supported", null, null, null);
         return null;
     }
 
     @LayoutlibDelegate
+    /*package*/ static GraphicBuffer nativeCreateGraphicBufferHandle(long nativeBitmap) {
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
+                "Bitmap.nativeCreateGraphicBufferHandle() is not supported", null /*data*/);
+        return null;
+    }
+
+    @LayoutlibDelegate
     /*package*/ static boolean nativeIsSRGB(long nativeBitmap) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "Color spaces are not supported", null, null /*data*/);
         return false;
     }
 
     @LayoutlibDelegate
     /*package*/ static ColorSpace nativeComputeColorSpace(long nativePtr) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "Color spaces are not supported", null, null /*data*/);
         return null;
     }
 
     @LayoutlibDelegate
     /*package*/ static void nativeSetColorSpace(long nativePtr, long nativeColorSpace) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "Color spaces are not supported", null, null /*data*/);
     }
 
     @LayoutlibDelegate
     /*package*/ static boolean nativeIsSRGBLinear(long nativePtr) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "Color spaces are not supported", null, null /*data*/);
         return false;
     }
@@ -691,7 +682,7 @@
 
     @LayoutlibDelegate
     /*package*/ static HardwareBuffer nativeGetHardwareBuffer(long nativeBitmap) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "HardwareBuffer is not supported", null, null /*data*/);
         return null;
     }
@@ -704,7 +695,7 @@
     }
 
     private static Bitmap createBitmap(Bitmap_Delegate delegate,
-            Set<BitmapCreateFlags> createFlags, int density, byte[] ninePatchChunk) {
+            Set<BitmapCreateFlags> createFlags, int density) {
         // get its native_int
         long nativeInt = sManager.addNewDelegate(delegate);
 
@@ -714,7 +705,7 @@
 
         // and create/return a new Bitmap with it
         return new Bitmap(nativeInt, width, height, density, isPremultiplied,
-                ninePatchChunk, null /* layoutBounds */, true /* fromMalloc */);
+                null /*ninePatchChunk*/, null /* layoutBounds */, true /* fromMalloc */);
     }
 
     private static Set<BitmapCreateFlags> getPremultipliedBitmapCreateFlags(boolean isMutable) {
diff --git a/bridge/src/android/graphics/Canvas_Delegate.java b/bridge/src/android/graphics/Canvas_Delegate.java
index 19e88b6..afcb40c 100644
--- a/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/bridge/src/android/graphics/Canvas_Delegate.java
@@ -16,12 +16,13 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.layoutlib.bridge.impl.GcSnapshot;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 
+import android.annotation.Nullable;
 import android.graphics.Bitmap.Config;
 
 import java.awt.Graphics2D;
@@ -353,7 +354,7 @@
 
         if (matrixDelegate.hasPerspective()) {
             assert false;
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_AFFINE,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE,
                     "android.graphics.Canvas#setMatrix(android.graphics.Matrix) only " +
                     "supports affine transformations.", null, null, null /*data*/);
         }
@@ -400,7 +401,7 @@
         canvasDelegate.mDrawFilter = DrawFilter_Delegate.getDelegate(nativeFilter);
 
         if (canvasDelegate.mDrawFilter != null && !canvasDelegate.mDrawFilter.isSupported()) {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_DRAWFILTER,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_DRAWFILTER,
                     canvasDelegate.mDrawFilter.getSupportMessage(), null, null, null /*data*/);
         }
     }
diff --git a/bridge/src/android/graphics/FontFamily_Delegate.java b/bridge/src/android/graphics/FontFamily_Delegate.java
index a452aae..afcf9bd 100644
--- a/bridge/src/android/graphics/FontFamily_Delegate.java
+++ b/bridge/src/android/graphics/FontFamily_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -183,7 +183,7 @@
                 }
             }
         } catch (FileNotFoundException e) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     "Unable to load the list of fonts. Try re-installing the SDK Platform from the SDK Manager.",
                     e, null, null);
         } finally {
@@ -268,12 +268,12 @@
                     // warning.
                     return null;
                 }
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN,
                         String.format("Unable to load font %1$s", relativePath),
                         e, null, null);
             }
         } else {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                     "Only platform fonts located in " + SYSTEM_FONTS + "can be loaded.",
                     null, null, null);
         }
diff --git a/bridge/src/android/graphics/LinearGradient_Delegate.java b/bridge/src/android/graphics/LinearGradient_Delegate.java
index 4574dd7..7b544fe 100644
--- a/bridge/src/android/graphics/LinearGradient_Delegate.java
+++ b/bridge/src/android/graphics/LinearGradient_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -126,7 +126,7 @@
             try {
                 canvasMatrix = xform.createInverse();
             } catch (java.awt.geom.NoninvertibleTransformException e) {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_INVERSE,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
                         "Unable to inverse matrix in LinearGradient", e, null, null /*data*/);
                 canvasMatrix = new java.awt.geom.AffineTransform();
             }
@@ -135,7 +135,7 @@
             try {
                 localMatrix = localMatrix.createInverse();
             } catch (java.awt.geom.NoninvertibleTransformException e) {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_INVERSE,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
                         "Unable to inverse matrix in LinearGradient", e, null, null /*data*/);
                 localMatrix = new java.awt.geom.AffineTransform();
             }
diff --git a/bridge/src/android/graphics/Matrix_Delegate.java b/bridge/src/android/graphics/Matrix_Delegate.java
index d0a0adc..ca3cc96 100644
--- a/bridge/src/android/graphics/Matrix_Delegate.java
+++ b/bridge/src/android/graphics/Matrix_Delegate.java
@@ -17,7 +17,7 @@
 package android.graphics;
 
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -25,6 +25,7 @@
 import android.graphics.Matrix.ScaleToFit;
 
 import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
 
 import libcore.util.NativeAllocationRegistry_Delegate;
 
@@ -63,7 +64,7 @@
      * Returns an {@link AffineTransform} matching the given Matrix.
      */
     public static AffineTransform getAffineTransform(Matrix m) {
-        Matrix_Delegate delegate = sManager.getDelegate(m.ni());
+        Matrix_Delegate delegate = sManager.getDelegate(m.native_instance);
         if (delegate == null) {
             return null;
         }
@@ -72,7 +73,7 @@
     }
 
     public static boolean hasPerspective(Matrix m) {
-        Matrix_Delegate delegate = sManager.getDelegate(m.ni());
+        Matrix_Delegate delegate = sManager.getDelegate(m.native_instance);
         if (delegate == null) {
             return false;
         }
@@ -597,7 +598,7 @@
     /*package*/ static boolean nSetPolyToPoly(long native_object, float[] src, int srcIndex,
             float[] dst, int dstIndex, int pointCount) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Matrix.setPolyToPoly is not supported.",
                 null, null, null /*data*/);
         return false;
diff --git a/bridge/src/android/graphics/NinePatch_Delegate.java b/bridge/src/android/graphics/NinePatch_Delegate.java
index 28e682b..ca2a9ca 100644
--- a/bridge/src/android/graphics/NinePatch_Delegate.java
+++ b/bridge/src/android/graphics/NinePatch_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.ninepatch.NinePatchChunk;
@@ -120,11 +120,11 @@
                     sChunkCache.put(array, new SoftReference<>(chunk));
                 }
             } catch (IOException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                         "Failed to deserialize NinePatchChunk content.", e, null, null /*data*/);
                 return null;
             } catch (ClassNotFoundException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                         "Failed to deserialize NinePatchChunk class.", e, null, null /*data*/);
                 return null;
             }
diff --git a/bridge/src/android/graphics/Paint_Delegate.java b/bridge/src/android/graphics/Paint_Delegate.java
index f6c6d71..0512edf 100644
--- a/bridge/src/android/graphics/Paint_Delegate.java
+++ b/bridge/src/android/graphics/Paint_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -228,7 +228,7 @@
                     return stroke;
                 }
             } else {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_PATHEFFECT,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_PATHEFFECT,
                         mPathEffect.getSupportMessage(),
                         null, null, null /*data*/);
             }
@@ -455,14 +455,14 @@
     /*package*/ static void nSetShadowLayer(long paintPtr,
             float radius, float dx, float dy, long colorSpaceHandle,
             long shadowColor) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Paint.setShadowLayer is not supported.", null, null, null /*data*/);
     }
 
     @LayoutlibDelegate
     /*package*/ static boolean nHasShadowLayer(long paint) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Paint.hasShadowLayer is not supported.", null, null, null /*data*/);
         return false;
     }
@@ -847,7 +847,7 @@
 
         // Log warning if it's not supported.
         if (delegate.mColorFilter != null && !delegate.mColorFilter.isSupported()) {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_COLORFILTER,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_COLORFILTER,
                     delegate.mColorFilter.getSupportMessage(), null, null, null /*data*/);
         }
 
@@ -888,7 +888,7 @@
 
         // since none of those are supported, display a fidelity warning right away
         if (delegate.mMaskFilter != null && !delegate.mMaskFilter.isSupported()) {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MASKFILTER,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_MASKFILTER,
                     delegate.mMaskFilter.getSupportMessage(), null, null, null /*data*/);
         }
 
@@ -984,7 +984,7 @@
     /*package*/ static int nGetTextRunCursor(Paint paint, long native_object, char[] text,
             int contextStart, int contextLength, int flags, int offset, int cursorOpt) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Paint.getTextRunCursor is not supported.", null, null, null /*data*/);
         return 0;
     }
@@ -993,7 +993,7 @@
     /*package*/ static int nGetTextRunCursor(Paint paint, long native_object, String text,
             int contextStart, int contextEnd, int flags, int offset, int cursorOpt) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Paint.getTextRunCursor is not supported.", null, null, null /*data*/);
         return 0;
     }
@@ -1002,7 +1002,7 @@
     /*package*/ static void nGetTextPath(long native_object, int bidiFlags, char[] text,
             int index, int count, float x, float y, long path) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Paint.getTextPath is not supported.", null, null, null /*data*/);
     }
 
@@ -1010,7 +1010,7 @@
     /*package*/ static void nGetTextPath(long native_object, int bidiFlags, String text, int start,
             int end, float x, float y, long path) {
         // FIXME
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Paint.getTextPath is not supported.", null, null, null /*data*/);
     }
 
@@ -1056,7 +1056,7 @@
 
     @LayoutlibDelegate
     /*package*/ static void nSetLetterSpacing(long nativePaint, float letterSpacing) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_TEXT_RENDERING,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_TEXT_RENDERING,
                 "Paint.setLetterSpacing() not supported.", null, null, null);
         Paint_Delegate delegate = sManager.getDelegate(nativePaint);
         if (delegate == null) {
@@ -1085,7 +1085,7 @@
 
     @LayoutlibDelegate
     /*package*/ static void nSetFontFeatureSettings(long nativePaint, String settings) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_TEXT_RENDERING,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_TEXT_RENDERING,
                 "Paint.setFontFeatureSettings() not supported.", null, null, null);
     }
 
@@ -1135,7 +1135,7 @@
             return false;
         }
         if (string.length() > 1) {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_TEXT_RENDERING,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_TEXT_RENDERING,
                     "Paint.hasGlyph() is not supported for ligatures.", null, null, null);
             return false;
         }
diff --git a/bridge/src/android/graphics/PathMeasure_Delegate.java b/bridge/src/android/graphics/PathMeasure_Delegate.java
index 83a4ff1..7276c45 100644
--- a/bridge/src/android/graphics/PathMeasure_Delegate.java
+++ b/bridge/src/android/graphics/PathMeasure_Delegate.java
@@ -16,13 +16,14 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.layoutlib.bridge.util.CachedPathIteratorFactory;
-import com.android.layoutlib.bridge.util.CachedPathIteratorFactory.CachedPathIterator;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 
+import com.android.layoutlib.bridge.util.CachedPathIteratorFactory.CachedPathIterator;
+
 import java.awt.geom.PathIterator;
 
 /**
@@ -78,7 +79,7 @@
     @LayoutlibDelegate
     /*package*/ static boolean native_getPosTan(long native_instance, float distance, float pos[],
             float tan[]) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "PathMeasure.getPostTan is not supported.", null, null, null);
         return false;
     }
@@ -86,14 +87,14 @@
     @LayoutlibDelegate
     /*package*/ static boolean native_getMatrix(long native_instance, float distance, long
             native_matrix, int flags) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "PathMeasure.getMatrix is not supported.", null, null, null);
         return false;
     }
 
     @LayoutlibDelegate
     /*package*/ static boolean native_nextContour(long native_instance) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "PathMeasure.nextContour is not supported.", null, null, null);
         return false;
     }
diff --git a/bridge/src/android/graphics/Path_Delegate.java b/bridge/src/android/graphics/Path_Delegate.java
index 88f2815..df83d65 100644
--- a/bridge/src/android/graphics/Path_Delegate.java
+++ b/bridge/src/android/graphics/Path_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -157,7 +157,7 @@
 
     @LayoutlibDelegate
     /*package*/ static boolean nIsConvex(long nPath) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Path.isConvex is not supported.", null, null, null);
         return true;
     }
@@ -475,7 +475,7 @@
 
     @LayoutlibDelegate
     /*package*/ static boolean nOp(long nPath1, long nPath2, int op, long result) {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED, "Path.op() not supported", null, null);
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "Path.op() not supported", null, null);
         return false;
     }
 
@@ -889,7 +889,7 @@
     public void transform(Matrix_Delegate matrix, Path_Delegate dst) {
         if (matrix.hasPerspective()) {
             assert false;
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_AFFINE,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_AFFINE,
                     "android.graphics.Path#transform() only " +
                     "supports affine transformations.", null, null, null /*data*/);
         }
diff --git a/bridge/src/android/graphics/RadialGradient_Delegate.java b/bridge/src/android/graphics/RadialGradient_Delegate.java
index 4a18219..cd46b31 100644
--- a/bridge/src/android/graphics/RadialGradient_Delegate.java
+++ b/bridge/src/android/graphics/RadialGradient_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -116,7 +116,7 @@
             try {
                 canvasMatrix = xform.createInverse();
             } catch (java.awt.geom.NoninvertibleTransformException e) {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_INVERSE,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
                         "Unable to inverse matrix in RadialGradient", e, null, null /*data*/);
                 canvasMatrix = new java.awt.geom.AffineTransform();
             }
@@ -125,7 +125,7 @@
             try {
                 localMatrix = localMatrix.createInverse();
             } catch (java.awt.geom.NoninvertibleTransformException e) {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_INVERSE,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
                         "Unable to inverse matrix in RadialGradient", e, null, null /*data*/);
                 localMatrix = new java.awt.geom.AffineTransform();
             }
diff --git a/bridge/src/android/graphics/Region_Delegate.java b/bridge/src/android/graphics/Region_Delegate.java
index 254e825..f1f44b9 100644
--- a/bridge/src/android/graphics/Region_Delegate.java
+++ b/bridge/src/android/graphics/Region_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -436,7 +436,7 @@
     /*package*/ static long nativeCreateFromParcel(Parcel p) {
         // 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(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "AIDL is not suppored, and therefore Regions cannot be created from parcels.",
                 null, null /*data*/);
         return 0;
@@ -447,7 +447,7 @@
                                                       Parcel p) {
         // This is only called when sending a region through aidl, so really this should not
         // be called.
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
                 "AIDL is not suppored, and therefore Regions cannot be written to parcels.",
                 null, null /*data*/);
         return false;
diff --git a/bridge/src/android/graphics/SweepGradient_Delegate.java b/bridge/src/android/graphics/SweepGradient_Delegate.java
index 01ef140..e02144d 100644
--- a/bridge/src/android/graphics/SweepGradient_Delegate.java
+++ b/bridge/src/android/graphics/SweepGradient_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -111,7 +111,7 @@
             try {
                 canvasMatrix = xform.createInverse();
             } catch (java.awt.geom.NoninvertibleTransformException e) {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_INVERSE,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
                         "Unable to inverse matrix in SweepGradient", e, null, null /*data*/);
                 canvasMatrix = new java.awt.geom.AffineTransform();
             }
@@ -120,7 +120,7 @@
             try {
                 localMatrix = localMatrix.createInverse();
             } catch (java.awt.geom.NoninvertibleTransformException e) {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_MATRIX_INVERSE,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_MATRIX_INVERSE,
                         "Unable to inverse matrix in SweepGradient", e, null, null /*data*/);
                 localMatrix = new java.awt.geom.AffineTransform();
             }
diff --git a/bridge/src/android/graphics/Typeface_Delegate.java b/bridge/src/android/graphics/Typeface_Delegate.java
index 6c0ab20..fb044d9 100644
--- a/bridge/src/android/graphics/Typeface_Delegate.java
+++ b/bridge/src/android/graphics/Typeface_Delegate.java
@@ -17,7 +17,7 @@
 package android.graphics;
 
 import com.android.SdkConstants;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.ResourceNamespace;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.android.BridgeContext;
@@ -142,7 +142,7 @@
         long newInstance = nativeCreateFromTypeface(native_instance, 0);
 
         if (newInstance != 0) {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                     "nativeCreateFromTypefaceWithVariation is not supported", null, null, null);
         }
         return newInstance;
@@ -272,7 +272,7 @@
                     blockParser.ensurePopped();
                 }
             } else {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                         String.format("File %s does not exist (or is not a file)", path),
                         null, null /*data*/);
             }
diff --git a/bridge/src/android/graphics/drawable/AnimatedVectorDrawable_Delegate.java b/bridge/src/android/graphics/drawable/AnimatedVectorDrawable_Delegate.java
index 9c272fa..be78091 100644
--- a/bridge/src/android/graphics/drawable/AnimatedVectorDrawable_Delegate.java
+++ b/bridge/src/android/graphics/drawable/AnimatedVectorDrawable_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics.drawable;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -99,7 +99,7 @@
     @LayoutlibDelegate
     /*package*/ static long nCreatePathDataPropertyHolder(long nativePtr, long startValuePtr,
             long endValuePtr) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED, "AnimatedVectorDrawable path " +
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "AnimatedVectorDrawable path " +
                 "animations are not supported.", null, null, null);
         return 0;
     }
diff --git a/bridge/src/android/graphics/drawable/NinePatchDrawable_Delegate.java b/bridge/src/android/graphics/drawable/NinePatchDrawable_Delegate.java
deleted file mode 100644
index bd73cfb..0000000
--- a/bridge/src/android/graphics/drawable/NinePatchDrawable_Delegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2020 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.graphics.drawable;
-
-import com.android.ide.common.rendering.api.ILayoutLog;
-import com.android.layoutlib.bridge.Bridge;
-import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
-
-import android.graphics.PixelFormat;
-
-public class NinePatchDrawable_Delegate {
-
-    @LayoutlibDelegate
-    static int getOpacity(NinePatchDrawable thisDrawable) {
-        // User-defined nine-patches can have a null underlying bitmap, if incorrectly constructed.
-        // Trying to preview such a nine-patch drawable will trigger a NullPointerException in the
-        // getOpacity, which then get logged by the Studio crash reporting system.
-        // Do not crash here, but let it instead crash during draw, which gets logged by layoutlib
-        // and is then handled better by Studio.
-        try {
-            return thisDrawable.getOpacity_Original();
-        } catch (NullPointerException ignore) {
-            Bridge.getLog().warning(ILayoutLog.TAG_BROKEN, "The source for the nine-patch " +
-                    "drawable has not been correctly defined.", null , null);
-            return PixelFormat.OPAQUE;
-        }
-    }
-}
diff --git a/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java b/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java
index 828df6b..8102894 100644
--- a/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java
+++ b/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java
@@ -1195,7 +1195,7 @@
                     if (shaderDelegate != null) {
                         // If there is a shader, apply the local transformation to make sure
                         // the gradient is transformed to match the viewport
-                        shaderDelegate.setLocalMatrix(mFinalPathMatrix.ni());
+                        shaderDelegate.setLocalMatrix(mFinalPathMatrix.native_instance);
                         shaderDelegate.setAlpha(fullPath.mFillAlpha);
                     }
 
diff --git a/bridge/src/android/graphics/fonts/FontFamily_Builder_Delegate.java b/bridge/src/android/graphics/fonts/FontFamily_Builder_Delegate.java
index 018329d..32f1157 100644
--- a/bridge/src/android/graphics/fonts/FontFamily_Builder_Delegate.java
+++ b/bridge/src/android/graphics/fonts/FontFamily_Builder_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics.fonts;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -189,7 +189,7 @@
             buffer.get(byteArray);
             return Font.createFont(Font.TRUETYPE_FONT, new ByteArrayInputStream(byteArray));
         } catch (Exception e) {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_BROKEN, "Unable to load font",
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN, "Unable to load font",
                     e, null, null);
         }
 
@@ -201,7 +201,7 @@
             File file = new File(path);
             return Font.createFont(Font.TRUETYPE_FONT, file);
         } catch (Exception e) {
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_BROKEN, "Unable to load font",
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN, "Unable to load font",
                     e, null, null);
         }
 
diff --git a/bridge/src/android/graphics/fonts/Font_Builder_Delegate.java b/bridge/src/android/graphics/fonts/Font_Builder_Delegate.java
index 0d3ce3f..f58f027 100644
--- a/bridge/src/android/graphics/fonts/Font_Builder_Delegate.java
+++ b/bridge/src/android/graphics/fonts/Font_Builder_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.graphics.fonts;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -83,7 +83,7 @@
 
     @LayoutlibDelegate
     /*package*/ static void nAddAxis(long builderPtr, int tag, float value) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Font$Builder.nAddAxis is not supported.", null, null, null);
     }
 
diff --git a/bridge/src/android/graphics/fonts/SystemFonts_Delegate.java b/bridge/src/android/graphics/fonts/SystemFonts_Delegate.java
index 3f3e065..df976d0 100644
--- a/bridge/src/android/graphics/fonts/SystemFonts_Delegate.java
+++ b/bridge/src/android/graphics/fonts/SystemFonts_Delegate.java
@@ -21,11 +21,10 @@
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 
 import android.annotation.NonNull;
-import android.annotation.Nullable;
 import android.text.FontConfig;
+import android.util.ArrayMap;
 
-import java.io.File;
-import java.util.Map;
+import java.util.ArrayList;
 
 import static android.graphics.FontFamily_Delegate.getFontLocation;
 
@@ -44,15 +43,13 @@
 public class SystemFonts_Delegate {
 
     @LayoutlibDelegate
-    /*package*/ static FontConfig getSystemFontConfigInternal(
-            String fontsXml,
-            String systemFontDir,
-            String oemXml,
-            String productFontDir,
-            Map<String, File> updatableFontMap) {
+    /*package*/ static FontConfig.Alias[] buildSystemFallback(@NonNull String xmlPath,
+            @NonNull String fontDir,
+            @NonNull FontCustomizationParser.Result oemCustomization,
+            @NonNull ArrayMap<String, FontFamily[]> fallbackMap,
+            @NonNull ArrayList<Font> availableFonts) {
         Bridge.sIsTypefaceInitialized = true;
-        return SystemFonts.getSystemFontConfigInternal_Original(
-                getFontLocation() + "/standard/fonts.xml", getFontLocation() + "/",
-                null, null, updatableFontMap, 0, 0);
+        return SystemFonts.buildSystemFallback_Original(getFontLocation() + "/standard/fonts.xml",
+                getFontLocation() + "/", oemCustomization, fallbackMap, availableFonts);
     }
 }
diff --git a/bridge/src/android/net/ConnectivityManager.java b/bridge/src/android/net/ConnectivityManager.java
deleted file mode 100644
index 74ac8f5..0000000
--- a/bridge/src/android/net/ConnectivityManager.java
+++ /dev/null
@@ -1,895 +0,0 @@
-/*
- * Copyright (C) 2020 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.net;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.net.IpSecManager.UdpEncapsulationSocket;
-import android.net.SocketKeepalive.Callback;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Messenger;
-import android.os.ParcelFileDescriptor;
-import android.os.PersistableBundle;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.List;
-import java.util.concurrent.Executor;
-
-import static android.os._Original_Build.VERSION_CODES.BASE;
-
-/**
- * Stub ConnectivityManager for layoutlib
- */
-public class ConnectivityManager {
-    @Deprecated
-    public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
-
-    public static final String ACTION_CAPTIVE_PORTAL_SIGN_IN = "android.net.conn.CAPTIVE_PORTAL";
-
-    @Deprecated
-    public static final String EXTRA_NETWORK_INFO = "networkInfo";
-    @Deprecated
-    public static final String EXTRA_NETWORK_TYPE = "networkType";
-
-    @Deprecated
-    public static final String EXTRA_IS_FAILOVER = "isFailover";
-    @Deprecated
-    public static final String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
-    public static final String EXTRA_NO_CONNECTIVITY = "noConnectivity";
-    public static final String EXTRA_REASON = "reason";
-    @Deprecated
-    public static final String EXTRA_EXTRA_INFO = "extraInfo";
-    public static final String EXTRA_INET_CONDITION = "inetCondition";
-    public static final String EXTRA_CAPTIVE_PORTAL = "android.net.extra.CAPTIVE_PORTAL";
-
-    public static final String EXTRA_CAPTIVE_PORTAL_URL = "android.net.extra.CAPTIVE_PORTAL_URL";
-
-    public static final String EXTRA_CAPTIVE_PORTAL_PROBE_SPEC =
-            "android.net.extra.CAPTIVE_PORTAL_PROBE_SPEC";
-
-    public static final String EXTRA_CAPTIVE_PORTAL_USER_AGENT =
-            "android.net.extra.CAPTIVE_PORTAL_USER_AGENT";
-
-    public static final String ACTION_DATA_ACTIVITY_CHANGE =
-            "android.net.conn.DATA_ACTIVITY_CHANGE";
-    public static final String EXTRA_DEVICE_TYPE = "deviceType";
-    public static final String EXTRA_IS_ACTIVE = "isActive";
-    public static final String EXTRA_REALTIME_NS = "tsNanos";
-
-    @Deprecated
-    public static final String ACTION_BACKGROUND_DATA_SETTING_CHANGED =
-            "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED";
-
-    public static final String INET_CONDITION_ACTION =
-            "android.net.conn.INET_CONDITION_ACTION";
-
-    public static final String ACTION_TETHER_STATE_CHANGED =
-            TetheringManager.ACTION_TETHER_STATE_CHANGED;
-
-    public static final String EXTRA_AVAILABLE_TETHER = TetheringManager.EXTRA_AVAILABLE_TETHER;
-
-    public static final String EXTRA_ACTIVE_LOCAL_ONLY = TetheringManager.EXTRA_ACTIVE_LOCAL_ONLY;
-
-    public static final String EXTRA_ACTIVE_TETHER = TetheringManager.EXTRA_ACTIVE_TETHER;
-
-    public static final String EXTRA_ERRORED_TETHER = TetheringManager.EXTRA_ERRORED_TETHER;
-
-    public static final String ACTION_CAPTIVE_PORTAL_TEST_COMPLETED =
-            "android.net.conn.CAPTIVE_PORTAL_TEST_COMPLETED";
-    public static final String EXTRA_IS_CAPTIVE_PORTAL = "captivePortal";
-
-    public static final String ACTION_PROMPT_UNVALIDATED = "android.net.conn.PROMPT_UNVALIDATED";
-
-    public static final String ACTION_PROMPT_LOST_VALIDATION =
-            "android.net.conn.PROMPT_LOST_VALIDATION";
-
-    public static final String ACTION_PROMPT_PARTIAL_CONNECTIVITY =
-            "android.net.conn.PROMPT_PARTIAL_CONNECTIVITY";
-
-    public static final int TETHERING_INVALID   = TetheringManager.TETHERING_INVALID;
-
-    public static final int TETHERING_WIFI      = TetheringManager.TETHERING_WIFI;
-
-    public static final int TETHERING_USB       = TetheringManager.TETHERING_USB;
-
-    public static final int TETHERING_BLUETOOTH = TetheringManager.TETHERING_BLUETOOTH;
-
-    public static final int TETHERING_WIFI_P2P = TetheringManager.TETHERING_WIFI_P2P;
-
-    public static final int TYPE_NONE        = -1;
-
-    @Deprecated
-    public static final int TYPE_MOBILE      = 0;
-
-    @Deprecated
-    public static final int TYPE_WIFI        = 1;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_MMS  = 2;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_SUPL = 3;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_DUN  = 4;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_HIPRI = 5;
-
-    @Deprecated
-    public static final int TYPE_WIMAX       = 6;
-
-    @Deprecated
-    public static final int TYPE_BLUETOOTH   = 7;
-
-    @Deprecated
-    public static final int TYPE_DUMMY       = 8;
-
-    @Deprecated
-    public static final int TYPE_ETHERNET    = 9;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_FOTA = 10;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_IMS  = 11;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_CBS  = 12;
-
-    @Deprecated
-    public static final int TYPE_WIFI_P2P    = 13;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_IA = 14;
-
-    @Deprecated
-    public static final int TYPE_MOBILE_EMERGENCY = 15;
-
-    @Deprecated
-    public static final int TYPE_PROXY = 16;
-
-    @Deprecated
-    public static final int TYPE_VPN = 17;
-
-    @Deprecated
-    public static final int TYPE_TEST = 18; // TODO: Remove this once NetworkTypes are unused.
-
-    @Deprecated
-    public @interface LegacyNetworkType {}
-
-    public static final int MAX_RADIO_TYPE = TYPE_TEST;
-
-    public static final int MAX_NETWORK_TYPE = TYPE_TEST;
-
-    @Deprecated
-    public static final int DEFAULT_NETWORK_PREFERENCE = TYPE_WIFI;
-
-    public static final int REQUEST_ID_UNSET = 0;
-
-    public static final int NETID_UNSET = 0;
-    public static final String PRIVATE_DNS_MODE_OFF = "off";
-    public static final String PRIVATE_DNS_MODE_OPPORTUNISTIC = "opportunistic";
-    public static final String PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = "hostname";
-    public static final String PRIVATE_DNS_DEFAULT_MODE_FALLBACK = PRIVATE_DNS_MODE_OPPORTUNISTIC;
-
-    private static ConnectivityManager sInstance;
-
-    @Deprecated
-    public static boolean isNetworkTypeValid(int networkType) {
-        return false;
-    }
-
-    @Deprecated
-    public static String getNetworkTypeName(int type) {
-        return null;
-    }
-
-    @Deprecated
-    public static boolean isNetworkTypeMobile(int networkType) {
-        return false;
-    }
-
-    @Deprecated
-    public static boolean isNetworkTypeWifi(int networkType) {
-        return false;
-    }
-
-    @Deprecated
-    public void setNetworkPreference(int preference) {
-    }
-
-    @Deprecated
-    public int getNetworkPreference() {
-        return TYPE_NONE;
-    }
-
-    @Deprecated
-    @Nullable
-    public NetworkInfo getActiveNetworkInfo() {
-        return null;
-    }
-
-    @Nullable
-    public Network getActiveNetwork() {
-        return null;
-    }
-
-    @Nullable
-    public Network getActiveNetworkForUid(int uid) {
-        return null;
-    }
-
-    public Network getActiveNetworkForUid(int uid, boolean ignoreBlocked) {
-        return null;
-    }
-
-    public boolean isAlwaysOnVpnPackageSupportedForUser(int userId, @Nullable String vpnPackage) {
-        return false;
-    }
-
-    public boolean setAlwaysOnVpnPackageForUser(int userId, @Nullable String vpnPackage,
-            boolean lockdownEnabled, @Nullable List<String> lockdownList) {
-        return false;
-    }
-
-    public String getAlwaysOnVpnPackageForUser(int userId) {
-        return null;
-    }
-
-    public boolean isVpnLockdownEnabled(int userId) {
-        return false;
-    }
-
-    public List<String> getVpnLockdownWhitelist(int userId) {
-        return null;
-    }
-
-    public NetworkInfo getActiveNetworkInfoForUid(int uid) {
-        return null;
-    }
-
-    public NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked) {
-        return null;
-    }
-
-    @Deprecated
-    @Nullable
-    public NetworkInfo getNetworkInfo(int networkType) {
-        return null;
-    }
-
-    @Deprecated
-    @Nullable
-    public NetworkInfo getNetworkInfo(@Nullable Network network) {
-        return null;
-    }
-
-    public NetworkInfo getNetworkInfoForUid(Network network, int uid, boolean ignoreBlocked) {
-        return null;
-    }
-
-    @Deprecated
-    @NonNull
-    public NetworkInfo[] getAllNetworkInfo() {
-        return new NetworkInfo[0];
-    }
-
-    @Deprecated
-    public Network getNetworkForType(int networkType) {
-        return null;
-    }
-
-    @NonNull
-    public Network[] getAllNetworks() {
-        return new Network[0];
-    }
-
-    public NetworkCapabilities[] getDefaultNetworkCapabilitiesForUser(int userId) {
-        return null;
-    }
-
-    public LinkProperties getActiveLinkProperties() {
-        return null;
-    }
-
-    @Deprecated
-    public LinkProperties getLinkProperties(int networkType) {
-        return null;
-    }
-
-    @Nullable
-    public LinkProperties getLinkProperties(@Nullable Network network) {
-        return null;
-    }
-
-    @Nullable
-    public NetworkCapabilities getNetworkCapabilities(@Nullable Network network) {
-        return null;
-    }
-
-    @Deprecated
-    public String getCaptivePortalServerUrl() {
-        return null;
-    }
-
-    @Deprecated
-    public int startUsingNetworkFeature(int networkType, String feature) {
-        return -1;
-    }
-
-    @Deprecated
-    public int stopUsingNetworkFeature(int networkType, String feature) {
-        return -1;
-    }
-
-    public static NetworkCapabilities networkCapabilitiesForType(int type) {
-        return null;
-    }
-
-    public static class PacketKeepaliveCallback {
-        public PacketKeepaliveCallback() {
-        }
-        public void onStarted() {}
-        public void onStopped() {}
-        public void onError(int error) {}
-    }
-
-    public class PacketKeepalive {
-        public static final int SUCCESS = 0;
-
-        public static final int NO_KEEPALIVE = -1;
-
-        public static final int BINDER_DIED = -10;
-
-        public static final int ERROR_INVALID_NETWORK = -20;
-        public static final int ERROR_INVALID_IP_ADDRESS = -21;
-        public static final int ERROR_INVALID_PORT = -22;
-        public static final int ERROR_INVALID_LENGTH = -23;
-        public static final int ERROR_INVALID_INTERVAL = -24;
-
-        public static final int ERROR_HARDWARE_UNSUPPORTED = -30;
-        public static final int ERROR_HARDWARE_ERROR = -31;
-
-        public static final int NATT_PORT = 4500;
-
-        public static final int MIN_INTERVAL = 10;
-
-        public void stop() {}
-    }
-
-    public PacketKeepalive startNattKeepalive(
-            Network network, int intervalSeconds, PacketKeepaliveCallback callback,
-            InetAddress srcAddr, int srcPort, InetAddress dstAddr) {
-        return null;
-    }
-
-    public @NonNull SocketKeepalive createSocketKeepalive(@NonNull Network network,
-            @NonNull UdpEncapsulationSocket socket,
-            @NonNull InetAddress source,
-            @NonNull InetAddress destination,
-            @NonNull Executor executor,
-            @NonNull Callback callback) {
-        throw new UnsupportedOperationException(
-                "createSocketKeepalive is not supported in layoutlib");
-    }
-
-    public @NonNull SocketKeepalive createNattKeepalive(@NonNull Network network,
-            @NonNull ParcelFileDescriptor pfd,
-            @NonNull InetAddress source,
-            @NonNull InetAddress destination,
-            @NonNull Executor executor,
-            @NonNull Callback callback) {
-        throw new UnsupportedOperationException(
-                "createSocketKeepalive is not supported in layoutlib");
-    }
-
-    public @NonNull SocketKeepalive createSocketKeepalive(@NonNull Network network,
-            @NonNull Socket socket,
-            @NonNull Executor executor,
-            @NonNull Callback callback) {
-        throw new UnsupportedOperationException(
-                "createSocketKeepalive is not supported in layoutlib");
-    }
-
-    @Deprecated
-    public boolean requestRouteToHost(int networkType, int hostAddress) {
-        return false;
-    }
-
-    @Deprecated
-    public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) {
-        return false;
-    }
-
-    @Deprecated
-    public boolean getBackgroundDataSetting() {
-        return false;
-    }
-
-    @Deprecated
-    public void setBackgroundDataSetting(boolean allowBackgroundData) {}
-
-    @Deprecated
-    public boolean getMobileDataEnabled() {
-        return false;
-    }
-
-    public interface OnNetworkActiveListener {
-        void onNetworkActive();
-    }
-
-    public void addDefaultNetworkActiveListener(final OnNetworkActiveListener l) {}
-
-    public void removeDefaultNetworkActiveListener(@NonNull OnNetworkActiveListener l) {}
-
-    public boolean isDefaultNetworkActive() {
-        return false;
-    }
-
-    public ConnectivityManager(Context context, IConnectivityManager service) {
-        sInstance = this;
-    }
-
-    public static ConnectivityManager from(Context context) {
-        return new ConnectivityManager(context, null);
-    }
-
-    public NetworkRequest getDefaultRequest() {
-        return null;
-    }
-
-    public static final void enforceChangePermission(Context context) {}
-
-    @Deprecated
-    static ConnectivityManager getInstanceOrNull() {
-        return sInstance;
-    }
-
-    @Deprecated
-    private static ConnectivityManager getInstance() {
-        if (getInstanceOrNull() == null) {
-            throw new IllegalStateException("No ConnectivityManager yet constructed");
-        }
-        return getInstanceOrNull();
-    }
-
-    @Deprecated
-    public String[] getTetherableIfaces() {
-        return null;
-    }
-
-    @Deprecated
-    public String[] getTetheredIfaces() {
-        return null;
-    }
-
-    @Deprecated
-    public String[] getTetheringErroredIfaces() {
-        return null;
-    }
-
-    @Deprecated
-    public String[] getTetheredDhcpRanges() {
-        throw new UnsupportedOperationException("getTetheredDhcpRanges is not supported");
-    }
-
-    @Deprecated
-    public int tether(String iface) {
-        return 0;
-    }
-
-    @Deprecated
-    public int untether(String iface) {
-        return 0;
-    }
-
-    public boolean isTetheringSupported() {
-        return false;
-    }
-
-    @Deprecated
-    public static abstract class OnStartTetheringCallback {
-        public void onTetheringStarted() {}
-
-        public void onTetheringFailed() {}
-    }
-
-    @Deprecated
-    public void startTethering(int type, boolean showProvisioningUi,
-            final OnStartTetheringCallback callback) {}
-
-    @Deprecated
-    public void startTethering(int type, boolean showProvisioningUi,
-            final OnStartTetheringCallback callback, Handler handler) {}
-
-    @Deprecated
-    public void stopTethering(int type) {}
-
-    @Deprecated
-    public abstract static class OnTetheringEventCallback {
-
-        public void onUpstreamChanged(@Nullable Network network) {}
-    }
-
-    @Deprecated
-    public void registerTetheringEventCallback(
-            @NonNull Executor executor,
-            @NonNull final OnTetheringEventCallback callback) {}
-
-    @Deprecated
-    public void unregisterTetheringEventCallback(
-            @NonNull final OnTetheringEventCallback callback) {}
-
-
-    @Deprecated
-    public String[] getTetherableUsbRegexs() {
-        return null;
-    }
-
-    @Deprecated
-    public String[] getTetherableWifiRegexs() {
-        return null;
-    }
-
-    @Deprecated
-    public String[] getTetherableBluetoothRegexs() {
-        return null;
-    }
-
-    @Deprecated
-    public int setUsbTethering(boolean enable) {
-        return 0;
-    }
-
-    @Deprecated
-    public static final int TETHER_ERROR_NO_ERROR = TetheringManager.TETHER_ERROR_NO_ERROR;
-    @Deprecated
-    public static final int TETHER_ERROR_UNKNOWN_IFACE =
-            TetheringManager.TETHER_ERROR_UNKNOWN_IFACE;
-    @Deprecated
-    public static final int TETHER_ERROR_SERVICE_UNAVAIL =
-            TetheringManager.TETHER_ERROR_SERVICE_UNAVAIL;
-    @Deprecated
-    public static final int TETHER_ERROR_UNSUPPORTED = TetheringManager.TETHER_ERROR_UNSUPPORTED;
-    @Deprecated
-    public static final int TETHER_ERROR_UNAVAIL_IFACE =
-            TetheringManager.TETHER_ERROR_UNAVAIL_IFACE;
-    @Deprecated
-    public static final int TETHER_ERROR_MASTER_ERROR =
-            TetheringManager.TETHER_ERROR_INTERNAL_ERROR;
-    @Deprecated
-    public static final int TETHER_ERROR_TETHER_IFACE_ERROR =
-            TetheringManager.TETHER_ERROR_TETHER_IFACE_ERROR;
-    @Deprecated
-    public static final int TETHER_ERROR_UNTETHER_IFACE_ERROR =
-            TetheringManager.TETHER_ERROR_UNTETHER_IFACE_ERROR;
-    @Deprecated
-    public static final int TETHER_ERROR_ENABLE_NAT_ERROR =
-            TetheringManager.TETHER_ERROR_ENABLE_FORWARDING_ERROR;
-    @Deprecated
-    public static final int TETHER_ERROR_DISABLE_NAT_ERROR =
-            TetheringManager.TETHER_ERROR_DISABLE_FORWARDING_ERROR;
-    @Deprecated
-    public static final int TETHER_ERROR_IFACE_CFG_ERROR =
-            TetheringManager.TETHER_ERROR_IFACE_CFG_ERROR;
-    @Deprecated
-    public static final int TETHER_ERROR_PROVISION_FAILED =
-            TetheringManager.TETHER_ERROR_PROVISIONING_FAILED;
-    @Deprecated
-    public static final int TETHER_ERROR_DHCPSERVER_ERROR =
-            TetheringManager.TETHER_ERROR_DHCPSERVER_ERROR;
-    @Deprecated
-    public static final int TETHER_ERROR_ENTITLEMENT_UNKONWN =
-            TetheringManager.TETHER_ERROR_ENTITLEMENT_UNKNOWN;
-
-    @Deprecated
-    public int getLastTetherError(String iface) {
-        return 0;
-    }
-
-    public @interface EntitlementResultCode {
-    }
-
-    @Deprecated
-    public interface OnTetheringEntitlementResultListener  {
-        void onTetheringEntitlementResult(@EntitlementResultCode int resultCode);
-    }
-
-    @Deprecated
-    public void getLatestTetheringEntitlementResult(int type, boolean showEntitlementUi,
-            @NonNull Executor executor,
-            @NonNull final OnTetheringEntitlementResultListener listener) {}
-
-    public void reportInetCondition(int networkType, int percentage) {}
-
-    @Deprecated
-    public void reportBadNetwork(@Nullable Network network) {}
-
-    public void reportNetworkConnectivity(@Nullable Network network, boolean hasConnectivity) {}
-
-    public void setGlobalProxy(ProxyInfo p) {}
-
-    public ProxyInfo getGlobalProxy() {
-        return null;
-    }
-
-    public ProxyInfo getProxyForNetwork(Network network) {
-        return null;
-    }
-
-    @Nullable
-    public ProxyInfo getDefaultProxy() {
-        return null;
-    }
-
-    @Deprecated
-    public boolean isNetworkSupported(int networkType) {
-        return false;
-    }
-
-    public boolean isActiveNetworkMetered() {
-        return false;
-    }
-
-    public boolean updateLockdownVpn() {
-        return false;
-    }
-
-    public int checkMobileProvisioning(int suggestedTimeOutMs) {
-        return 0;
-    }
-
-    public String getMobileProvisioningUrl() {
-        return null;
-    }
-
-    @Deprecated
-    public void setProvisioningNotificationVisible(boolean visible, int networkType,
-            String action) {}
-
-    public void setAirplaneMode(boolean enable) {}
-
-    public int registerNetworkFactory(Messenger messenger, String name) {
-        return 0;
-    }
-
-    public void unregisterNetworkFactory(Messenger messenger) {}
-
-    public int registerNetworkProvider(@NonNull NetworkProvider provider) {
-        return 0;
-    }
-
-    public void unregisterNetworkProvider(@NonNull NetworkProvider provider) {}
-
-    public void declareNetworkRequestUnfulfillable(@NonNull NetworkRequest request) {}
-
-    public Network registerNetworkAgent(Messenger messenger, NetworkInfo ni, LinkProperties lp,
-            NetworkCapabilities nc, int score, NetworkAgentConfig config) {
-        return null;
-    }
-
-    public Network registerNetworkAgent(Messenger messenger, NetworkInfo ni, LinkProperties lp,
-            NetworkCapabilities nc, int score, NetworkAgentConfig config, int providerId) {
-        return null;
-    }
-
-    public static class NetworkCallback {
-        public void onPreCheck(@NonNull Network network) {}
-
-        public void onAvailable(@NonNull Network network,
-                @NonNull NetworkCapabilities networkCapabilities,
-                @NonNull LinkProperties linkProperties, boolean blocked) {}
-
-        public void onAvailable(@NonNull Network network) {}
-
-        public void onLosing(@NonNull Network network, int maxMsToLive) {}
-
-        public void onLost(@NonNull Network network) {}
-
-        public void onUnavailable() {}
-
-        public void onCapabilitiesChanged(@NonNull Network network,
-                @NonNull NetworkCapabilities networkCapabilities) {}
-
-        public void onLinkPropertiesChanged(@NonNull Network network,
-                @NonNull LinkProperties linkProperties) {}
-
-        public void onNetworkSuspended(@NonNull Network network) {}
-
-        public void onNetworkResumed(@NonNull Network network) {}
-
-        public void onBlockedStatusChanged(@NonNull Network network, boolean blocked) {}
-    }
-
-    public interface Errors {
-        int TOO_MANY_REQUESTS = 1;
-    }
-
-    public static class TooManyRequestsException extends RuntimeException {}
-
-    public static final int CALLBACK_PRECHECK            = BASE + 1;
-    public static final int CALLBACK_AVAILABLE           = BASE + 2;
-    public static final int CALLBACK_LOSING              = BASE + 3;
-    public static final int CALLBACK_LOST                = BASE + 4;
-    public static final int CALLBACK_UNAVAIL             = BASE + 5;
-    public static final int CALLBACK_CAP_CHANGED         = BASE + 6;
-    public static final int CALLBACK_IP_CHANGED          = BASE + 7;
-    private static final int EXPIRE_LEGACY_REQUEST       = BASE + 8;
-    public static final int CALLBACK_SUSPENDED           = BASE + 9;
-    public static final int CALLBACK_RESUMED             = BASE + 10;
-    public static final int CALLBACK_BLK_CHANGED         = BASE + 11;
-
-    public static String getCallbackName(int whichCallback) {
-        switch (whichCallback) {
-            case CALLBACK_PRECHECK:     return "CALLBACK_PRECHECK";
-            case CALLBACK_AVAILABLE:    return "CALLBACK_AVAILABLE";
-            case CALLBACK_LOSING:       return "CALLBACK_LOSING";
-            case CALLBACK_LOST:         return "CALLBACK_LOST";
-            case CALLBACK_UNAVAIL:      return "CALLBACK_UNAVAIL";
-            case CALLBACK_CAP_CHANGED:  return "CALLBACK_CAP_CHANGED";
-            case CALLBACK_IP_CHANGED:   return "CALLBACK_IP_CHANGED";
-            case EXPIRE_LEGACY_REQUEST: return "EXPIRE_LEGACY_REQUEST";
-            case CALLBACK_SUSPENDED:    return "CALLBACK_SUSPENDED";
-            case CALLBACK_RESUMED:      return "CALLBACK_RESUMED";
-            case CALLBACK_BLK_CHANGED:  return "CALLBACK_BLK_CHANGED";
-            default:
-                return Integer.toString(whichCallback);
-        }
-    }
-
-    public void requestNetwork(@NonNull NetworkRequest request,
-            int timeoutMs, int legacyType, @NonNull Handler handler,
-            @NonNull NetworkCallback networkCallback) {}
-
-    public void requestNetwork(@NonNull NetworkRequest request,
-            @NonNull NetworkCallback networkCallback) {}
-
-    public void requestNetwork(@NonNull NetworkRequest request,
-            @NonNull NetworkCallback networkCallback, @NonNull Handler handler) {}
-
-    public void requestNetwork(@NonNull NetworkRequest request,
-            @NonNull NetworkCallback networkCallback, int timeoutMs) {}
-
-    public void requestNetwork(@NonNull NetworkRequest request,
-            @NonNull NetworkCallback networkCallback, @NonNull Handler handler, int timeoutMs) {}
-
-    public static final String EXTRA_NETWORK = "android.net.extra.NETWORK";
-
-    public static final String EXTRA_NETWORK_REQUEST = "android.net.extra.NETWORK_REQUEST";
-
-
-    public void requestNetwork(@NonNull NetworkRequest request,
-            @NonNull PendingIntent operation) {}
-
-    public void releaseNetworkRequest(@NonNull PendingIntent operation) {}
-
-    public void registerNetworkCallback(@NonNull NetworkRequest request,
-            @NonNull NetworkCallback networkCallback) {}
-
-    public void registerNetworkCallback(@NonNull NetworkRequest request,
-            @NonNull NetworkCallback networkCallback, @NonNull Handler handler) {}
-
-    public void registerNetworkCallback(@NonNull NetworkRequest request,
-            @NonNull PendingIntent operation) {}
-
-    public void registerDefaultNetworkCallback(@NonNull NetworkCallback networkCallback) {}
-
-    public void registerDefaultNetworkCallback(@NonNull NetworkCallback networkCallback,
-            @NonNull Handler handler) {}
-
-    public boolean requestBandwidthUpdate(@NonNull Network network) {
-        return false;
-    }
-
-    public void unregisterNetworkCallback(@NonNull NetworkCallback networkCallback) {}
-
-    public void unregisterNetworkCallback(@NonNull PendingIntent operation) {}
-
-    public void setAcceptUnvalidated(Network network, boolean accept, boolean always) {}
-
-    public void setAcceptPartialConnectivity(Network network, boolean accept, boolean always) {}
-
-    public void setAvoidUnvalidated(Network network) {}
-
-    public void startCaptivePortalApp(Network network) {}
-
-    public void startCaptivePortalApp(@NonNull Network network, @NonNull Bundle appExtras) {}
-
-    public boolean shouldAvoidBadWifi() {
-        return false;
-    }
-
-    public static final int MULTIPATH_PREFERENCE_HANDOVER = 1 << 0;
-
-    public static final int MULTIPATH_PREFERENCE_RELIABILITY = 1 << 1;
-
-    public static final int MULTIPATH_PREFERENCE_PERFORMANCE = 1 << 2;
-
-    public static final int MULTIPATH_PREFERENCE_UNMETERED =
-            MULTIPATH_PREFERENCE_HANDOVER |
-                    MULTIPATH_PREFERENCE_RELIABILITY |
-                    MULTIPATH_PREFERENCE_PERFORMANCE;
-
-    public @interface MultipathPreference {
-    }
-
-    public @MultipathPreference int getMultipathPreference(@Nullable Network network) {
-        return 0;
-    }
-
-    public void factoryReset() {}
-
-    public boolean bindProcessToNetwork(@Nullable Network network) {
-        return false;
-    }
-
-    public static boolean setProcessDefaultNetwork(@Nullable Network network) {
-        return false;
-    }
-
-    @Nullable
-    public Network getBoundNetworkForProcess() {
-        return null;
-    }
-
-    @Deprecated
-    @Nullable
-    public static Network getProcessDefaultNetwork() {
-        return null;
-    }
-
-    @Deprecated
-    public static boolean setProcessDefaultNetworkForHostResolution(Network network) {
-        return false;
-    }
-
-    public static final int RESTRICT_BACKGROUND_STATUS_DISABLED = 1;
-
-    public static final int RESTRICT_BACKGROUND_STATUS_WHITELISTED = 2;
-
-    public static final int RESTRICT_BACKGROUND_STATUS_ENABLED = 3;
-
-    public static final String ACTION_RESTRICT_BACKGROUND_CHANGED =
-            "android.net.conn.RESTRICT_BACKGROUND_CHANGED";
-
-    public @interface RestrictBackgroundStatus {
-    }
-
-    public @RestrictBackgroundStatus int getRestrictBackgroundStatus() {
-        return 0;
-    }
-
-    @Nullable
-    public byte[] getNetworkWatchlistConfigHash() {
-        return null;
-    }
-
-    public int getConnectionOwnerUid(
-            int protocol, @NonNull InetSocketAddress local, @NonNull InetSocketAddress remote) {
-        return 0;
-    }
-
-    public void simulateDataStall(int detectionMethod, long timestampMillis,
-            @NonNull Network network, @NonNull PersistableBundle extras) {}
-}
-
diff --git a/bridge/src/android/os/SystemClock_Delegate.java b/bridge/src/android/os/SystemClock_Delegate.java
index b6a85f8..9677aaf 100644
--- a/bridge/src/android/os/SystemClock_Delegate.java
+++ b/bridge/src/android/os/SystemClock_Delegate.java
@@ -54,16 +54,6 @@
     }
 
     /**
-     * Returns nanoseconds since boot, not counting time spent in deep sleep.
-     *
-     * @return nanoseconds of non-sleep uptime since boot.
-     */
-    @LayoutlibDelegate
-    /*package*/ static long uptimeNanos() {
-        return System_Delegate.nanoTime() - System_Delegate.bootTime();
-    }
-
-    /**
      * Returns nanoseconds since boot, including time spent in sleep.
      *
      * @return elapsed nanoseconds since boot.
diff --git a/bridge/src/android/os/SystemProperties_Delegate.java b/bridge/src/android/os/SystemProperties_Delegate.java
index b5c8294..c6a7657 100644
--- a/bridge/src/android/os/SystemProperties_Delegate.java
+++ b/bridge/src/android/os/SystemProperties_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.os;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -106,35 +106,35 @@
 
     @LayoutlibDelegate
     /*package*/ static String native_get(long handle) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Layoutlib does not support SystemProperties Handle", null, null, null);
         return null;
     }
 
     @LayoutlibDelegate
     /*package*/ static int native_get_int(long handle, int def) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Layoutlib does not support SystemProperties Handle", null, null, null);
         return def;
     }
 
     @LayoutlibDelegate
     /*package*/ static long native_get_long(long handle, long def) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Layoutlib does not support SystemProperties Handle", null, null, null);
         return def;
     }
 
     @LayoutlibDelegate
     /*package*/ static boolean native_get_boolean(long handle, boolean def) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Layoutlib does not support SystemProperties Handle", null, null, null);
         return def;
     }
 
     @LayoutlibDelegate
     /*package*/ static long native_find(String name) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                 "Layoutlib does not support SystemProperties Handle", null, null, null);
         return 0;
     }
diff --git a/bridge/src/android/util/PathParser_Delegate.java b/bridge/src/android/util/PathParser_Delegate.java
index 46e94a7..96c093c 100644
--- a/bridge/src/android/util/PathParser_Delegate.java
+++ b/bridge/src/android/util/PathParser_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.util;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -121,7 +121,7 @@
         }
         int length = from.mPathDataNodes.length;
         if (length != to.mPathDataNodes.length) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     "Cannot interpolate path data with different lengths (from " + length + " to " +
                             to.mPathDataNodes.length + ").", null, null);
             return false;
diff --git a/bridge/src/android/view/BridgeInflater.java b/bridge/src/android/view/BridgeInflater.java
index dfb46f2..f2cbfa0 100644
--- a/bridge/src/android/view/BridgeInflater.java
+++ b/bridge/src/android/view/BridgeInflater.java
@@ -17,7 +17,7 @@
 package android.view;
 
 import com.android.SdkConstants;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.MergeCookie;
 import com.android.ide.common.rendering.api.ResourceNamespace;
@@ -264,7 +264,7 @@
                                         true /*readAppTheme*/,
                                         true /*wrapContext*/);
                             } catch (IllegalAccessException | InvocationTargetException e) {
-                                Bridge.getLog().error(ILayoutLog.TAG_BROKEN, e.getMessage(), e,
+                                Bridge.getLog().error(LayoutLog.TAG_BROKEN, e.getMessage(), e,
                                         null, null);
                             }
                             return null;
@@ -295,7 +295,7 @@
             name = attrs.getAttributeValue(null, "class");
 
             if (name == null) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "Unable to inflate view tag without " +
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to inflate view tag without " +
                   "class attribute", null, null);
                 // We weren't able to resolve the view so we just pass a mock View to be able to
                 // continue rendering.
@@ -323,7 +323,7 @@
                 // There is some unknown inflation exception in inflating a View that was found.
                 view = new MockView(context, attrs);
                 ((MockView) view).setText(name);
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN, e.getMessage(), e, null, null);
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN, e.getMessage(), e, null, null);
             } else {
                 final Object lastContext = mConstructorArgs[0];
                 mConstructorArgs[0] = context;
@@ -382,7 +382,7 @@
 
                     return inflate(bridgeParser, root);
                 } catch (Exception e) {
-                    Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_READ,
+                    Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
                             "Failed to parse file " + path, e, null, null);
 
                     return null;
diff --git a/bridge/src/android/view/Choreographer_Delegate.java b/bridge/src/android/view/Choreographer_Delegate.java
index 3a8839f..1dc7778 100644
--- a/bridge/src/android/view/Choreographer_Delegate.java
+++ b/bridge/src/android/view/Choreographer_Delegate.java
@@ -33,8 +33,6 @@
 public class Choreographer_Delegate {
     private static final AtomicReference<Choreographer> mInstance = new AtomicReference<Choreographer>();
 
-    private static final int MS_16 = 16000000;
-
     @LayoutlibDelegate
     public static Choreographer getInstance() {
         if (mInstance.get() == null) {
@@ -62,15 +60,15 @@
         try {
             thisChoreographer.mLastFrameTimeNanos = frameTimeNanos - thisChoreographer.getFrameIntervalNanos();
             thisChoreographer.mFrameInfo.markInputHandlingStart();
-            thisChoreographer.doCallbacks(Choreographer.CALLBACK_INPUT, frameTimeNanos, MS_16);
+            thisChoreographer.doCallbacks(Choreographer.CALLBACK_INPUT, frameTimeNanos);
 
             thisChoreographer.mFrameInfo.markAnimationsStart();
-            thisChoreographer.doCallbacks(Choreographer.CALLBACK_ANIMATION, frameTimeNanos, MS_16);
+            thisChoreographer.doCallbacks(Choreographer.CALLBACK_ANIMATION, frameTimeNanos);
 
             thisChoreographer.mFrameInfo.markPerformTraversalsStart();
-            thisChoreographer.doCallbacks(Choreographer.CALLBACK_TRAVERSAL, frameTimeNanos, MS_16);
+            thisChoreographer.doCallbacks(Choreographer.CALLBACK_TRAVERSAL, frameTimeNanos);
 
-            thisChoreographer.doCallbacks(Choreographer.CALLBACK_COMMIT, frameTimeNanos, MS_16);
+            thisChoreographer.doCallbacks(Choreographer.CALLBACK_COMMIT, frameTimeNanos);
         } finally {
             AnimationUtils.unlockAnimationClock();
         }
diff --git a/bridge/src/android/view/LayoutInflater_Delegate.java b/bridge/src/android/view/LayoutInflater_Delegate.java
index cb446e7..66a94fa 100644
--- a/bridge/src/android/view/LayoutInflater_Delegate.java
+++ b/bridge/src/android/view/LayoutInflater_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.view;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 
@@ -106,7 +106,7 @@
             if (layout == 0) {
                 final String value = attrs.getAttributeValue(null, ATTR_LAYOUT);
                 if (value == null || value.length() <= 0) {
-                    Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "You must specify a layout in the"
+                    Bridge.getLog().error(LayoutLog.TAG_BROKEN, "You must specify a layout in the"
                             + " include tag: <include layout=\"@layout/layoutID\" />", null, null);
                     LayoutInflater.consumeChildElements(parser);
                     return;
@@ -129,10 +129,10 @@
             if (layout == 0) {
                 final String value = attrs.getAttributeValue(null, ATTR_LAYOUT);
                 if (value == null) {
-                    Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "You must specify a layout in the"
+                    Bridge.getLog().error(LayoutLog.TAG_BROKEN, "You must specify a layout in the"
                             + " include tag: <include layout=\"@layout/layoutID\" />", null, null);
                 } else {
-                    Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "You must specify a valid layout "
+                    Bridge.getLog().error(LayoutLog.TAG_BROKEN, "You must specify a valid layout "
                             + "reference. The layout ID " + value + " is not valid.", null, null);
                 }
             } else {
@@ -148,7 +148,7 @@
                     }
 
                     if (type != XmlPullParser.START_TAG) {
-                        Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                        Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                                 childParser.getPositionDescription() + ": No start tag found!",
                                 null, null);
                         LayoutInflater.consumeChildElements(parser);
@@ -226,7 +226,7 @@
                 }
             }
         } else {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     "<include /> can only be used inside of a ViewGroup",
                     null, null);
         }
diff --git a/bridge/src/android/view/MenuInflater_Delegate.java b/bridge/src/android/view/MenuInflater_Delegate.java
index 818d741..83586a1 100644
--- a/bridge/src/android/view/MenuInflater_Delegate.java
+++ b/bridge/src/android/view/MenuInflater_Delegate.java
@@ -16,7 +16,8 @@
 
 package android.view;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import android.content.Context;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.ViewInfo;
 import com.android.internal.view.menu.BridgeMenuItemImpl;
 import com.android.internal.view.menu.MenuView;
@@ -24,7 +25,6 @@
 import com.android.layoutlib.bridge.android.BridgeContext;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 
-import android.content.Context;
 import android.util.AttributeSet;
 
 /**
@@ -64,7 +64,7 @@
             // This is most likely a bug in the LayoutLib code.
             // We suppress this error for AppCompat menus since we do not support them in the menu
             // editor yet.
-            Bridge.getLog().warning(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().warning(LayoutLog.TAG_BROKEN,
                     "Action Bar Menu rendering may be incorrect.", null, null);
         }
 
diff --git a/bridge/src/android/view/View_Delegate.java b/bridge/src/android/view/View_Delegate.java
index 6d82e8a..9aae4ae 100644
--- a/bridge/src/android/view/View_Delegate.java
+++ b/bridge/src/android/view/View_Delegate.java
@@ -16,7 +16,7 @@
 
 package android.view;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.android.BridgeContext;
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
@@ -55,7 +55,7 @@
             // all the layout.
             thisView.draw_Original(canvas);
         } catch (Throwable t) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "View draw failed", t, null, null);
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN, "View draw failed", t, null, null);
         }
     }
 
@@ -67,7 +67,7 @@
             // all the layout.
             return thisView.draw_Original(canvas, parent, drawingTime);
         } catch (Throwable t) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "View draw failed", t, null, null);
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN, "View draw failed", t, null, null);
         }
         return false;
     }
@@ -79,7 +79,7 @@
             // all the layout.
             thisView.measure_Original(widthMeasureSpec, heightMeasureSpec);
         } catch (Throwable t) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "View measure failed", t, null, null);
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN, "View measure failed", t, null, null);
         }
     }
 
@@ -90,7 +90,7 @@
             // all the layout.
             thisView.layout_Original(l, t, r, b);
         } catch (Throwable th) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "View layout failed", th, null, null);
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN, "View layout failed", th, null, null);
         }
     }
 
diff --git a/bridge/src/android/view/accessibility/AccessibilityManager.java b/bridge/src/android/view/accessibility/AccessibilityManager.java
index 4454f29..d5e60a9 100644
--- a/bridge/src/android/view/accessibility/AccessibilityManager.java
+++ b/bridge/src/android/view/accessibility/AccessibilityManager.java
@@ -156,9 +156,6 @@
 
                 public void setRelevantEventTypes(int eventTypes) {
                 }
-
-                public void setFocusAppearance(int strokeWidth, int color) {
-                }
             };
 
     /**
diff --git a/bridge/src/android/view/shadow/AmbientShadowTriangulator.java b/bridge/src/android/view/shadow/AmbientShadowTriangulator.java
index d768fa3..630ec30 100644
--- a/bridge/src/android/view/shadow/AmbientShadowTriangulator.java
+++ b/bridge/src/android/view/shadow/AmbientShadowTriangulator.java
@@ -16,7 +16,7 @@
 
 package android.view.shadow;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 
 /**
@@ -43,11 +43,11 @@
             mCalculator.generateVertex();
             mValid = true;
         } catch (IndexOutOfBoundsException|ArithmeticException mathError) {
-            Bridge.getLog().warning(ILayoutLog.TAG_INFO,  "Arithmetic error while drawing " +
+            Bridge.getLog().warning(LayoutLog.TAG_INFO,  "Arithmetic error while drawing " +
                             "ambient shadow",
                     null, mathError);
         } catch (Exception ex) {
-            Bridge.getLog().warning(ILayoutLog.TAG_INFO,  "Error while drawing shadow",
+            Bridge.getLog().warning(LayoutLog.TAG_INFO,  "Error while drawing shadow",
                     null, ex);
         }
     }
diff --git a/bridge/src/android/view/shadow/SpotShadowTriangulator.java b/bridge/src/android/view/shadow/SpotShadowTriangulator.java
index d666153..854a4d5 100644
--- a/bridge/src/android/view/shadow/SpotShadowTriangulator.java
+++ b/bridge/src/android/view/shadow/SpotShadowTriangulator.java
@@ -16,8 +16,12 @@
 
 package android.view.shadow;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
+import com.android.tools.layoutlib.annotations.VisibleForTesting;
+
+import android.graphics.Bitmap;
+import android.view.math.Math3DHelper;
 
 /**
  * Generate spot shadow bitmap.
@@ -54,11 +58,11 @@
                     mShadowConfig.getShadowStrength(),
                     mStrips);
         } catch (IndexOutOfBoundsException|ArithmeticException mathError) {
-            Bridge.getLog().warning(ILayoutLog.TAG_INFO,  "Arithmetic error while drawing " +
+            Bridge.getLog().warning(LayoutLog.TAG_INFO,  "Arithmetic error while drawing " +
                             "spot shadow",
                     null, mathError);
         } catch (Exception ex) {
-            Bridge.getLog().warning(ILayoutLog.TAG_INFO,  "Error while drawing shadow",
+            Bridge.getLog().warning(LayoutLog.TAG_INFO,  "Error while drawing shadow",
                     null, ex);
         }
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/Bridge.java b/bridge/src/com/android/layoutlib/bridge/Bridge.java
index aa76e75..88298d6 100644
--- a/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -17,7 +17,7 @@
 package com.android.layoutlib.bridge;
 
 import com.android.ide.common.rendering.api.DrawableParams;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderSession;
 import com.android.ide.common.rendering.api.ResourceNamespace;
 import com.android.ide.common.rendering.api.ResourceReference;
@@ -33,7 +33,7 @@
 import com.android.tools.layoutlib.annotations.Nullable;
 import com.android.tools.layoutlib.create.MethodAdapter;
 import com.android.tools.layoutlib.create.OverrideMethod;
-import com.android.utils.Pair;
+import com.android.util.Pair;
 
 import android.animation.PropertyValuesHolder;
 import android.animation.PropertyValuesHolder_Delegate;
@@ -56,6 +56,7 @@
 import java.lang.reflect.Modifier;
 import java.util.Arrays;
 import java.util.EnumMap;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.WeakHashMap;
@@ -93,6 +94,7 @@
     /**
      * Maps from id to resource type/name. This is for com.android.internal.R
      */
+    @SuppressWarnings("deprecation")
     private final static Map<Integer, Pair<ResourceType, String>> sRMap = new HashMap<>();
 
     /**
@@ -122,7 +124,7 @@
     /**
      * A default log than prints to stdout/stderr.
      */
-    private final static ILayoutLog sDefaultLog = new ILayoutLog() {
+    private final static LayoutLog sDefaultLog = new LayoutLog() {
         @Override
         public void error(String tag, String message, Object viewCookie, Object data) {
             System.err.println(message);
@@ -143,7 +145,7 @@
     /**
      * Current log.
      */
-    private static ILayoutLog sCurrentLog = sDefaultLog;
+    private static LayoutLog sCurrentLog = sDefaultLog;
 
     public static boolean sIsTypefaceInitialized;
 
@@ -153,7 +155,7 @@
             String nativeLibPath,
             String icuDataPath,
             Map<String, Map<String, Integer>> enumValueMap,
-            ILayoutLog log) {
+            LayoutLog log) {
         sPlatformProperties = platformProperties;
         sEnumValueMap = enumValueMap;
 
@@ -206,7 +208,7 @@
                     continue;
                 }
                 String resTypeName = inner.getSimpleName();
-                ResourceType resType = ResourceType.fromClassName(resTypeName);
+                ResourceType resType = ResourceType.getEnum(resTypeName);
                 if (resType != null) {
                     Map<String, Integer> fullMap = null;
                     switch (resType) {
@@ -234,6 +236,7 @@
                         Class<?> type = f.getType();
                         if (!type.isArray()) {
                             Integer value = (Integer) f.get(null);
+                            //noinspection deprecation
                             sRMap.put(value, Pair.of(resType, f.getName()));
                             fullMap.put(f.getName(), value);
                         }
@@ -242,7 +245,7 @@
             }
         } catch (Exception throwable) {
             if (log != null) {
-                log.error(ILayoutLog.TAG_BROKEN,
+                log.error(LayoutLog.TAG_BROKEN,
                         "Failed to load com.android.internal.R from the layout library jar",
                         throwable, null, null);
             }
@@ -324,9 +327,11 @@
             if (arrayValue != null) {
                 String attrName = name.substring(arrayName.length() + 1);
                 int attrValue = arrayValue[index];
+                //noinspection deprecation
                 sRMap.put(attrValue, Pair.of(ResourceType.ATTR, attrName));
                 revRAttrMap.put(attrName, attrValue);
             }
+            //noinspection deprecation
             sRMap.put(index, Pair.of(ResourceType.STYLEABLE, name));
             revRStyleableMap.put(name, index);
         }
@@ -507,11 +512,11 @@
         Looper_Accessor.cleanupThread();
     }
 
-    public static ILayoutLog getLog() {
+    public static LayoutLog getLog() {
         return sCurrentLog;
     }
 
-    public static void setLog(ILayoutLog log) {
+    public static void setLog(LayoutLog log) {
         // check only the thread currently owning the lock can do this.
         if (!sLock.isHeldByCurrentThread()) {
             throw new IllegalStateException("scene must be acquired first. see #acquire(long)");
diff --git a/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java b/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
index 5584708..442a77b 100644
--- a/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
+++ b/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
@@ -74,6 +74,11 @@
     }
 
     @Override
+    public Map<Object, String> getDefaultStyles() {
+        return mSession != null ? mSession.getDefaultStyles() : Collections.emptyMap();
+    }
+
+    @Override
     public Map<Object, ResourceReference> getDefaultNamespacedStyles() {
         return mSession != null ? mSession.getDefaultNamespacedStyles() : Collections.emptyMap();
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/MockView.java b/bridge/src/com/android/layoutlib/bridge/MockView.java
index a1d1bbc..9856cf6 100644
--- a/bridge/src/com/android/layoutlib/bridge/MockView.java
+++ b/bridge/src/com/android/layoutlib/bridge/MockView.java
@@ -111,6 +111,7 @@
         mView.setText(text);
     }
 
+    @SuppressWarnings("WeakerAccess") // This method is used from Studio
     public void setGravity(int gravity) {
         mView.setGravity(gravity);
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java b/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java
index 8934b12..ce613e0 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java
@@ -16,7 +16,6 @@
 
 package com.android.layoutlib.bridge.android;
 
-import android.content.AttributionSource;
 import android.content.ContentProviderOperation;
 import android.content.ContentProviderResult;
 import android.content.ContentResolver;
@@ -45,7 +44,7 @@
  */
 public final class BridgeContentProvider implements IContentProvider {
     @Override
-    public ContentProviderResult[] applyBatch(AttributionSource attributionSource,
+    public ContentProviderResult[] applyBatch(String callingPackage, String callingFeatureId,
             String authority, ArrayList<ContentProviderOperation> arg0)
             throws RemoteException, OperationApplicationException {
         // TODO Auto-generated method stub
@@ -53,21 +52,21 @@
     }
 
     @Override
-    public int bulkInsert(AttributionSource attributionSource, Uri arg0,
+    public int bulkInsert(String callingPackage, String callingFeatureId, Uri arg0,
             ContentValues[] arg1) throws RemoteException {
         // TODO Auto-generated method stub
         return 0;
     }
 
     @Override
-    public Bundle call(AttributionSource attributionSource, String authority,
+    public Bundle call(String callingPackage, String callingFeatureId, String authority,
             String arg0, String arg1, Bundle arg2) throws RemoteException {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public int delete(AttributionSource attributionSource, Uri arg0, Bundle arg1)
+    public int delete(String callingPackage, String callingFeatureId, Uri arg0, Bundle arg1)
             throws RemoteException {
         // TODO Auto-generated method stub
         return 0;
@@ -94,14 +93,14 @@
     }
 
     @Override
-    public Uri insert(AttributionSource attributionSource, Uri arg0, ContentValues arg1,
+    public Uri insert(String callingPackage, String callingFeatureId, Uri arg0, ContentValues arg1,
             Bundle arg2) throws RemoteException {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public AssetFileDescriptor openAssetFile(AttributionSource attributionSource,
+    public AssetFileDescriptor openAssetFile(String callingPackage, String callingFeatureId,
             Uri arg0, String arg1, ICancellationSignal signal)
             throws RemoteException, FileNotFoundException {
         // TODO Auto-generated method stub
@@ -109,22 +108,22 @@
     }
 
     @Override
-    public ParcelFileDescriptor openFile(AttributionSource attributionSource, Uri arg0,
-            String arg1, ICancellationSignal signal)
+    public ParcelFileDescriptor openFile(String callingPackage, String callingFeatureId, Uri arg0,
+            String arg1, ICancellationSignal signal, IBinder token)
             throws RemoteException, FileNotFoundException {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public Cursor query(AttributionSource attributionSource, Uri arg0, String[] arg1,
+    public Cursor query(String callingPackage, String callingFeatureId, Uri arg0, String[] arg1,
             Bundle arg3, ICancellationSignal arg4) throws RemoteException {
         // TODO Auto-generated method stub
         return null;
     }
 
     @Override
-    public int update(AttributionSource attributionSource, Uri arg0, ContentValues arg1,
+    public int update(String callingPackage, String callingFeatureId, Uri arg0, ContentValues arg1,
             Bundle arg2) throws RemoteException {
         // TODO Auto-generated method stub
         return 0;
@@ -143,7 +142,7 @@
     }
 
     @Override
-    public AssetFileDescriptor openTypedAssetFile(AttributionSource attributionSource,
+    public AssetFileDescriptor openTypedAssetFile(String callingPackage, String callingFeatureId,
             Uri arg0, String arg1, Bundle arg2, ICancellationSignal signal)
             throws RemoteException, FileNotFoundException {
         // TODO Auto-generated method stub
@@ -158,20 +157,20 @@
 
 
     @Override
-    public Uri canonicalize(AttributionSource attributionSource, Uri uri)
+    public Uri canonicalize(String callingPkg, String callingFeatureId, Uri uri)
             throws RemoteException {
         return null;
     }
 
     @SuppressWarnings("deprecation")
     @Override
-    public void canonicalizeAsync(AttributionSource attributionSource, Uri uri,
+    public void canonicalizeAsync(String callingPkg, String callingFeatureId, Uri uri,
             RemoteCallback remoteCallback) {
         AsyncTask.SERIAL_EXECUTOR.execute(() -> {
             try {
                 final Bundle bundle = new Bundle();
                 bundle.putParcelable(ContentResolver.REMOTE_CALLBACK_RESULT,
-                        canonicalize(attributionSource, uri));
+                        canonicalize(callingPkg, callingFeatureId, uri));
                 remoteCallback.sendResult(bundle);
             } catch (RemoteException e) {
               // Ignore
@@ -180,35 +179,19 @@
     }
 
     @Override
-    public Uri uncanonicalize(AttributionSource attributionSource, Uri uri)
+    public Uri uncanonicalize(String callingPkg, String callingFeatureId, Uri uri)
             throws RemoteException {
         return null;
     }
 
-    @SuppressWarnings("deprecation")
     @Override
-    public void uncanonicalizeAsync(AttributionSource attributionSource, Uri uri,
-            RemoteCallback remoteCallback) {
-        AsyncTask.SERIAL_EXECUTOR.execute(() -> {
-            try {
-                final Bundle bundle = new Bundle();
-                bundle.putParcelable(ContentResolver.REMOTE_CALLBACK_RESULT,
-                        uncanonicalize(attributionSource, uri));
-                remoteCallback.sendResult(bundle);
-            } catch (RemoteException e) {
-              // Ignore
-            }
-        });
-    }
-
-    @Override
-    public boolean refresh(AttributionSource attributionSource, Uri url, Bundle args,
+    public boolean refresh(String callingPkg, String callingFeatureId, Uri url, Bundle args,
             ICancellationSignal cancellationSignal) throws RemoteException {
         return false;
     }
 
     @Override
-    public int checkUriPermission(AttributionSource attributionSource, Uri uri, int uid,
+    public int checkUriPermission(String callingPkg, String callingFeatureId, Uri uri, int uid,
             int modeFlags) throws RemoteException {
         return PackageManager.PERMISSION_DENIED;
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 73a73d0..e1e6150 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -18,8 +18,8 @@
 
 import com.android.SdkConstants;
 import com.android.ide.common.rendering.api.AssetRepository;
-import com.android.ide.common.rendering.api.ILayoutLog;
 import com.android.ide.common.rendering.api.ILayoutPullParser;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceNamespace;
@@ -30,23 +30,21 @@
 import com.android.ide.common.rendering.api.StyleResourceValue;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.BridgeConstants;
+import com.android.layoutlib.bridge.android.view.WindowManagerImpl;
 import com.android.layoutlib.bridge.impl.ParserFactory;
 import com.android.layoutlib.bridge.impl.ResourceHelper;
 import com.android.layoutlib.bridge.impl.Stack;
 import com.android.resources.ResourceType;
-import com.android.utils.Pair;
+import com.android.util.Pair;
 
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
-import android.app.ActivityManager;
-import android.app.ActivityManager_Accessor;
 import android.app.SystemServiceRegistry;
 import android.content.BroadcastReceiver;
 import android.content.ClipboardManager;
-import android.content.ComponentCallbacks;
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -71,7 +69,6 @@
 import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
 import android.hardware.display.DisplayManager;
-import android.net.ConnectivityManager;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -93,7 +90,6 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.WindowManager;
-import android.view.WindowManagerImpl;
 import android.view.accessibility.AccessibilityManager;
 import android.view.autofill.AutofillManager;
 import android.view.autofill.IAutoFillManager.Default;
@@ -120,6 +116,7 @@
 /**
  * Custom implementation of Context/Activity to handle non compiled resources.
  */
+@SuppressWarnings("deprecation")  // For use of Pair.
 public class BridgeContext extends Context {
     private static final String PREFIX_THEME_APPCOMPAT = "Theme.AppCompat";
 
@@ -169,8 +166,6 @@
     private final DisplayManager mDisplayManager;
     private final AutofillManager mAutofillManager;
     private final ClipboardManager mClipboardManager;
-    private final ActivityManager mActivityManager;
-    private final ConnectivityManager mConnectivityManager;
     private final HashMap<View, Integer> mScrollYPos = new HashMap<>();
     private final HashMap<View, Integer> mScrollXPos = new HashMap<>();
 
@@ -258,8 +253,6 @@
         mDisplayManager = new DisplayManager(this);
         mAutofillManager = new AutofillManager(this, new Default());
         mClipboardManager = new ClipboardManager(this, null);
-        mActivityManager = ActivityManager_Accessor.getActivityManagerInstance(this);
-        mConnectivityManager = new ConnectivityManager(this, null);
 
         if (mLayoutlibCallback.isResourceNamespacingRequired()) {
             if (mLayoutlibCallback.hasAndroidXAppCompat()) {
@@ -529,18 +522,18 @@
                         popParser();
                     }
                 } else {
-                    Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                    Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                             String.format("File %s is missing!", path), null, null);
                 }
             } catch (XmlPullParserException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                         "Failed to parse file " + path, e, null, null /*data*/);
                 // we'll return null below.
             } finally {
                 mBridgeInflater.setResourceReference(null);
             }
         } else {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     String.format("Layout %s%s does not exist.", isPlatformLayout ? "android:" : "",
                             layout.getName()), null, null);
         }
@@ -655,12 +648,6 @@
             case CLIPBOARD_SERVICE:
                 return mClipboardManager;
 
-            case ACTIVITY_SERVICE:
-                return mActivityManager;
-
-            case CONNECTIVITY_SERVICE:
-                return mConnectivityManager;
-
             case AUDIO_SERVICE:
             case TEXT_CLASSIFICATION_SERVICE:
             case CONTENT_CAPTURE_MANAGER_SERVICE:
@@ -698,7 +685,7 @@
             }
 
             if (style == null) {
-                Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_RESOLVE,
+                Bridge.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE,
                         "Failed to find style with " + resId, null, null);
                 return null;
             }
@@ -767,7 +754,7 @@
             resolver = Resolver.EMPTY_RESOLVER;
         } else if (set != null) {
             // really this should not be happening since its instantiated in Bridge
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     "Parser is not a BridgeXmlBlockParser!", null, null);
             return null;
         } else {
@@ -806,7 +793,7 @@
                 // This should be rare. Happens trying to map R.style.foo to @style/foo fails.
                 // This will happen if the user explicitly used a non existing int value for
                 // defStyleAttr or there's something wrong with the project structure/build.
-                Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_RESOLVE,
+                Bridge.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE,
                         "Failed to find the style corresponding to the id " + defStyleAttr, null,
                         null);
             } else {
@@ -965,7 +952,7 @@
                                 if (reference != null) {
                                     val = reference.getResourceUrl().toString();
                                 }
-                                Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_RESOLVE_THEME_ATTR,
+                                Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE_THEME_ATTR,
                                         String.format("Failed to find '%s' in current theme.", val),
                                         null, val);
                             }
@@ -1018,12 +1005,6 @@
         return mPackageManager;
     }
 
-    @Override
-    public void registerComponentCallbacks(ComponentCallbacks callback) {}
-
-    @Override
-    public void unregisterComponentCallbacks(ComponentCallbacks callback) {}
-
     // ------------- private new methods
 
     /**
@@ -1205,7 +1186,7 @@
 
     public IBinder getBinder() {
         if (mBinder == null) {
-            // create a no-op binder. We only need it be not null.
+            // create a dummy binder. We only need it be not null.
             mBinder = new IBinder() {
                 @Override
                 public String getInterfaceDescriptor() throws RemoteException {
@@ -1984,7 +1965,7 @@
 
     @Override
     public File getObbDir() {
-        Bridge.getLog().error(ILayoutLog.TAG_UNSUPPORTED, "OBB not supported", null, null);
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "OBB not supported", null, null);
         return null;
     }
 
diff --git a/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
index 41e4e2d..584e8c2 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
@@ -17,7 +17,6 @@
 package com.android.layoutlib.bridge.android;
 
 import android.os.BatterySaverPolicyConfig;
-import android.os.ParcelDuration;
 import android.os.IBinder;
 import android.os.IPowerManager;
 import android.os.PowerManager;
@@ -47,16 +46,6 @@
     }
 
     @Override
-    public BatterySaverPolicyConfig getFullPowerSavePolicy() {
-        return new BatterySaverPolicyConfig.Builder().build();
-    }
-
-    @Override
-    public boolean setFullPowerSavePolicy(BatterySaverPolicyConfig config) {
-        return false;
-    }
-
-    @Override
     public boolean setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold)
             throws RemoteException {
         return false;
@@ -83,44 +72,25 @@
     }
 
     @Override
-    public void setBatteryDischargePrediction(ParcelDuration timeRemaining,
-            boolean isPersonalized) {
-        // pass for now
-    }
-
-    @Override
-    public ParcelDuration getBatteryDischargePrediction() {
-        return null;
-    }
-
-    @Override
-    public boolean isBatteryDischargePredictionPersonalized() {
-        return false;
-    }
-
-    @Override
     public IBinder asBinder() {
         // pass for now.
         return null;
     }
 
     @Override
-    public void acquireWakeLock(IBinder arg0, int arg1, String arg2, String arg2_5, WorkSource arg3,
-            String arg4, int arg5)
+    public void acquireWakeLock(IBinder arg0, int arg1, String arg2, String arg2_5, WorkSource arg3, String arg4)
             throws RemoteException {
         // pass for now.
     }
 
     @Override
-    public void acquireWakeLockAsync(IBinder arg0, int arg1, String arg2, String arg2_5,
-            WorkSource arg3, String arg4) throws RemoteException {
+    public void acquireWakeLockWithUid(IBinder arg0, int arg1, String arg2, String arg2_5, int arg3)
+            throws RemoteException {
         // pass for now.
     }
 
     @Override
-    public void acquireWakeLockWithUid(IBinder arg0, int arg1, String arg2, String arg2_5,
-            int arg3, int arg4)
-            throws RemoteException {
+    public void powerHint(int hintId, int data) {
         // pass for now.
     }
 
@@ -180,21 +150,11 @@
     }
 
     @Override
-    public void releaseWakeLockAsync(IBinder arg0, int arg1) throws RemoteException {
-        // pass for now.
-    }
-
-    @Override
     public void updateWakeLockUids(IBinder arg0, int[] arg1) throws RemoteException {
         // pass for now.
     }
 
     @Override
-    public void updateWakeLockUidsAsync(IBinder arg0, int[] arg1) throws RemoteException {
-        // pass for now.
-    }
-
-    @Override
     public void setAttentionLight(boolean arg0, int arg1) throws RemoteException {
         // pass for now.
     }
@@ -216,8 +176,7 @@
     }
 
     @Override
-    public void userActivity(int displayId, long time, int event, int flags)
-            throws RemoteException {
+    public void userActivity(long time, int event, int flags) throws RemoteException {
         // pass for now.
     }
 
@@ -278,11 +237,6 @@
     }
 
     @Override
-    public boolean isAmbientDisplaySuppressedForTokenByApp(String token, int appUid) {
-        return false;
-    }
-
-    @Override
     public boolean isAmbientDisplaySuppressed() {
         return false;
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/android/support/DesignLibUtil.java b/bridge/src/com/android/layoutlib/bridge/android/support/DesignLibUtil.java
index 92693c6..5f785f5 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/support/DesignLibUtil.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/support/DesignLibUtil.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.android.support;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.util.ReflectionUtils.ReflectionException;
 
@@ -61,7 +61,7 @@
         try {
             invoke(getMethod(view.getClass(), "setTitle", CharSequence.class), view, title);
         } catch (ReflectionException e) {
-            Bridge.getLog().warning(ILayoutLog.TAG_INFO,
+            Bridge.getLog().warning(LayoutLog.TAG_INFO,
                     "Error occurred while trying to set title.", null, e);
         }
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/android/support/DrawerLayoutUtil.java b/bridge/src/com/android/layoutlib/bridge/android/support/DrawerLayoutUtil.java
index 08e7419..c41bcae 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/support/DrawerLayoutUtil.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/support/DrawerLayoutUtil.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.android.support;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.util.ReflectionUtils.ReflectionException;
 
@@ -59,7 +59,7 @@
             invoke(getMethod(drawerLayout.getClass(), "openDrawer", int.class), drawerLayout,
                     gravity);
         } catch (ReflectionException e) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "Unable to open navigation drawer",
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to open navigation drawer",
                     getCause(e), null, null);
         }
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/android/support/FragmentTabHostUtil.java b/bridge/src/com/android/layoutlib/bridge/android/support/FragmentTabHostUtil.java
index a426b27..c77cb57 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/support/FragmentTabHostUtil.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/support/FragmentTabHostUtil.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.android.support;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.util.ReflectionUtils.ReflectionException;
 
@@ -59,7 +59,7 @@
         }
 
         if (fragmentManager == null) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     "Unable to find FragmentManager.", null, null);
             return;
         }
@@ -70,7 +70,7 @@
                     android.R.id.tabcontent);
         } catch (ReflectionException e) {
             Throwable cause = getCause(e);
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     "Error occurred while trying to setup FragmentTabHost.", cause, null, null);
         }
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java b/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java
index ff20fbf..6fc8009 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.android.support;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.android.BridgeContext;
@@ -72,7 +72,7 @@
             }
         } catch (ReflectionException e) {
             Throwable cause = getCause(e);
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     "Error occurred while trying to setup RecyclerView.", cause, null, null);
         }
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/android/support/SupportPreferencesUtil.java b/bridge/src/com/android/layoutlib/bridge/android/support/SupportPreferencesUtil.java
index f195a5e..171edb9 100644
--- a/bridge/src/com/android/layoutlib/bridge/android/support/SupportPreferencesUtil.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/support/SupportPreferencesUtil.java
@@ -298,8 +298,8 @@
                     preferenceGroupAdapter);
 
             ScrollView scrollView = new ScrollView(context);
-            scrollView.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,
-                    LayoutParams.MATCH_PARENT));
+            scrollView.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT,
+                    LayoutParams.WRAP_CONTENT));
             scrollView.addView(listView);
 
             if (root != null) {
diff --git a/bridge/src/android/view/WindowManagerImpl.java b/bridge/src/com/android/layoutlib/bridge/android/view/WindowManagerImpl.java
similarity index 62%
rename from bridge/src/android/view/WindowManagerImpl.java
rename to bridge/src/com/android/layoutlib/bridge/android/view/WindowManagerImpl.java
index 36b7165..3cd95be 100644
--- a/bridge/src/android/view/WindowManagerImpl.java
+++ b/bridge/src/com/android/layoutlib/bridge/android/view/WindowManagerImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 The Android Open Source Project
+ * Copyright (C) 2012 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.
@@ -11,27 +11,30 @@
  * 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
+ * limitations under the License.
  */
-package android.view;
-
-import static android.view.View.SYSTEM_UI_FLAG_VISIBLE;
-import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
-import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
+package com.android.layoutlib.bridge.android.view;
 
 import android.app.ResourcesManager;
 import android.content.Context;
-import android.content.res.Configuration;
+import android.graphics.Insets;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.Region;
-import android.os.IBinder;
 import android.os.RemoteException;
 import android.util.DisplayMetrics;
+import android.util.Size;
+import android.view.Display;
 import android.view.Display.Mode;
-
-import com.android.ide.common.rendering.api.ILayoutLog;
-import com.android.layoutlib.bridge.Bridge;
+import android.view.DisplayAdjustments;
+import android.view.DisplayCutout;
+import android.view.DisplayInfo;
+import android.view.InsetsState;
+import android.view.View;
+import android.view.WindowInsets;
+import android.view.WindowManager;
+import android.view.WindowManagerGlobal;
+import android.view.WindowMetrics;
 
 public class WindowManagerImpl implements WindowManager {
 
@@ -54,30 +57,6 @@
                 DisplayAdjustments.DEFAULT_DISPLAY_ADJUSTMENTS);
     }
 
-    public WindowManagerImpl createLocalWindowManager(Window parentWindow) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
-                "The preview does not support multiple windows.",
-                null, null, null);
-        return this;
-    }
-
-    public WindowManagerImpl createPresentationWindowManager(Context displayContext) {
-        Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
-                "The preview does not support multiple windows.",
-                null, null, null);
-        return this;
-    }
-
-    /**
-     * Sets the window token to assign when none is specified by the client or
-     * available from the parent window.
-     *
-     * @param token The default token to assign.
-     */
-    public void setDefaultToken(IBinder token) {
-
-    }
-
     @Override
     public Display getDefaultDisplay() {
         return mDisplay;
@@ -126,7 +105,7 @@
     }
 
     @Override
-    public void setDisplayImePolicy(int displayId, int imePolicy) {
+    public void setShouldShowIme(int displayId, boolean shouldShow) {
         // pass
     }
 
@@ -156,17 +135,18 @@
 
     private WindowInsets computeWindowInsets() {
         try {
+            final Rect systemWindowInsets = new Rect();
+            final Rect stableInsets = new Rect();
+            final DisplayCutout.ParcelableWrapper displayCutout =
+                    new DisplayCutout.ParcelableWrapper();
             final InsetsState insetsState = new InsetsState();
-            final boolean alwaysConsumeSystemBars =
-                    WindowManagerGlobal.getWindowManagerService().getWindowInsets(
-                            new WindowManager.LayoutParams(), mContext.getDisplayId(), insetsState);
-            final Configuration config = mContext.getResources().getConfiguration();
-            final boolean isScreenRound = config.isScreenRound();
-            final int windowingMode = config.windowConfiguration.getWindowingMode();
-            return insetsState.calculateInsets(getCurrentBounds(mContext),
-                    null /* ignoringVisibilityState*/, isScreenRound, alwaysConsumeSystemBars,
-                    SOFT_INPUT_ADJUST_NOTHING, 0, SYSTEM_UI_FLAG_VISIBLE, TYPE_APPLICATION,
-                    windowingMode, null /* typeSideMap */);
+            WindowManagerGlobal.getWindowManagerService().getWindowInsets(
+                    new WindowManager.LayoutParams(), mContext.getDisplayId(), systemWindowInsets,
+                    stableInsets, displayCutout, insetsState);
+            return new WindowInsets.Builder()
+                    .setSystemWindowInsets(Insets.of(systemWindowInsets))
+                    .setStableInsets(Insets.of(stableInsets))
+                    .setDisplayCutout(displayCutout.get()).build();
         } catch (RemoteException ignore) {
         }
         return null;
diff --git a/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java b/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java
index 8ca809e..ab88f15 100644
--- a/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java
+++ b/bridge/src/com/android/layoutlib/bridge/bars/AppCompatActionBar.java
@@ -15,7 +15,7 @@
  */
 package com.android.layoutlib.bridge.bars;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceReference;
@@ -118,7 +118,7 @@
             setupActionBar();
             getContentRoot().setId(id.content);
         } catch (Exception e) {
-            Bridge.getLog().warning(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().warning(LayoutLog.TAG_BROKEN,
                     "Failed to load AppCompat ActionBar with unknown error.", null, e);
         }
     }
@@ -201,7 +201,7 @@
         if (menuIds.size() > 1) {
             // Supporting multiple menus means that we would need to instantiate our own supportlib
             // MenuInflater instances using reflection
-            Bridge.getLog().fidelityWarning(ILayoutLog.TAG_UNSUPPORTED,
+            Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
                     "Support Toolbar does not currently support multiple menus in the preview.",
                     null, null, null);
         }
diff --git a/bridge/src/com/android/layoutlib/bridge/bars/BridgeActionBar.java b/bridge/src/com/android/layoutlib/bridge/bars/BridgeActionBar.java
index 1f7b187..8790cb5 100644
--- a/bridge/src/com/android/layoutlib/bridge/bars/BridgeActionBar.java
+++ b/bridge/src/com/android/layoutlib/bridge/bars/BridgeActionBar.java
@@ -45,7 +45,7 @@
     private final View mDecorContent;
     private final ActionBarCallback mCallback;
 
-    @SuppressWarnings("NotNullFieldNotInitialized") // Should be initialized by subclasses.
+    @SuppressWarnings("NullableProblems")  // Should be initialized by subclasses.
     @NonNull private FrameLayout mContentRoot;
 
     public BridgeActionBar(@NonNull BridgeContext context, @NonNull SessionParams params) {
diff --git a/bridge/src/com/android/layoutlib/bridge/bars/Config.java b/bridge/src/com/android/layoutlib/bridge/bars/Config.java
index a49a664..7813844 100644
--- a/bridge/src/com/android/layoutlib/bridge/bars/Config.java
+++ b/bridge/src/com/android/layoutlib/bridge/bars/Config.java
@@ -92,8 +92,8 @@
     }
 
     public static String getTime(int platformVersion) {
-        if (isGreaterOrEqual(platformVersion, R)) {
-            return "11:00";
+        if (isGreaterOrEqual(platformVersion, Q)) {
+            return "10:00";
         }
         if (platformVersion < GINGERBREAD) {
             return "2:20";
@@ -134,9 +134,6 @@
         if (platformVersion < Q) {
             return "9:00";
         }
-        if (platformVersion < R) {
-            return "10:00";
-        }
         // Should never happen.
         return "4:04";
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java b/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
index 0bb72ed..3a5f633 100644
--- a/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
+++ b/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.bars;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceValue;
 import com.android.ide.common.rendering.api.StyleResourceValue;
@@ -256,7 +256,7 @@
                     return ResourceHelper.getColor(resource.getValue());
                 } catch (NumberFormatException e) {
                     // Conversion failed.
-                    Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_FORMAT,
+                    Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
                             "Theme attribute @android:" + attr +
                                     " does not reference a color, instead is '" +
                                     resource.getValue() + "'.", null, resource);
diff --git a/bridge/src/com/android/layoutlib/bridge/bars/FrameworkActionBar.java b/bridge/src/com/android/layoutlib/bridge/bars/FrameworkActionBar.java
index e08f523..230094e 100644
--- a/bridge/src/com/android/layoutlib/bridge/bars/FrameworkActionBar.java
+++ b/bridge/src/com/android/layoutlib/bridge/bars/FrameworkActionBar.java
@@ -191,7 +191,7 @@
 
     // Copied from com.android.internal.view.menu.MenuPopHelper.measureContentWidth()
     private int measureContentWidth(@NonNull ListAdapter adapter) {
-        // Menus don't tend to be long, so this is shouldn't be a problem
+        // Menus don't tend to be long, so this is more sane than it looks.
         int maxWidth = 0;
         View itemView = null;
         int itemType = 0;
diff --git a/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java b/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
index dc823f7..f58443a 100644
--- a/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
+++ b/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.bars;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.ResourceNamespace;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.android.BridgeContext;
@@ -90,7 +90,7 @@
         }
 
         if (icons.size() != 2 || clockView == null) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "Unable to initialize statusbar", null,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to initialize statusbar", null,
                     null, null);
             return;
         }
@@ -126,10 +126,10 @@
                 imageView.setImageDrawable(
                         Drawable.createFromXml(mContext.getResources(), parser));
             } catch (XmlPullParserException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "Unable to draw wifi icon", e,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to draw wifi icon", e,
                         null, null);
             } catch (IOException e) {
-                Bridge.getLog().error(ILayoutLog.TAG_BROKEN, "Unable to draw wifi icon", e,
+                Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to draw wifi icon", e,
                         null, null);
             }
         }
diff --git a/bridge/src/com/android/layoutlib/bridge/bars/ThemePreviewNavigationBar.java b/bridge/src/com/android/layoutlib/bridge/bars/ThemePreviewNavigationBar.java
new file mode 100644
index 0000000..523f140
--- /dev/null
+++ b/bridge/src/com/android/layoutlib/bridge/bars/ThemePreviewNavigationBar.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2015 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.bars;
+
+import com.android.layoutlib.bridge.android.BridgeContext;
+import com.android.resources.Density;
+
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.LinearLayout;
+
+/**
+ * Navigation Bar for the Theme Editor preview.
+ *
+ * For small bars, it is identical to {@link NavigationBar}.
+ * But wide bars from {@link NavigationBar} are too wide for the Theme Editor preview.
+ * To solve that problem, {@link ThemePreviewNavigationBar} use the layout for small bars,
+ * and have no padding on the sides. That way, they have a similar look as the true ones,
+ * and they fit in the Theme Editor preview.
+ */
+public class ThemePreviewNavigationBar extends NavigationBar {
+    private static final int PADDING_WIDTH_SW600 = 0;
+
+    @SuppressWarnings("unused")
+    public ThemePreviewNavigationBar(Context context, AttributeSet attrs) {
+        super((BridgeContext) context,
+                Density.getEnum(((BridgeContext) context).getMetrics().densityDpi),
+                LinearLayout.HORIZONTAL, // In this mode, it doesn't need to be render vertically
+                ((BridgeContext) context).getConfiguration().getLayoutDirection() ==
+                        View.LAYOUT_DIRECTION_RTL,
+                (context.getApplicationInfo().flags & ApplicationInfo.FLAG_SUPPORTS_RTL) != 0,
+                0, LAYOUT_XML, false);
+    }
+
+    @Override
+    protected int getSidePadding(float sw) {
+        if (sw >= 600) {
+            return PADDING_WIDTH_SW600;
+        }
+        return super.getSidePadding(sw);
+    }
+}
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java b/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
index 5991eb0..b71a0e2 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
@@ -111,6 +111,7 @@
     @GuardedBy("sNativeAllocations")
     private static long sNativeAllocationsCount = 0;
 
+    @SuppressWarnings("FieldCanBeLocal")
     private final Class<T> mClass;
 
     public DelegateManager(Class<T> theClass) {
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java b/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java
index f3ebd40..959ba77 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java
@@ -16,7 +16,12 @@
 
 package com.android.layoutlib.bridge.impl;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
+import static java.awt.image.BufferedImage.TYPE_INT_RGB;
+import static java.lang.Math.min;
+import static java.lang.Math.max;
+
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 
 import android.graphics.Bitmap_Delegate;
@@ -46,11 +51,6 @@
 import java.awt.image.BufferedImage;
 import java.util.ArrayList;
 
-import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
-import static java.awt.image.BufferedImage.TYPE_INT_RGB;
-import static java.lang.Math.max;
-import static java.lang.Math.min;
-
 /**
  * Class representing a graphics context snapshot, as well as a context stack as a linked list.
  * <p>
@@ -846,7 +846,7 @@
                 g.setPaint(shaderPaint);
                 return;
             } else {
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_SHADER,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_SHADER,
                         shaderDelegate.getSupportMessage(), null, null, null);
             }
         }
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/Layout.java b/bridge/src/com/android/layoutlib/bridge/impl/Layout.java
index c2fb3e1..45accb9 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/Layout.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/Layout.java
@@ -543,6 +543,7 @@
             }
         }
 
+        @SuppressWarnings("SameParameterValue")
         private int getDimension(@NonNull ResourceReference attrRef, int defaultValue) {
             ResourceValue value = mResources.findItemInTheme(attrRef);
             value = mResources.resolveResValue(value);
@@ -556,6 +557,7 @@
             return defaultValue;
         }
 
+        @SuppressWarnings("SameParameterValue")
         private int getFrameworkAttrDimension(@NonNull String attr, int defaultValue) {
             return getDimension(BridgeContext.createFrameworkAttrReference(attr), defaultValue);
         }
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java b/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java
index 86f80fe..dcbd272 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/PorterDuffUtility.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.impl;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layoutlib.bridge.Bridge;
 
 import android.graphics.BlendComposite;
@@ -47,7 +47,7 @@
         if (porterDuffMode >= 0 && porterDuffMode < MODES_COUNT) {
             return PorterDuff.intToMode(porterDuffMode);
         }
-        Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+        Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                 String.format("Unknown PorterDuff.Mode: %1$d", porterDuffMode), null, null);
         assert false;
         return Mode.SRC_OVER;
@@ -97,7 +97,7 @@
             case OVERLAY:
                 return BlendComposite.getInstance(BlendingMode.OVERLAY, alpha1);
             default:
-                Bridge.getLog().fidelityWarning(ILayoutLog.TAG_BROKEN,
+                Bridge.getLog().fidelityWarning(LayoutLog.TAG_BROKEN,
                         String.format("Unsupported PorterDuff Mode: %1$s", mode.name()),
                         null, null, null /*data*/);
 
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
index 2ab0509..b24c383 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
@@ -17,7 +17,7 @@
 package com.android.layoutlib.bridge.impl;
 
 import com.android.ide.common.rendering.api.HardwareConfig;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderParams;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.Result;
@@ -252,7 +252,7 @@
                 getContext().getMetrics(), Surface.ROTATION_0, hasNavigationBar);
         WindowManagerGlobal_Delegate.setWindowManagerService(iwm);
 
-        ILayoutLog currentLog = mParams.getLog();
+        LayoutLog currentLog = mParams.getLog();
         Bridge.setLog(currentLog);
         mContext.getRenderResources().setLogger(currentLog);
     }
@@ -307,7 +307,7 @@
      * Returns the log associated with the session.
      * @return the log or null if there are none.
      */
-    public ILayoutLog getLog() {
+    public LayoutLog getLog() {
         if (mParams != null) {
             return mParams.getLog();
         }
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index 93d3df8..1338c17 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -18,8 +18,8 @@
 
 import com.android.ide.common.rendering.api.AdapterBinding;
 import com.android.ide.common.rendering.api.HardwareConfig;
-import com.android.ide.common.rendering.api.ILayoutLog;
 import com.android.ide.common.rendering.api.ILayoutPullParser;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.RenderSession;
 import com.android.ide.common.rendering.api.ResourceReference;
@@ -46,14 +46,16 @@
 import com.android.layoutlib.bridge.android.support.SupportPreferencesUtil;
 import com.android.layoutlib.bridge.impl.binding.FakeAdapter;
 import com.android.layoutlib.bridge.impl.binding.FakeExpandableAdapter;
+import com.android.tools.layoutlib.java.System_Delegate;
+import com.android.tools.idea.validator.ValidatorResult;
 import com.android.tools.idea.validator.LayoutValidator;
 import com.android.tools.idea.validator.ValidatorResult;
 import com.android.tools.idea.validator.ValidatorResult.Builder;
-import com.android.tools.layoutlib.java.System_Delegate;
-import com.android.utils.Pair;
+import com.android.util.Pair;
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.app.Fragment_Delegate;
 import android.graphics.Bitmap;
 import android.graphics.Bitmap_Delegate;
 import android.graphics.Canvas;
@@ -91,8 +93,6 @@
 import java.util.List;
 import java.util.Map;
 
-import com.google.android.apps.common.testing.accessibility.framework.uielement.AccessibilityHierarchyAndroid_ViewElementClassNamesAndroid_Delegate;
-
 import static com.android.ide.common.rendering.api.Result.Status.ERROR_INFLATION;
 import static com.android.ide.common.rendering.api.Result.Status.ERROR_NOT_INFLATED;
 import static com.android.ide.common.rendering.api.Result.Status.ERROR_UNKNOWN;
@@ -119,6 +119,7 @@
     private Canvas mCanvas;
     private int mMeasuredScreenWidth = -1;
     private int mMeasuredScreenHeight = -1;
+    private boolean mIsAlphaChannelImage;
     /** If >= 0, a frame will be executed */
     private long mElapsedFrameTimeNanos = -1;
     /** True if one frame has been already executed to start the animations */
@@ -174,6 +175,11 @@
         SessionParams params = getParams();
         BridgeContext context = getContext();
 
+        // use default of true in case it's not found to use alpha by default
+        mIsAlphaChannelImage =
+                ResourceHelper.getBooleanThemeFrameworkAttrValue(params.getResources(),
+                        "windowIsFloating", true);
+
         mLayoutBuilder = new Layout.Builder(params, context);
 
         // build the inflater and parser.
@@ -203,10 +209,10 @@
         mMeasuredScreenHeight = hardwareConfig.getScreenHeight();
 
         if (renderingMode != RenderingMode.NORMAL) {
-            int widthMeasureSpecMode = renderingMode.getHorizAction() == SizeAction.EXPAND ?
+            int widthMeasureSpecMode = renderingMode.isHorizExpand() ?
                     MeasureSpec.UNSPECIFIED // this lets us know the actual needed size
                     : MeasureSpec.EXACTLY;
-            int heightMeasureSpecMode = renderingMode.getVertAction() == SizeAction.EXPAND ?
+            int heightMeasureSpecMode = renderingMode.isVertExpand() ?
                     MeasureSpec.UNSPECIFIED // this lets us know the actual needed size
                     : MeasureSpec.EXACTLY;
 
@@ -227,6 +233,7 @@
 
             // first measure the full layout, with EXACTLY to get the size of the
             // content as it is inside the decor/dialog
+            @SuppressWarnings("deprecation")
             Pair<Integer, Integer> exactMeasure = measureView(
                     mViewRoot, measuredView,
                     mMeasuredScreenWidth, MeasureSpec.EXACTLY,
@@ -234,6 +241,7 @@
 
             // now measure the content only using UNSPECIFIED (where applicable, based on
             // the rendering mode). This will give us the size the content needs.
+            @SuppressWarnings("deprecation")
             Pair<Integer, Integer> neededMeasure = measureView(
                     mContentRoot, mContentRoot.getChildAt(0),
                     mMeasuredScreenWidth, widthMeasureSpecMode,
@@ -295,14 +303,14 @@
 
             if (Bridge.isLocaleRtl(params.getLocale())) {
                 if (!params.isRtlSupported()) {
-                    Bridge.getLog().warning(ILayoutLog.TAG_RTL_NOT_ENABLED,
+                    Bridge.getLog().warning(LayoutLog.TAG_RTL_NOT_ENABLED,
                             "You are using a right-to-left " +
                                     "(RTL) locale but RTL is not enabled", null, null);
                 } else if (params.getSimulatedPlatformVersion() !=0 &&
                         params.getSimulatedPlatformVersion() < 17) {
                     // This will render ok because we are using the latest layoutlib but at least
                     // warn the user that this might fail in a real device.
-                    Bridge.getLog().warning(ILayoutLog.TAG_RTL_NOT_SUPPORTED, "You are using a " +
+                    Bridge.getLog().warning(LayoutLog.TAG_RTL_NOT_SUPPORTED, "You are using a " +
                             "right-to-left " +
                             "(RTL) locale but RTL is not supported for API level < 17", null, null);
                 }
@@ -497,11 +505,11 @@
                         newImage = true;
                     }
 
-                    if (params.isTransparentBackground()) {
+                    if (params.isBgColorOverridden()) {
                         // since we override the content, it's the same as if it was a new image.
                         newImage = true;
                         Graphics2D gc = mImage.createGraphics();
-                        gc.setColor(new Color(0, true));
+                        gc.setColor(new Color(params.getOverrideBgColor(), true));
                         gc.setComposite(AlphaComposite.Src);
                         gc.fillRect(0, 0, mMeasuredScreenWidth, mMeasuredScreenHeight);
                         gc.dispose();
@@ -572,9 +580,6 @@
                          params.getFlag(RenderParamsFlags.FLAG_ENABLE_LAYOUT_VALIDATOR_IMAGE_CHECK));
 
                 if (enableLayoutValidation && !getViewInfos().isEmpty()) {
-                    AccessibilityHierarchyAndroid_ViewElementClassNamesAndroid_Delegate.sLayoutlibCallback =
-                            getContext().getLayoutlibCallback();
-
                     BufferedImage imageToPass =
                             enableLayoutValidationImageCheck ? getImage() : null;
                     ValidatorResult validatorResult =
@@ -585,8 +590,6 @@
                 ValidatorResult.Builder builder = new Builder();
                 builder.mMetric.mErrorMessage = e.getMessage();
                 setValidatorResult(builder.build());
-            } finally {
-                AccessibilityHierarchyAndroid_ViewElementClassNamesAndroid_Delegate.sLayoutlibCallback = null;
             }
 
             // success!
@@ -617,6 +620,7 @@
      * @param heightMode the MeasureSpec mode to use for the height.
      * @return the measured width/height if measuredView is non-null, null otherwise.
      */
+    @SuppressWarnings("deprecation")  // For the use of Pair
     private static Pair<Integer, Integer> measureView(ViewGroup viewToMeasure, View measuredView,
             int width, int widthMode, int height, int heightMode) {
         int w_spec = MeasureSpec.makeMeasureSpec(width, widthMode);
@@ -640,6 +644,7 @@
      * @param layoutlibCallback callback to the project.
      * @param skip the view and it's children are not processed.
      */
+    @SuppressWarnings("deprecation")  // For the use of Pair
     private void postInflateProcess(View view, LayoutlibCallback layoutlibCallback, View skip)
             throws PostInflateException {
         if (view == skip) {
@@ -867,7 +872,7 @@
         }
 
         if (count == 0) {
-            // Create a placeholder child to get a single tab
+            // Create a dummy child to get a single tab
             TabSpec spec = tabHost.newTabSpec("tag")
                     .setIndicator("Tab Label", tabHost.getResources()
                             .getDrawable(android.R.drawable.ic_menu_info_details, null))
@@ -878,7 +883,9 @@
             for (int i = 0 ; i < count ; i++) {
                 View child = content.getChildAt(i);
                 String tabSpec = String.format("tab_spec%d", i+1);
+                @SuppressWarnings("ConstantConditions")  // child cannot be null.
                 int id = child.getId();
+                @SuppressWarnings("deprecation")
                 ResourceReference resource = layoutlibCallback.resolveResourceId(id);
                 String name;
                 if (resource != null) {
@@ -1116,6 +1123,10 @@
         return mImage;
     }
 
+    public boolean isAlphaChannelImage() {
+        return mIsAlphaChannelImage;
+    }
+
     public List<ViewInfo> getViewInfos() {
         return mViewInfoList;
     }
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
index 0a36359..8e2ecd6 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
@@ -18,8 +18,8 @@
 import com.android.SdkConstants;
 import com.android.ide.common.rendering.api.AssetRepository;
 import com.android.ide.common.rendering.api.DensityBasedResourceValue;
-import com.android.ide.common.rendering.api.ILayoutLog;
 import com.android.ide.common.rendering.api.ILayoutPullParser;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceNamespace;
@@ -161,16 +161,10 @@
         }
 
         // try to load the color state list from an int
-        if (value.trim().startsWith("#")) {
-            try {
-                int color = getColor(value);
-                return ColorStateList.valueOf(color);
-            } catch (NumberFormatException e) {
-                Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_FORMAT,
-                        String.format("\"%1$s\" cannot be interpreted as a color.", value),
-                        null, null);
-                return null;
-            }
+        try {
+            int color = getColor(value);
+            return ColorStateList.valueOf(color);
+        } catch (NumberFormatException ignored) {
         }
 
         try {
@@ -208,13 +202,13 @@
                 }
             }
         } catch (XmlPullParserException e) {
-            Bridge.getLog().error(ILayoutLog.TAG_BROKEN,
+            Bridge.getLog().error(LayoutLog.TAG_BROKEN,
                     "Failed to configure parser for " + value, e, null,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(ILayoutLog.TAG_RESOURCES_READ,
+            Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
                     "Failed to parse file " + value, e, null, null /*data*/);
 
             return null;
@@ -317,17 +311,12 @@
             return null;
         }
 
+        String lowerCaseValue = stringValue.toLowerCase();
         // try the simple case first. Attempt to get a color from the value
-        if (stringValue.trim().startsWith("#")) {
-            try {
-                int color = getColor(stringValue);
-                return new ColorDrawable(color);
-            } catch (NumberFormatException e) {
-                Bridge.getLog().warning(ILayoutLog.TAG_RESOURCES_FORMAT,
-                        String.format("\"%1$s\" cannot be interpreted as a color.", stringValue),
-                        null, null);
-                return null;
-            }
+        try {
+            int color = getColor(stringValue);
+            return new ColorDrawable(color);
+        } catch (NumberFormatException ignore) {
         }
 
         Density density = Density.MEDIUM;
@@ -338,13 +327,12 @@
             }
         }
 
-        String lowerCaseValue = stringValue.toLowerCase();
         if (lowerCaseValue.endsWith(NinePatch.EXTENSION_9PATCH)) {
             try {
                 return getNinePatchDrawable(density, value.isFramework(), stringValue, context);
             } catch (IOException e) {
                 // failed to read the file, we'll return null below.
-                Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_READ,
+                Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
                         "Failed to load " + stringValue, e, null, null /*data*/);
             }
 
@@ -405,7 +393,7 @@
                     return new BitmapDrawable(context.getResources(), bitmap);
                 } catch (IOException e) {
                     // we'll return null below
-                    Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_READ,
+                    Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
                             "Failed to load " + stringValue, e, null, null /*data*/);
                 }
             }
@@ -645,7 +633,7 @@
                         applyUnit(sUnitNames[1], outValue, sFloatOut);
                         computeTypedValue(outValue, f, sFloatOut[0]);
 
-                        Bridge.getLog().error(ILayoutLog.TAG_RESOURCES_RESOLVE,
+                        Bridge.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE,
                                 String.format(
                                         "Dimension \"%1$s\" in attribute \"%2$s\" is missing unit!",
                                         value, attribute),
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/binding/AdapterHelper.java b/bridge/src/com/android/layoutlib/bridge/impl/binding/AdapterHelper.java
index b7f59c4..76c5942 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/binding/AdapterHelper.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/binding/AdapterHelper.java
@@ -17,14 +17,14 @@
 package com.android.layoutlib.bridge.impl.binding;
 
 import com.android.ide.common.rendering.api.DataBindingItem;
-import com.android.ide.common.rendering.api.ILayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback.ViewAttribute;
 import com.android.ide.common.rendering.api.ResourceReference;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.android.BridgeContext;
 import com.android.layoutlib.bridge.impl.RenderAction;
-import com.android.utils.Pair;
+import com.android.util.Pair;
 
 import android.view.View;
 import android.view.ViewGroup;
@@ -38,6 +38,7 @@
  */
 public class AdapterHelper {
 
+    @SuppressWarnings("deprecation")
     static Pair<View, Boolean> getView(AdapterItem item, AdapterItem parentItem, ViewGroup parent,
             LayoutlibCallback callback, ResourceReference adapterRef, boolean skipCallbackParser) {
         // we don't care about recycling here because we never scroll.
@@ -92,7 +93,7 @@
                                 resolvedRef, ViewAttribute.TEXT, tv.getText().toString());
                         if (value != null) {
                             if (value.getClass() != ViewAttribute.TEXT.getAttributeClass()) {
-                                Bridge.getLog().error(ILayoutLog.TAG_BROKEN, String.format(
+                                Bridge.getLog().error(LayoutLog.TAG_BROKEN, String.format(
                                         "Wrong Adapter Item value class for TEXT. Expected String, got %s",
                                         value.getClass().getName()), null, null);
                             } else {
@@ -112,7 +113,7 @@
                                 resolvedRef, ViewAttribute.IS_CHECKED, cb.isChecked());
                         if (value != null) {
                             if (value.getClass() != ViewAttribute.IS_CHECKED.getAttributeClass()) {
-                                Bridge.getLog().error(ILayoutLog.TAG_BROKEN, String.format(
+                                Bridge.getLog().error(LayoutLog.TAG_BROKEN, String.format(
                                         "Wrong Adapter Item value class for IS_CHECKED. Expected Boolean, got %s",
                                         value.getClass().getName()), null, null);
                             } else {
@@ -132,7 +133,7 @@
                                 resolvedRef, ViewAttribute.SRC, iv.getDrawable());
                         if (value != null) {
                             if (value.getClass() != ViewAttribute.SRC.getAttributeClass()) {
-                                Bridge.getLog().error(ILayoutLog.TAG_BROKEN, String.format(
+                                Bridge.getLog().error(LayoutLog.TAG_BROKEN, String.format(
                                         "Wrong Adapter Item value class for SRC. Expected Boolean, got %s",
                                         value.getClass().getName()), null, null);
                             } else {
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java b/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java
index 83ff28d..142eac1 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java
@@ -20,7 +20,7 @@
 import com.android.ide.common.rendering.api.DataBindingItem;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.ResourceReference;
-import com.android.utils.Pair;
+import com.android.util.Pair;
 
 import android.view.View;
 import android.view.ViewGroup;
@@ -110,6 +110,7 @@
     public View getView(int position, View convertView, ViewGroup parent) {
         // we don't care about recycling here because we never scroll.
         AdapterItem item = mItems.get(position);
+        @SuppressWarnings("deprecation")
         Pair<View, Boolean> pair = AdapterHelper.getView(item, null, parent, mCallback,
                 mAdapterRef, mSkipCallbackParser);
         mSkipCallbackParser = pair.getSecond();
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java b/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java
index 21679f7..344b17e 100644
--- a/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java
+++ b/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java
@@ -20,7 +20,7 @@
 import com.android.ide.common.rendering.api.DataBindingItem;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.ResourceReference;
-import com.android.utils.Pair;
+import com.android.util.Pair;
 
 import android.database.DataSetObserver;
 import android.view.View;
@@ -31,6 +31,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+@SuppressWarnings("deprecation")
 public class FakeExpandableAdapter implements ExpandableListAdapter, HeterogeneousExpandableList {
 
     private final LayoutlibCallback mCallback;
diff --git a/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java b/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java
index 16aa058..161bf41 100644
--- a/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java
+++ b/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java
@@ -17,7 +17,7 @@
 package com.android.layoutlib.bridge.util;
 
 import com.android.resources.ResourceType;
-import com.android.utils.Pair;
+import com.android.util.Pair;
 
 import android.annotation.NonNull;
 import android.util.SparseArray;
diff --git a/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java b/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
index dd06e80..a2a8aa9 100644
--- a/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
+++ b/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
@@ -133,7 +133,6 @@
                 if (i != o) {
                     keys[o] = keys[i];
                     values[o] = val;
-                    values[i] = null;
                 }
 
                 o++;
diff --git a/bridge/src/libcore/icu/ICU_Delegate.java b/bridge/src/libcore/icu/ICU_Delegate.java
index 7bb82ad..880344f 100644
--- a/bridge/src/libcore/icu/ICU_Delegate.java
+++ b/bridge/src/libcore/icu/ICU_Delegate.java
@@ -18,6 +18,9 @@
 
 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
 
+import android.icu.text.DateTimePatternGenerator;
+import android.icu.util.ULocale;
+
 import java.util.Locale;
 
 /**
@@ -31,11 +34,22 @@
     // --- Native methods accessing ICU's database.
 
     @LayoutlibDelegate
+    /*package*/ static String getBestDateTimePatternNative(String skeleton, String localeName) {
+        return DateTimePatternGenerator.getInstance(new ULocale(localeName))
+                .getBestPattern(skeleton);
+    }
+
+    @LayoutlibDelegate
     /*package*/ static String[] getAvailableLocalesNative() {
         return new String[0];
     }
 
     @LayoutlibDelegate
+    /*package*/ static String getCurrencyCode(String locale) {
+        return "";
+    }
+
+    @LayoutlibDelegate
     /*package*/ static String getISO3Country(String locale) {
         return "";
     }
@@ -61,22 +75,78 @@
     }
 
     @LayoutlibDelegate
+    /*package*/ static boolean initLocaleDataNative(String locale, LocaleData result) {
+
+        // Used by Calendar.
+        result.firstDayOfWeek = 1;
+        result.minimalDaysInFirstWeek = 1;
+
+        // Used by DateFormatSymbols.
+        result.amPm = new String[] { "AM", "PM" };
+        result.eras = new String[] { "BC", "AD" };
+
+        result.longMonthNames = new String[] { "January", "February", "March", "April", "May",
+                "June", "July", "August", "September", "October", "November", "December" };
+        result.shortMonthNames = new String[] { "Jan", "Feb", "Mar", "Apr", "May",
+                "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+        result.longStandAloneMonthNames = result.longMonthNames;
+        result.shortStandAloneMonthNames = result.shortMonthNames;
+
+        // The platform code expects this to begin at index 1, rather than 0. It maps it directly to
+        // the constants from java.util.Calendar.<weekday>
+        result.longWeekdayNames = new String[] {
+                "", "Sunday", "Monday" ,"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
+        result.shortWeekdayNames = new String[] {
+                "", "Sun", "Mon" ,"Tue", "Wed", "Thu", "Fri", "Sat" };
+        result.tinyWeekdayNames = new String[] {
+                "", "S", "M", "T", "W", "T", "F", "S" };
+
+        result.longStandAloneWeekdayNames = result.longWeekdayNames;
+        result.shortStandAloneWeekdayNames = result.shortWeekdayNames;
+        result.tinyStandAloneWeekdayNames = result.tinyWeekdayNames;
+
+        result.fullTimeFormat = "";
+        result.longTimeFormat = "";
+        result.mediumTimeFormat = "";
+        result.shortTimeFormat = "";
+
+        result.fullDateFormat = "";
+        result.longDateFormat = "";
+        result.mediumDateFormat = "";
+        result.shortDateFormat = "";
+
+        // Used by DecimalFormatSymbols.
+        result.zeroDigit = '0';
+        result.decimalSeparator = '.';
+        result.groupingSeparator = ',';
+        result.patternSeparator = ' ';
+        result.percent = "%";
+        result.perMill = "\u2030";
+        result.monetarySeparator = ' ';
+        result.minusSign = "-";
+        result.exponentSeparator = "e";
+        result.infinity = "\u221E";
+        result.NaN = "NaN";
+        // Also used by Currency.
+        result.currencySymbol = "$";
+        result.internationalCurrencySymbol = "USD";
+
+        // Used by DecimalFormat and NumberFormat.
+        result.numberPattern = "%f";
+        result.integerPattern = "%d";
+        result.currencyPattern = "%s";
+        result.percentPattern = "%f";
+
+        return true;
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static void setDefaultLocale(String locale) {
+        ICU.setDefaultLocale(locale);
+    }
+
+    @LayoutlibDelegate
     /*package*/ static String getDefaultLocale() {
-        return Locale.getDefault().toString();
-    }
-
-    @LayoutlibDelegate
-    /*package*/ static String getCldrVersion() {
-        return "";
-    }
-
-    @LayoutlibDelegate
-    /*package*/ static String getIcuVersion() {
-        return "";
-    }
-
-    @LayoutlibDelegate
-    /*package*/ static String getUnicodeVersion() {
-        return "";
+        return ICU.getDefaultLocale();
     }
 }
diff --git a/bridge/tests/Android.bp b/bridge/tests/Android.bp
index 7beb94d..5c51c68 100644
--- a/bridge/tests/Android.bp
+++ b/bridge/tests/Android.bp
@@ -12,10 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
 java_test_host {
     name: "layoutlib-tests",
 
diff --git a/bridge/tests/src/android/content/res/BridgeTypedArrayTest.java b/bridge/tests/src/android/content/res/BridgeTypedArrayTest.java
deleted file mode 100644
index 0be3423..0000000
--- a/bridge/tests/src/android/content/res/BridgeTypedArrayTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2020 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.content.res;
-
-import org.junit.Test;
-
-import static android.util.TypedValue.TYPE_ATTRIBUTE;
-import static android.util.TypedValue.TYPE_DIMENSION;
-import static android.util.TypedValue.TYPE_FLOAT;
-import static android.util.TypedValue.TYPE_INT_BOOLEAN;
-import static android.util.TypedValue.TYPE_INT_COLOR_ARGB4;
-import static android.util.TypedValue.TYPE_INT_COLOR_ARGB8;
-import static android.util.TypedValue.TYPE_INT_COLOR_RGB4;
-import static android.util.TypedValue.TYPE_INT_COLOR_RGB8;
-import static android.util.TypedValue.TYPE_INT_DEC;
-import static android.util.TypedValue.TYPE_INT_HEX;
-import static android.util.TypedValue.TYPE_NULL;
-import static android.util.TypedValue.TYPE_REFERENCE;
-import static android.util.TypedValue.TYPE_STRING;
-import static org.junit.Assert.assertEquals;
-
-public class BridgeTypedArrayTest {
-
-    @Test
-    public void getType() {
-        assertEquals(TYPE_NULL, BridgeTypedArray.getType(null));
-        assertEquals(TYPE_REFERENCE, BridgeTypedArray.getType("@drawable/my_drawable"));
-        assertEquals(TYPE_ATTRIBUTE, BridgeTypedArray.getType("?attr/colorPrimary"));
-        assertEquals(TYPE_INT_BOOLEAN, BridgeTypedArray.getType("true"));
-        assertEquals(TYPE_STRING, BridgeTypedArray.getType("False"));
-        assertEquals(TYPE_INT_HEX, BridgeTypedArray.getType("0xffa39d"));
-        assertEquals(TYPE_STRING, BridgeTypedArray.getType("0xnothex"));
-        assertEquals(TYPE_INT_COLOR_RGB4, BridgeTypedArray.getType("#f34"));
-        assertEquals(TYPE_INT_COLOR_ARGB4, BridgeTypedArray.getType("#2f34"));
-        assertEquals(TYPE_INT_COLOR_RGB8, BridgeTypedArray.getType("#f34ab4"));
-        assertEquals(TYPE_INT_COLOR_ARGB8, BridgeTypedArray.getType("#1f34dc28"));
-        assertEquals(TYPE_STRING, BridgeTypedArray.getType("#notacolor"));
-        assertEquals(TYPE_DIMENSION, BridgeTypedArray.getType("16dp"));
-        assertEquals(TYPE_STRING, BridgeTypedArray.getType("16notaunit"));
-        assertEquals(TYPE_INT_DEC, BridgeTypedArray.getType("98543"));
-        assertEquals(TYPE_FLOAT, BridgeTypedArray.getType("43.364"));
-        assertEquals(TYPE_STRING, BridgeTypedArray.getType("5432dp342"));
-    }
-}
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/FrameworkResources.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/FrameworkResources.java
index 2624df0..2408fa6 100644
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/FrameworkResources.java
+++ b/bridge/tests/src/com/android/ide/common/resources/deprecated/FrameworkResources.java
@@ -53,7 +53,7 @@
     private final Map<ResourceType, List<ResourceItem>> mPublicResourceMap =
         new EnumMap<>(ResourceType.class);
 
-    public FrameworkResources(@NotNull TestFolderWrapper resFolder) {
+    public FrameworkResources(@NotNull IAbstractFolder resFolder) {
         super(resFolder, true /*isFrameworkRepository*/);
     }
 
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/IdGeneratingResourceFile.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/IdGeneratingResourceFile.java
index 5434cad..90d6d64 100644
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/IdGeneratingResourceFile.java
+++ b/bridge/tests/src/com/android/ide/common/resources/deprecated/IdGeneratingResourceFile.java
@@ -53,7 +53,7 @@
 
     private final ResourceValue mFileValue;
 
-    public IdGeneratingResourceFile(TestFileWrapper file, ResourceFolder folder, ResourceType type) {
+    public IdGeneratingResourceFile(IAbstractFile file, ResourceFolder folder, ResourceType type) {
         super(file, folder);
 
         mFileType = type;
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/MultiResourceFile.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/MultiResourceFile.java
index 016c6b4..3a51134 100644
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/MultiResourceFile.java
+++ b/bridge/tests/src/com/android/ide/common/resources/deprecated/MultiResourceFile.java
@@ -52,7 +52,7 @@
 
     private Collection<ResourceType> mResourceTypeList = null;
 
-    public MultiResourceFile(TestFileWrapper file, ResourceFolder folder) {
+    public MultiResourceFile(IAbstractFile file, ResourceFolder folder) {
         super(file, folder);
     }
 
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceFile.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceFile.java
index 30fbd0b..c7eaa81 100644
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceFile.java
+++ b/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceFile.java
@@ -19,6 +19,7 @@
 import com.android.ide.common.rendering.api.ResourceValue;
 import com.android.ide.common.resources.configuration.Configurable;
 import com.android.ide.common.resources.configuration.FolderConfiguration;
+import com.android.io.IAbstractFile;
 import com.android.resources.ResourceType;
 
 /**
@@ -28,10 +29,10 @@
 @Deprecated
 public abstract class ResourceFile implements Configurable {
 
-    private final TestFileWrapper mFile;
+    private final IAbstractFile mFile;
     private final ResourceFolder mFolder;
 
-    protected ResourceFile(TestFileWrapper file, ResourceFolder folder) {
+    protected ResourceFile(IAbstractFile file, ResourceFolder folder) {
         mFile = file;
         mFolder = folder;
     }
@@ -47,7 +48,7 @@
     /**
      * Returns the IFile associated with the ResourceFile.
      */
-    public final TestFileWrapper getFile() {
+    public final IAbstractFile getFile() {
         return mFile;
     }
 
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceFolder.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceFolder.java
index 5fc2c19..fe708f3 100644
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceFolder.java
+++ b/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceFolder.java
@@ -63,7 +63,7 @@
      *            as a place to stash errors encountered
      * @return the {@link ResourceFile} that was created.
      */
-    public ResourceFile processFile(TestFileWrapper file, ResourceDeltaKind kind,
+    public ResourceFile processFile(IAbstractFile file, ResourceDeltaKind kind,
             ScanningContext context) {
         // look for this file if it's already been created
         ResourceFile resFile = getFile(file, context);
@@ -84,7 +84,7 @@
         return resFile;
     }
 
-    private ResourceFile createResourceFile(TestFileWrapper file) {
+    private ResourceFile createResourceFile(IAbstractFile file) {
         // check if that's a single or multi resource type folder. We have a special case
         // for ID generating resource types (layout/menu, and XML drawables, etc.).
         // MultiResourceFile handles the case when several resource types come from a single file
@@ -130,7 +130,7 @@
      *            as a place to stash errors encountered
      * @return the {@link ResourceFile} or null if no match was found.
      */
-    private ResourceFile getFile(TestFileWrapper file, ScanningContext context) {
+    private ResourceFile getFile(IAbstractFile file, ScanningContext context) {
         assert mFolder.equals(file.getParentFolder());
 
         // If the file actually exists, the resource folder  may not have been
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceRepository.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceRepository.java
index fca0862..d8204d5 100644
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceRepository.java
+++ b/bridge/tests/src/com/android/ide/common/resources/deprecated/ResourceRepository.java
@@ -19,6 +19,7 @@
 import com.android.ide.common.rendering.api.ResourceValue;
 import com.android.ide.common.resources.ResourceValueMap;
 import com.android.ide.common.resources.configuration.FolderConfiguration;
+import com.android.io.IAbstractFile;
 import com.android.io.IAbstractFolder;
 import com.android.io.IAbstractResource;
 import com.android.resources.ResourceFolderType;
@@ -39,7 +40,7 @@
  */
 @Deprecated
 public abstract class ResourceRepository {
-    private final TestFolderWrapper mResourceFolder;
+    private final IAbstractFolder mResourceFolder;
 
     private Map<ResourceFolderType, List<ResourceFolder>> mFolderMap =
             new EnumMap<>(ResourceFolderType.class);
@@ -57,13 +58,13 @@
      * @param resFolder the resource folder of the repository.
      * @param isFrameworkRepository whether the repository is for framework resources.
      */
-    protected ResourceRepository(@NotNull TestFolderWrapper resFolder,
+    protected ResourceRepository(@NotNull IAbstractFolder resFolder,
             boolean isFrameworkRepository) {
         mResourceFolder = resFolder;
         mFrameworkRepository = isFrameworkRepository;
     }
 
-    public TestFolderWrapper getResFolder() {
+    public IAbstractFolder getResFolder() {
         return mResourceFolder;
     }
 
@@ -91,8 +92,8 @@
             IAbstractResource[] resources = mResourceFolder.listMembers();
 
             for (IAbstractResource res : resources) {
-                if (res instanceof TestFolderWrapper) {
-                    TestFolderWrapper folder = (TestFolderWrapper)res;
+                if (res instanceof IAbstractFolder) {
+                    IAbstractFolder folder = (IAbstractFolder)res;
                     ResourceFolder resFolder = processFolder(folder);
 
                     if (resFolder != null) {
@@ -100,8 +101,8 @@
                         IAbstractResource[] files = folder.listMembers();
 
                         for (IAbstractResource fileRes : files) {
-                            if (fileRes instanceof TestFileWrapper) {
-                                TestFileWrapper file = (TestFileWrapper) fileRes;
+                            if (fileRes instanceof IAbstractFile) {
+                                IAbstractFile file = (IAbstractFile)fileRes;
 
                                 resFolder.processFile(file, ResourceDeltaKind.ADDED, context);
                             }
@@ -249,7 +250,7 @@
      * @return the ResourceFolder created from this folder, or null if the process failed.
      */
     @Nullable
-    private ResourceFolder processFolder(@NotNull TestFolderWrapper folder) {
+    private ResourceFolder processFolder(@NotNull IAbstractFolder folder) {
         ensureInitialized();
 
         // split the name of the folder in segments.
@@ -307,7 +308,7 @@
         return map;
     }
 
-    /**
+   /**
      * Loads the resources.
      */
     public void loadResources() {
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/SingleResourceFile.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/SingleResourceFile.java
index 38d975d..e7a3f90 100644
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/SingleResourceFile.java
+++ b/bridge/tests/src/com/android/ide/common/resources/deprecated/SingleResourceFile.java
@@ -42,7 +42,7 @@
     private final ResourceType mType;
     private final ResourceValue mValue;
 
-    public SingleResourceFile(TestFileWrapper file, ResourceFolder folder) {
+    public SingleResourceFile(IAbstractFile file, ResourceFolder folder) {
         super(file, folder);
 
         // we need to infer the type of the resource from the folder type.
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/TestFileWrapper.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/TestFileWrapper.java
deleted file mode 100644
index f1f3f17..0000000
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/TestFileWrapper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2020 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.ide.common.resources.deprecated;
-
-import com.android.io.FileWrapper;
-import com.android.io.IAbstractFolder;
-
-import java.io.File;
-
-public class TestFileWrapper extends FileWrapper {
-    public TestFileWrapper(File file) {
-        super(file);
-    }
-
-    public IAbstractFolder getParentFolder() {
-        String p = this.getParent();
-        if (p == null) {
-            return null;
-        }
-        return new TestFolderWrapper(p);
-    }
-}
diff --git a/bridge/tests/src/com/android/ide/common/resources/deprecated/TestFolderWrapper.java b/bridge/tests/src/com/android/ide/common/resources/deprecated/TestFolderWrapper.java
deleted file mode 100644
index f945d3c..0000000
--- a/bridge/tests/src/com/android/ide/common/resources/deprecated/TestFolderWrapper.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2020 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.ide.common.resources.deprecated;
-
-import com.android.io.FolderWrapper;
-import com.android.io.IAbstractResource;
-
-import java.io.File;
-
-public class TestFolderWrapper extends FolderWrapper {
-
-    public TestFolderWrapper(String pathname) {
-        super(pathname);
-    }
-
-    public TestFolderWrapper(File file) {
-        super(file.getAbsolutePath());
-    }
-
-    public IAbstractResource[] listMembers() {
-        File[] files = listFiles();
-        final int count = files == null ? 0 : files.length;
-        IAbstractResource[] afiles = new IAbstractResource[count];
-
-        if (files != null) {
-            for (int i = 0 ; i < count ; i++) {
-                File f = files[i];
-                if (f.isFile()) {
-                    afiles[i] = new TestFileWrapper(f);
-                } else if (f.isDirectory()) {
-                    afiles[i] = new TestFolderWrapper(f);
-                }
-            }
-        }
-
-        return afiles;
-    }
-
-    public TestFolderWrapper getFolder(String name) {
-        return new TestFolderWrapper(new File(this, name));
-    }
-}
diff --git a/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java b/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java
index be57b88..e43531a 100644
--- a/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java
+++ b/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java
@@ -29,7 +29,6 @@
 import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
-import android.content.res.BridgeTypedArrayTest;
 import android.content.res.Resources_DelegateTest;
 import android.graphics.Color_DelegateTest;
 import android.graphics.Matrix_DelegateTest;
@@ -48,7 +47,7 @@
         BridgeRenderSessionTest.class, ResourceHelperTest.class, BridgeContextTest.class,
         Resources_DelegateTest.class, Color_DelegateTest.class, ImagePoolHelperTest.class,
         ImagePoolImplTest.class, HighQualityShadowsRenderTests.class,
-        LayoutValidatorTests.class, AccessibilityValidatorTests.class, BridgeTypedArrayTest.class
+        LayoutValidatorTests.class, AccessibilityValidatorTests.class
 })
 public class Main {
 }
diff --git a/bridge/tests/src/com/android/layoutlib/bridge/intensive/RenderTestBase.java b/bridge/tests/src/com/android/layoutlib/bridge/intensive/RenderTestBase.java
index 67bb7af..a22c3bc 100644
--- a/bridge/tests/src/com/android/layoutlib/bridge/intensive/RenderTestBase.java
+++ b/bridge/tests/src/com/android/layoutlib/bridge/intensive/RenderTestBase.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.intensive;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderSession;
 import com.android.ide.common.rendering.api.Result;
 import com.android.ide.common.rendering.api.SessionParams;
@@ -24,7 +24,7 @@
 import com.android.ide.common.resources.deprecated.FrameworkResources;
 import com.android.ide.common.resources.deprecated.ResourceItem;
 import com.android.ide.common.resources.deprecated.ResourceRepository;
-import com.android.ide.common.resources.deprecated.TestFolderWrapper;
+import com.android.io.FolderWrapper;
 import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.android.RenderParamsFlags;
 import com.android.layoutlib.bridge.impl.DelegateManager;
@@ -115,7 +115,7 @@
     protected static Bridge sBridge;
     /** List of log messages generated by a render call. It can be used to find specific errors */
     protected static ArrayList<String> sRenderMessages = Lists.newArrayList();
-    private static ILayoutLog sLayoutLibLog;
+    private static LayoutLog sLayoutLibLog;
     private static FrameworkResources sFrameworkRepo;
     private static ResourceRepository sProjectResources;
     private static ILogger sLogger;
@@ -303,12 +303,12 @@
     public static void beforeClass() {
         File data_dir = new File(PLATFORM_DIR, "data");
         File res = new File(data_dir, "res");
-        sFrameworkRepo = new FrameworkResources(new TestFolderWrapper(res));
+        sFrameworkRepo = new FrameworkResources(new FolderWrapper(res));
         sFrameworkRepo.loadResources();
         sFrameworkRepo.loadPublicResources(getLogger());
 
         sProjectResources =
-                new ResourceRepository(new TestFolderWrapper(TEST_RES_DIR + "/" + APP_TEST_RES),
+                new ResourceRepository(new FolderWrapper(TEST_RES_DIR + "/" + APP_TEST_RES),
                         false) {
                     @NonNull
                     @Override
@@ -433,9 +433,9 @@
         return RenderTestBase.renderAndVerify(params, goldenFileName, -1);
     }
 
-    protected static ILayoutLog getLayoutLog() {
+    protected static LayoutLog getLayoutLog() {
         if (sLayoutLibLog == null) {
-            sLayoutLibLog = new ILayoutLog() {
+            sLayoutLibLog = new LayoutLog() {
                 @Override
                 public void warning(String tag, String message, Object cookie, Object data) {
                     System.out.println("Warning " + tag + ": " + message);
@@ -474,7 +474,7 @@
     }
 
     protected static void ignoreAllLogging() {
-        sLayoutLibLog = new ILayoutLog() {};
+        sLayoutLibLog = new LayoutLog();
         sLogger = new ILogger() {
             @Override
             public void error(Throwable t, String msgFormat, Object... args) {
diff --git a/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/LayoutLibTestCallback.java b/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/LayoutLibTestCallback.java
index 9faa0a6..a6389ac 100644
--- a/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/LayoutLibTestCallback.java
+++ b/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/LayoutLibTestCallback.java
@@ -72,7 +72,7 @@
         Class<?> rClass = mModuleClassLoader.loadClass(PACKAGE_NAME + ".R");
         Class<?>[] nestedClasses = rClass.getDeclaredClasses();
         for (Class<?> resClass : nestedClasses) {
-            final ResourceType resType = ResourceType.fromClassName(resClass.getSimpleName());
+            final ResourceType resType = ResourceType.getEnum(resClass.getSimpleName());
 
             if (resType != null) {
                 for (Field field : resClass.getDeclaredFields()) {
diff --git a/bridge/tests/src/com/android/layoutlib/bridge/intensive/util/SessionParamsBuilder.java b/bridge/tests/src/com/android/layoutlib/bridge/intensive/util/SessionParamsBuilder.java
index 396880e..baadc62 100644
--- a/bridge/tests/src/com/android/layoutlib/bridge/intensive/util/SessionParamsBuilder.java
+++ b/bridge/tests/src/com/android/layoutlib/bridge/intensive/util/SessionParamsBuilder.java
@@ -19,7 +19,7 @@
 import com.android.SdkConstants;
 import com.android.ide.common.rendering.api.AssetRepository;
 import com.android.ide.common.rendering.api.IImageFactory;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.LayoutlibCallback;
 import com.android.ide.common.rendering.api.ResourceNamespace;
 import com.android.ide.common.rendering.api.ResourceReference;
@@ -56,7 +56,7 @@
     private LayoutlibCallback mLayoutlibCallback;
     private int mTargetSdk;
     private int mMinSdk = 0;
-    private ILayoutLog mLayoutLog;
+    private LayoutLog mLayoutLog;
     private Map<SessionParams.Key, Object> mFlags = new HashMap<>();
     private AssetRepository mAssetRepository = null;
     private boolean mDecor = true;
@@ -136,7 +136,7 @@
     }
 
     @NonNull
-    public SessionParamsBuilder setLayoutLog(@NonNull ILayoutLog layoutLog) {
+    public SessionParamsBuilder setLayoutLog(@NonNull LayoutLog layoutLog) {
         mLayoutLog = layoutLog;
         return this;
     }
diff --git a/common/Android.bp b/common/Android.bp
index b33e756..a256ae2 100644
--- a/common/Android.bp
+++ b/common/Android.bp
@@ -14,10 +14,6 @@
 // limitations under the License.
 //
 
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
 java_library_host {
     name: "layoutlib-common",
 
diff --git a/create/Android.bp b/create/Android.bp
index 0fc219d..44179a9 100644
--- a/create/Android.bp
+++ b/create/Android.bp
@@ -14,16 +14,6 @@
 // limitations under the License.
 //
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "frameworks_layoutlib_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    //   SPDX-license-identifier-EPL
-    default_applicable_licenses: ["frameworks_layoutlib_license"],
-}
-
 java_binary_host {
     name: "layoutlib_create",
 
diff --git a/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index 44046eb..bbe985e 100644
--- a/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -168,14 +168,11 @@
         "android.graphics.drawable.GradientDrawable#buildRing",
         "android.graphics.drawable.AdaptiveIconDrawable#<init>",
         "android.graphics.drawable.DrawableInflater#inflateFromClass",
-        "android.graphics.drawable.NinePatchDrawable#getOpacity",
         "android.graphics.FontFamily#addFont",
-        "com.google.android.apps.common.testing.accessibility.framework.uielement" +
-                ".AccessibilityHierarchyAndroid$ViewElementClassNamesAndroid#getClassByName",
         "android.graphics.Typeface#create",
         "android.graphics.Typeface$Builder#createAssetUid",
         "android.graphics.fonts.Font$Builder#createBuffer",
-        "android.graphics.fonts.SystemFonts#getSystemFontConfigInternal",
+        "android.graphics.fonts.SystemFonts#buildSystemFallback",
         "android.os.Binder#getNativeBBinderHolder",
         "android.os.Binder#getNativeFinalizer",
         "android.os.Handler#sendMessageAtTime",
@@ -317,7 +314,6 @@
             "android.os.ServiceManager",                       "android.os._Original_ServiceManager",
             "android.view.textservice.TextServicesManager",    "android.view.textservice._Original_TextServicesManager",
             "android.view.SurfaceView",                        "android.view._Original_SurfaceView",
-            "android.view.WindowManagerImpl",                  "android.view._Original_WindowManagerImpl",
             "android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
             "android.view.accessibility.AccessibilityNodeIdManager", "android.view.accessibility._Original_AccessibilityNodeIdManager",
             "android.webkit.WebView",                          "android.webkit._Original_WebView",
diff --git a/create/src/com/android/tools/layoutlib/create/Main.java b/create/src/com/android/tools/layoutlib/create/Main.java
index 4acc754..b56416e 100644
--- a/create/src/com/android/tools/layoutlib/create/Main.java
+++ b/create/src/com/android/tools/layoutlib/create/Main.java
@@ -129,9 +129,7 @@
                         "android.app.DatePickerDialog",     // b.android.com/28318
                         "android.app.TimePickerDialog",     // b.android.com/61515
                         "com.android.internal.view.menu.ActionMenu",
-                        "libcore.icu.ICU",                  // needed by ICU_Delegate in LayoutLib
                         "android.icu.**",                   // needed by LayoutLib
-                        "libcore.io.*",                     // needed to load /usr/share/zoneinfo
                         "android.annotation.NonNull",       // annotations
                         "android.annotation.Nullable",      // annotations
                         "com.android.internal.transition.EpicenterTranslateClipReveal",
diff --git a/create/src/com/android/tools/layoutlib/java/System_Delegate.java b/create/src/com/android/tools/layoutlib/java/System_Delegate.java
index 335f566..be93744 100644
--- a/create/src/com/android/tools/layoutlib/java/System_Delegate.java
+++ b/create/src/com/android/tools/layoutlib/java/System_Delegate.java
@@ -22,7 +22,7 @@
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
- * Provides alternative implementations of methods that don't exist on the host VM.
+ * Provides dummy implementation of methods that don't exist on the host VM.
  * This also providers a time control that allows to set a specific system time.
  *
  * @see ReplaceMethodCallsAdapter
diff --git a/create/tests/Android.bp b/create/tests/Android.bp
index 31fbe22..c765707 100644
--- a/create/tests/Android.bp
+++ b/create/tests/Android.bp
@@ -12,16 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "frameworks_layoutlib_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    //   SPDX-license-identifier-EPL
-    default_applicable_licenses: ["frameworks_layoutlib_license"],
-}
-
 java_test_host {
     name: "layoutlib-create-tests",
 
diff --git a/create/tests/res/data/mock_android.jar b/create/tests/res/data/mock_android.jar
index 3fd6999..580e6f1 100644
--- a/create/tests/res/data/mock_android.jar
+++ b/create/tests/res/data/mock_android.jar
Binary files differ
diff --git a/create/tests/res/mock_data/mock_android/fake2/FakeClass.java b/create/tests/res/mock_data/mock_android/dummy/DummyClass.java
similarity index 91%
rename from create/tests/res/mock_data/mock_android/fake2/FakeClass.java
rename to create/tests/res/mock_data/mock_android/dummy/DummyClass.java
index e1496b0..de3b0e0 100644
--- a/create/tests/res/mock_data/mock_android/fake2/FakeClass.java
+++ b/create/tests/res/mock_data/mock_android/dummy/DummyClass.java
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-package mock_android.fake2;
+package mock_android.dummy;
 
-public class FakeClass {
+public class DummyClass {
 
 }
\ No newline at end of file
diff --git a/create/tests/res/mock_data/mock_android/fake/InnerTest.java b/create/tests/res/mock_data/mock_android/dummy/InnerTest.java
similarity index 98%
rename from create/tests/res/mock_data/mock_android/fake/InnerTest.java
rename to create/tests/res/mock_data/mock_android/dummy/InnerTest.java
index 254b35d..d3a1d05 100644
--- a/create/tests/res/mock_data/mock_android/fake/InnerTest.java
+++ b/create/tests/res/mock_data/mock_android/dummy/InnerTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package mock_android.fake;
+package mock_android.dummy;
 
 import java.util.ArrayList;
 import java.util.Collection;
diff --git a/create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassA.java b/create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassA.java
similarity index 94%
rename from create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassA.java
rename to create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassA.java
index 3381c8d..eaf1302 100644
--- a/create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassA.java
+++ b/create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassA.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package mock_android.fake.subpackage;
+package mock_android.dummy.subpackage;
 
 public class SubpackageClassA {
 
diff --git a/create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassB.java b/create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassB.java
similarity index 94%
rename from create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassB.java
rename to create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassB.java
index 5567b08..7f67db1 100644
--- a/create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassB.java
+++ b/create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassB.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package mock_android.fake.subpackage;
+package mock_android.dummy.subpackage;
 
 public class SubpackageClassB {
 
diff --git a/create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassC.java b/create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassC.java
similarity index 94%
rename from create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassC.java
rename to create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassC.java
index dac1633..e456432 100644
--- a/create/tests/res/mock_data/mock_android/fake/subpackage/SubpackageClassC.java
+++ b/create/tests/res/mock_data/mock_android/dummy/subpackage/SubpackageClassC.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package mock_android.fake.subpackage;
+package mock_android.dummy.subpackage;
 
 public class SubpackageClassC {
     public static class StaticInnerClass {
diff --git a/create/tests/res/mock_data/mock_android/fake2/FakeClass.java b/create/tests/res/mock_data/mock_android/dummy2/DummyClass.java
similarity index 91%
copy from create/tests/res/mock_data/mock_android/fake2/FakeClass.java
copy to create/tests/res/mock_data/mock_android/dummy2/DummyClass.java
index e1496b0..9f7cfde 100644
--- a/create/tests/res/mock_data/mock_android/fake2/FakeClass.java
+++ b/create/tests/res/mock_data/mock_android/dummy2/DummyClass.java
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-package mock_android.fake2;
+package mock_android.dummy2;
 
-public class FakeClass {
+public class DummyClass {
 
 }
\ No newline at end of file
diff --git a/create/tests/res/mock_data/mock_android/fake2/keep/DoNotRemove.java b/create/tests/res/mock_data/mock_android/dummy2/keep/DoNotRemove.java
similarity index 94%
rename from create/tests/res/mock_data/mock_android/fake2/keep/DoNotRemove.java
rename to create/tests/res/mock_data/mock_android/dummy2/keep/DoNotRemove.java
index 2e4fa9c..8a232a6 100644
--- a/create/tests/res/mock_data/mock_android/fake2/keep/DoNotRemove.java
+++ b/create/tests/res/mock_data/mock_android/dummy2/keep/DoNotRemove.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package mock_android.fake2.keep;
+package mock_android.dummy2.keep;
 
 public class DoNotRemove {
 
diff --git a/create/tests/res/mock_data/mock_android/fake/FakeClass.java b/create/tests/res/mock_data/mock_android/fake/FakeClass.java
deleted file mode 100644
index c8b0146..0000000
--- a/create/tests/res/mock_data/mock_android/fake/FakeClass.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2018 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 mock_android.fake;
-
-public class FakeClass {
-
-}
\ No newline at end of file
diff --git a/create/tests/src/com/android/tools/layoutlib/create/AsmAnalyzerTest.java b/create/tests/src/com/android/tools/layoutlib/create/AsmAnalyzerTest.java
index 327bbb7..c2372b7 100644
--- a/create/tests/src/com/android/tools/layoutlib/create/AsmAnalyzerTest.java
+++ b/create/tests/src/com/android/tools/layoutlib/create/AsmAnalyzerTest.java
@@ -66,22 +66,22 @@
         getDefaultAnalyzer().parseZip(MOCK_ANDROID_JAR, map, filesFound);
 
         assertArrayEquals(new String[] {
-                "mock_android.fake.FakeClass",
-                "mock_android.fake.InnerTest",
-                "mock_android.fake.InnerTest$1",
-                "mock_android.fake.InnerTest$DerivingClass",
-                "mock_android.fake.InnerTest$MyGenerics1",
-                "mock_android.fake.InnerTest$MyIntEnum",
-                "mock_android.fake.InnerTest$MyStaticInnerClass",
-                "mock_android.fake.InnerTest$NotStaticInner1",
-                "mock_android.fake.InnerTest$NotStaticInner2",
-                "mock_android.fake.subpackage.SubpackageClassA",
-                "mock_android.fake.subpackage.SubpackageClassB",
-                "mock_android.fake.subpackage.SubpackageClassC",
-                "mock_android.fake.subpackage.SubpackageClassC$InnerClass",
-                "mock_android.fake.subpackage.SubpackageClassC$StaticInnerClass",
-                "mock_android.fake2.FakeClass",
-                "mock_android.fake2.keep.DoNotRemove",
+                "mock_android.dummy.DummyClass",
+                "mock_android.dummy.InnerTest",
+                "mock_android.dummy.InnerTest$1",
+                "mock_android.dummy.InnerTest$DerivingClass",
+                "mock_android.dummy.InnerTest$MyGenerics1",
+                "mock_android.dummy.InnerTest$MyIntEnum",
+                "mock_android.dummy.InnerTest$MyStaticInnerClass",
+                "mock_android.dummy.InnerTest$NotStaticInner1",
+                "mock_android.dummy.InnerTest$NotStaticInner2",
+                "mock_android.dummy.subpackage.SubpackageClassA",
+                "mock_android.dummy.subpackage.SubpackageClassB",
+                "mock_android.dummy.subpackage.SubpackageClassC",
+                "mock_android.dummy.subpackage.SubpackageClassC$InnerClass",
+                "mock_android.dummy.subpackage.SubpackageClassC$StaticInnerClass",
+                "mock_android.dummy2.DummyClass",
+                "mock_android.dummy2.keep.DoNotRemove",
                 "mock_android.util.EmptyArray",
                 "mock_android.util.NotNeeded",
                 "mock_android.view.View",
@@ -122,29 +122,29 @@
         AsmAnalyzer analyzer = new AsmAnalyzer(new MockLog(), MOCK_ANDROID_JAR, null,
                 new String[] {
                     "mock_android.util.EmptyArray", // Single class select
-                    "mock_android.fake.**", // Multi package select
-                    "mock_android.fake2.*", // Exclude subpackages select
+                    "mock_android.dummy.**", // Multi package select
+                    "mock_android.dummy2.*", // Exclude subpackages select
                 },
                 DEFAULT_EXCLUDES,
                 DEFAULT_INCLUDE_FILES);
         Result result = analyzer.analyze();
         assertArrayEquals(new String[] {
-                        "mock_android.fake.InnerTest$NotStaticInner1",
-                        "mock_android.fake.FakeClass",
+                        "mock_android.dummy.DummyClass",
+                        "mock_android.dummy.InnerTest$MyIntEnum",
                         "mock_android.util.EmptyArray",
-                        "mock_android.fake2.FakeClass",
-                        "mock_android.fake.InnerTest$DerivingClass",
-                        "mock_android.fake.InnerTest$NotStaticInner2",
-                        "mock_android.fake.subpackage.SubpackageClassC$InnerClass",
-                        "mock_android.fake.InnerTest$MyGenerics1",
-                        "mock_android.fake.InnerTest$MyIntEnum",
-                        "mock_android.fake.InnerTest$MyStaticInnerClass",
-                        "mock_android.fake.InnerTest",
-                        "mock_android.fake.subpackage.SubpackageClassB",
-                        "mock_android.fake.subpackage.SubpackageClassA",
-                        "mock_android.fake.InnerTest$1",
-                        "mock_android.fake.subpackage.SubpackageClassC$StaticInnerClass",
-                        "mock_android.fake.subpackage.SubpackageClassC",
+                        "mock_android.dummy.InnerTest$DerivingClass",
+                        "mock_android.dummy2.DummyClass",
+                        "mock_android.dummy.subpackage.SubpackageClassC$InnerClass",
+                        "mock_android.dummy.InnerTest$MyGenerics1",
+                        "mock_android.dummy.subpackage.SubpackageClassC$StaticInnerClass",
+                        "mock_android.dummy.InnerTest$MyStaticInnerClass",
+                        "mock_android.dummy.InnerTest$NotStaticInner1",
+                        "mock_android.dummy.InnerTest$NotStaticInner2",
+                        "mock_android.dummy.subpackage.SubpackageClassA",
+                        "mock_android.dummy.InnerTest",
+                        "mock_android.dummy.InnerTest$1",
+                        "mock_android.dummy.subpackage.SubpackageClassC",
+                        "mock_android.dummy.subpackage.SubpackageClassB",
                 },
                 result.getFound().keySet().toArray());
     }
diff --git a/create/tests/src/com/android/tools/layoutlib/create/AsmGeneratorTest.java b/create/tests/src/com/android/tools/layoutlib/create/AsmGeneratorTest.java
index 3f5e8f6..0d6e5d9 100644
--- a/create/tests/src/com/android/tools/layoutlib/create/AsmGeneratorTest.java
+++ b/create/tests/src/com/android/tools/layoutlib/create/AsmGeneratorTest.java
@@ -215,8 +215,8 @@
             @Override
             public String[] getExcludedClasses() {
                 return new String[] {
-                        "mock_android.fake2.*",
-                        "mock_android.fake.**",
+                        "mock_android.dummy2.*",
+                        "mock_android.dummy.**",
                         "mock_android.util.NotNeeded",
                         JAVA_CLASS_NAME
                 };
@@ -235,10 +235,10 @@
                 });
         agen.setAnalysisResult(aa.analyze());
         Map<String, byte[]> output = agen.generate();
-        // Everything in .fake.** should be filtered
-        // Only things is .fake2.* should be filtered
+        // Everything in .dummy.** should be filtered
+        // Only things is .dummy2.* should be filtered
         assertArrayEquals(new String[] {
-                "mock_android.fake2.keep.DoNotRemove",
+                "mock_android.dummy2.keep.DoNotRemove",
                 "mock_android.util.EmptyArray",
                 "mock_android.view.View",
                 "mock_android.view.ViewGroup",
diff --git a/create/tests/src/com/android/tools/layoutlib/create/ClassHasNativeVisitorTest.java b/create/tests/src/com/android/tools/layoutlib/create/ClassHasNativeVisitorTest.java
index 8622882..f3dc876 100644
--- a/create/tests/src/com/android/tools/layoutlib/create/ClassHasNativeVisitorTest.java
+++ b/create/tests/src/com/android/tools/layoutlib/create/ClassHasNativeVisitorTest.java
@@ -76,7 +76,7 @@
     }
 
     /**
-     * Fake test class with a native method.
+     * Dummy test class with a native method.
      */
     public static class ClassWithNative {
         public ClassWithNative() {
@@ -90,7 +90,7 @@
     }
 
     /**
-     * Fake test class with no native method.
+     * Dummy test class with no native method.
      */
     public static class ClassWithoutNative {
         public ClassWithoutNative() {
diff --git a/create/tests/src/com/android/tools/layoutlib/create/StubMethodAdapterTest.java b/create/tests/src/com/android/tools/layoutlib/create/StubMethodAdapterTest.java
index 3782173..a7f156b 100644
--- a/create/tests/src/com/android/tools/layoutlib/create/StubMethodAdapterTest.java
+++ b/create/tests/src/com/android/tools/layoutlib/create/StubMethodAdapterTest.java
@@ -38,7 +38,7 @@
     private static final String STUB_CLASS_NAME = StubClass.class.getName();
 
     /**
-     * Load a mock class, stub one of its method and ensure that the modified class works as
+     * Load a dummy class, stub one of its method and ensure that the modified class works as
      * intended.
      */
     @Test
diff --git a/create/tests/src/com/android/tools/layoutlib/create/dataclass/ClassWithNative.java b/create/tests/src/com/android/tools/layoutlib/create/dataclass/ClassWithNative.java
index f7f9535..6867ec0 100644
--- a/create/tests/src/com/android/tools/layoutlib/create/dataclass/ClassWithNative.java
+++ b/create/tests/src/com/android/tools/layoutlib/create/dataclass/ClassWithNative.java
@@ -19,7 +19,7 @@
 import com.android.tools.layoutlib.create.DelegateClassAdapterTest;
 
 /**
- * Fake test class with a native method.
+ * Dummy test class with a native method.
  * The native method is not defined and any attempt to invoke it will
  * throw an {@link UnsatisfiedLinkError}.
  *
diff --git a/remote/client/src/com/android/layoutlib/bridge/remote/client/RemoteBridgeClient.java b/remote/client/src/com/android/layoutlib/bridge/remote/client/RemoteBridgeClient.java
index d63c9f6..051fb85 100644
--- a/remote/client/src/com/android/layoutlib/bridge/remote/client/RemoteBridgeClient.java
+++ b/remote/client/src/com/android/layoutlib/bridge/remote/client/RemoteBridgeClient.java
@@ -18,11 +18,12 @@
 
 import com.android.ide.common.rendering.api.Bridge;
 import com.android.ide.common.rendering.api.DrawableParams;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderSession;
 import com.android.ide.common.rendering.api.Result;
 import com.android.ide.common.rendering.api.SessionParams;
 import com.android.layout.remote.api.RemoteBridge;
+import com.android.layout.remote.api.RemoteDrawableParams;
 import com.android.layout.remote.api.RemoteSessionParams;
 import com.android.layoutlib.bridge.remote.client.adapters.RemoteDrawableParamsAdapter;
 import com.android.layoutlib.bridge.remote.client.adapters.RemoteLayoutLogAdapter;
@@ -59,7 +60,7 @@
             String nativeLibPath,
             String icuDataPath,
             Map<String, Map<String, Integer>> enumValueMap,
-            ILayoutLog log) {
+            LayoutLog log) {
         try {
             return mDelegate.init(platformProperties, fontLocation, nativeLibPath, icuDataPath,
                     enumValueMap, RemoteLayoutLogAdapter.create(log));
diff --git a/remote/client/src/com/android/layoutlib/bridge/remote/client/adapters/RemoteLayoutLogAdapter.java b/remote/client/src/com/android/layoutlib/bridge/remote/client/adapters/RemoteLayoutLogAdapter.java
index 2ea9102..23d36bc 100644
--- a/remote/client/src/com/android/layoutlib/bridge/remote/client/adapters/RemoteLayoutLogAdapter.java
+++ b/remote/client/src/com/android/layoutlib/bridge/remote/client/adapters/RemoteLayoutLogAdapter.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.remote.client.adapters;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layout.remote.api.RemoteLayoutLog;
 import com.android.tools.layoutlib.annotations.NotNull;
 
@@ -25,13 +25,13 @@
 import java.rmi.server.UnicastRemoteObject;
 
 public class RemoteLayoutLogAdapter implements RemoteLayoutLog {
-    private final ILayoutLog mLog;
+    private final LayoutLog mLog;
 
-    private RemoteLayoutLogAdapter(@NotNull ILayoutLog log) {
+    private RemoteLayoutLogAdapter(@NotNull LayoutLog log) {
         mLog = log;
     }
 
-    public static RemoteLayoutLog create(@NotNull ILayoutLog log) throws RemoteException {
+    public static RemoteLayoutLog create(@NotNull LayoutLog log) throws RemoteException {
         return (RemoteLayoutLog) UnicastRemoteObject.exportObject(new RemoteLayoutLogAdapter(log),
                 0);
     }
@@ -56,9 +56,4 @@
     public void error(String tag, String message, Throwable throwable, Object viewCookie, Serializable data) {
         mLog.error(tag, message, throwable, viewCookie, null);
     }
-
-    @Override
-    public void logAndroidFramework(int priority, String tag, String message) {
-        mLog.logAndroidFramework(priority, tag, message);
-    }
 }
diff --git a/remote/common/src/com/android/layout/remote/api/RemoteBridge.java b/remote/common/src/com/android/layout/remote/api/RemoteBridge.java
index 4ef9d97..3634fff 100644
--- a/remote/common/src/com/android/layout/remote/api/RemoteBridge.java
+++ b/remote/common/src/com/android/layout/remote/api/RemoteBridge.java
@@ -17,7 +17,7 @@
 package com.android.layout.remote.api;
 
 import com.android.ide.common.rendering.api.Bridge;
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderSession;
 import com.android.ide.common.rendering.api.Result;
 import com.android.tools.layoutlib.annotations.NotNull;
@@ -43,7 +43,7 @@
      * @param icuDataPath the location of the ICU data used natively.
      * @param enumValueMap map attrName ⇒ { map enumFlagName ⇒ Integer value }. This is typically
      * read from attrs.xml in the SDK target.
-     * @param log a {@link ILayoutLog} object. Can be null.
+     * @param log a {@link LayoutLog} object. Can be null.
      *
      * @return true if success.
      */
diff --git a/remote/common/src/com/android/layout/remote/api/RemoteLayoutLog.java b/remote/common/src/com/android/layout/remote/api/RemoteLayoutLog.java
index 335cf9d..01add53 100644
--- a/remote/common/src/com/android/layout/remote/api/RemoteLayoutLog.java
+++ b/remote/common/src/com/android/layout/remote/api/RemoteLayoutLog.java
@@ -16,14 +16,14 @@
 
 package com.android.layout.remote.api;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 
 import java.io.Serializable;
 import java.rmi.Remote;
 import java.rmi.RemoteException;
 
 /**
- * Remote version of the {@link ILayoutLog} class
+ * Remote version of the {@link LayoutLog} class
  */
 public interface RemoteLayoutLog extends Remote {
     /**
@@ -72,13 +72,4 @@
      */
     void error(String tag, String message, Throwable throwable, Object viewCookie, Serializable data)
             throws RemoteException;
-
-    /** 
-     * Logs messages coming from the Android Framework. 
-     *
-     * @param priority the priority level of the message 
-     * @param tag a tag describing the type of the error
-     * @param message the message of the error
-     */
-    void logAndroidFramework(int priority, String tag, String message) throws RemoteException;
 }
diff --git a/remote/server/src/com/android/layoutlib/bridge/remote/server/adapters/RemoteLayoutLogAdapter.java b/remote/server/src/com/android/layoutlib/bridge/remote/server/adapters/RemoteLayoutLogAdapter.java
index 5c48aef..90da083 100644
--- a/remote/server/src/com/android/layoutlib/bridge/remote/server/adapters/RemoteLayoutLogAdapter.java
+++ b/remote/server/src/com/android/layoutlib/bridge/remote/server/adapters/RemoteLayoutLogAdapter.java
@@ -16,13 +16,13 @@
 
 package com.android.layoutlib.bridge.remote.server.adapters;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.layout.remote.api.RemoteLayoutLog;
 import com.android.tools.layoutlib.annotations.NotNull;
 
 import java.rmi.RemoteException;
 
-public class RemoteLayoutLogAdapter implements ILayoutLog {
+public class RemoteLayoutLogAdapter extends LayoutLog {
     private final RemoteLayoutLog mLog;
 
     public RemoteLayoutLogAdapter(@NotNull RemoteLayoutLog log) {
@@ -66,13 +66,4 @@
             throw new RuntimeException(e);
         }
     }
-
-    @Override
-    public void logAndroidFramework(int priority, String tag, String message) {
-        try {
-            mLog.logAndroidFramework(priority, tag, message);
-        } catch (RemoteException e) {
-            throw new RuntimeException(e);
-        }
-    }
 }
diff --git a/remote/server/src/com/android/layoutlib/bridge/remote/server/adapters/RemoteRenderResourcesAdapter.java b/remote/server/src/com/android/layoutlib/bridge/remote/server/adapters/RemoteRenderResourcesAdapter.java
index 0b9797a..2e19bf7 100644
--- a/remote/server/src/com/android/layoutlib/bridge/remote/server/adapters/RemoteRenderResourcesAdapter.java
+++ b/remote/server/src/com/android/layoutlib/bridge/remote/server/adapters/RemoteRenderResourcesAdapter.java
@@ -16,7 +16,7 @@
 
 package com.android.layoutlib.bridge.remote.server.adapters;
 
-import com.android.ide.common.rendering.api.ILayoutLog;
+import com.android.ide.common.rendering.api.LayoutLog;
 import com.android.ide.common.rendering.api.RenderResources;
 import com.android.ide.common.rendering.api.ResourceReference;
 import com.android.ide.common.rendering.api.ResourceValue;
@@ -37,7 +37,7 @@
     }
 
     @Override
-    public void setLogger(ILayoutLog logger) {
+    public void setLogger(LayoutLog logger) {
         // Ignored for remote operations.
     }
 
diff --git a/rename_font/build_font.py b/rename_font/build_font.py
index db0c98a..a53ebbc 100755
--- a/rename_font/build_font.py
+++ b/rename_font/build_font.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
 
 # Copyright (C) 2014 The Android Open Source Project
 #
@@ -96,7 +96,7 @@
 
 def convert_font(input_path):
   filename = os.path.basename(input_path)
-  print('Converting font: ' + filename)
+  print 'Converting font: ' + filename
   # the path to the output file. The file name is the fontfilename.ttx
   ttx_path = os.path.join(dest_dir, filename)
   ttx_path = ttx_path[:-1] + 'x'
@@ -116,11 +116,11 @@
     ttx.main(ttx_args)
   except InvalidFontException:
     # In case of invalid fonts, we exit.
-    print(filename + ' is not a valid font')
+    print filename + ' is not a valid font'
     raise
   except Exception as e:
-    print('Error converting font: ' + filename)
-    print(e)
+    print 'Error converting font: ' + filename
+    print e
     # Some fonts are too big to be handled by the ttx library.
     # Just copy paste them.
     shutil.copy(input_path, dest_dir)
@@ -136,7 +136,7 @@
       found in the name table of the font. """
   fonts = []
   font = None
-  last_name_id = sys.maxsize
+  last_name_id = sys.maxint
   for namerecord in tag.iter('namerecord'):
     if 'nameID' in namerecord.attrib:
       name_id = int(namerecord.attrib['nameID'])
@@ -164,14 +164,14 @@
 
 
 def update_tag(tag, fonts):
-  last_name_id = sys.maxsize
+  last_name_id = sys.maxint
   fonts_iterator = fonts.__iter__()
   font = None
   for namerecord in tag.iter('namerecord'):
     if 'nameID' in namerecord.attrib:
       name_id = int(namerecord.attrib['nameID'])
       if name_id <= last_name_id:
-        font = next(fonts_iterator)
+        font = fonts_iterator.next()
         font = update_font_name(font)
       last_name_id = name_id
       if name_id == NAMEID_FAMILY:
@@ -192,7 +192,7 @@
     new_family = font.family + font.version
   else:
     new_family = font.family
-  if font.style == 'Regular' and not font.ends_in_regular:
+  if font.style is 'Regular' and not font.ends_in_regular:
     font.fullname = new_family
   else:
     font.fullname = new_family + ' ' + font.style
@@ -205,7 +205,7 @@
       'Regular' for plain fonts. However, some fonts don't obey this rule. We
       keep the style info, to minimize the diff. """
   string = string.strip().split()[-1]
-  return string == 'Regular'
+  return string is 'Regular'
 
 
 def get_version(string):
diff --git a/rename_font/build_font_single.py b/rename_font/build_font_single.py
index b254072..22d7fdf 100755
--- a/rename_font/build_font_single.py
+++ b/rename_font/build_font_single.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
 
 # Copyright (C) 2014 The Android Open Source Project
 #
@@ -71,7 +71,7 @@
 
 def main(argv):
   if len(argv) < 2:
-    print('Incorrect usage: ' + str(argv))
+    print 'Incorrect usage: ' + str(argv)
     sys.exit('Usage: build_font_single.py /path/to/input/font.ttf /path/to/out/font.ttf')
   dest_path = argv[-1]
   input_path = argv[0]
@@ -85,7 +85,7 @@
 
 def convert_font(input_path, dest_path):
   filename = os.path.basename(input_path)
-  print('Converting font: ' + filename)
+  print 'Converting font: ' + filename
   # the path to the output file. The file name is the fontfilename.ttx
   ttx_path = dest_path[:-1] + 'x'
   try:
@@ -104,11 +104,11 @@
     ttx.main(ttx_args)
   except InvalidFontException:
     # assume, like for .ttc and .otf that font might be valid, but warn.
-    print('Family and/or Style nameIDs not found in '+ filename)
+    print 'Family and/or Style nameIDs not found in '+ filename
     shutil.copy(input_path, dest_path)
   except Exception as e:
-    print('Error converting font: ' + filename)
-    print(e)
+    print 'Error converting font: ' + filename
+    print e
     # Some fonts are too big to be handled by the ttx library.
     # Just copy paste them.
     shutil.copy(input_path, dest_path)
@@ -124,7 +124,7 @@
       found in the name table of the font. """
   fonts = []
   font = None
-  last_name_id = sys.maxsize
+  last_name_id = sys.maxint
   for namerecord in tag.iter('namerecord'):
     if 'nameID' in namerecord.attrib:
       name_id = int(namerecord.attrib['nameID'])
@@ -155,7 +155,7 @@
 
 
 def update_tag(tag, fonts):
-  last_name_id = sys.maxsize
+  last_name_id = sys.maxint
   fonts_iterator = fonts.__iter__()
   font = None
   for namerecord in tag.iter('namerecord'):
@@ -165,7 +165,7 @@
       if name_id < NAMEID_LIST_MIN or name_id > NAMEID_LIST_MAX:
         continue
       if name_id <= last_name_id:
-        font = next(fonts_iterator)
+        font = fonts_iterator.next()
         font = update_font_name(font)
       last_name_id = name_id
       if name_id == NAMEID_FAMILY:
@@ -186,7 +186,7 @@
     new_family = font.family + font.version
   else:
     new_family = font.family
-  if font.style == 'Regular' and not font.ends_in_regular:
+  if font.style is 'Regular' and not font.ends_in_regular:
     font.fullname = new_family
   else:
     font.fullname = new_family + ' ' + font.style
@@ -199,7 +199,7 @@
       'Regular' for plain fonts. However, some fonts don't obey this rule. We
       keep the style info, to minimize the diff. """
   string = string.strip().split()[-1]
-  return string == 'Regular'
+  return string is 'Regular'
 
 
 def get_version(string):
diff --git a/rename_font/test.py b/rename_font/test.py
index cf26ee9..2ffddf4 100755
--- a/rename_font/test.py
+++ b/rename_font/test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
 
 """Tests build_font.py by renaming a font.
 
@@ -22,10 +22,10 @@
   def test(self):
     font_name = "Roboto-Regular.ttf"
     srcdir = tempfile.mkdtemp()
-    print("srcdir: " + srcdir)
+    print "srcdir: " + srcdir
     shutil.copy(font_name, srcdir)
     destdir = tempfile.mkdtemp()
-    print("destdir: " + destdir)
+    print "destdir: " + destdir
     self.assertTrue(build_font.main([srcdir, destdir]) is None)
     out_path = os.path.join(destdir, font_name)
     ttx.main([out_path])
diff --git a/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/ErrorCatcher.java b/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/ErrorCatcher.java
new file mode 100644
index 0000000..519b127
--- /dev/null
+++ b/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/ErrorCatcher.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2015 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.idea.editors.theme.widgets;
+
+import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.layoutlib.bridge.Bridge;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * {@link ViewGroup} that wraps another view and catches any possible exceptions that the child view
+ * might generate.
+ * This is used by the theme editor to stop custom views from breaking the preview.
+ */
+// TODO: This view is just a temporary solution that will be replaced by adding a try / catch
+// for custom views in the ClassConverter
+public class ErrorCatcher extends ViewGroup {
+    public ErrorCatcher(Context context) {
+        super(context);
+    }
+
+    public ErrorCatcher(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public ErrorCatcher(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    public ErrorCatcher(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        assert getChildCount() == 1 : "ErrorCatcher can only have one child";
+
+        View child = getChildAt(0);
+        try {
+            measureChild(child, widthMeasureSpec, heightMeasureSpec);
+
+            setMeasuredDimension(resolveSize(child.getMeasuredWidth(), widthMeasureSpec),
+                    resolveSize(child.getMeasuredHeight(), heightMeasureSpec));
+        } catch (Throwable t) {
+            Bridge.getLog().warning(LayoutLog.TAG_BROKEN, "Failed to do onMeasure for view " +
+                    child.getClass().getCanonicalName(), null, t);
+            setMeasuredDimension(resolveSize(0, widthMeasureSpec),
+                    resolveSize(0, heightMeasureSpec));
+        }
+    }
+
+    @Override
+    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
+        try {
+            return super.drawChild(canvas, child, drawingTime);
+        } catch (Throwable t) {
+            Bridge.getLog().warning(LayoutLog.TAG_BROKEN, "Failed to draw for view " +
+                    child.getClass().getCanonicalName(), null, t);
+        }
+
+        return false;
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        assert getChildCount() == 1 : "ErrorCatcher can only have one child";
+
+        View child = getChildAt(0);
+        try {
+            child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight());
+        } catch (Throwable e) {
+            Bridge.getLog().warning(LayoutLog.TAG_BROKEN, "Failed to do onLayout for view " +
+                    child.getClass().getCanonicalName(), null, e);
+        }
+    }
+}
diff --git a/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/PressedButton.java b/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/PressedButton.java
new file mode 100644
index 0000000..4320157
--- /dev/null
+++ b/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/PressedButton.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2015 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.idea.editors.theme.widgets;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.Button;
+
+@SuppressWarnings("unused")
+public class PressedButton extends Button {
+    public PressedButton(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        setPressed(true);
+        jumpDrawablesToCurrentState();
+    }
+}
diff --git a/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/ThemePreviewLayout.java b/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/ThemePreviewLayout.java
new file mode 100644
index 0000000..af89910
--- /dev/null
+++ b/studio-custom-widgets/src/com/android/tools/idea/editors/theme/widgets/ThemePreviewLayout.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2015 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.idea.editors.theme.widgets;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.DisplayMetrics;
+import android.util.TypedValue;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Custom layout used in the theme editor to display the component preview. It arranges the child
+ * Views as a grid of cards.
+ * <p/>
+ * The Views are measured and the maximum width and height are used to dimension all the child
+ * components. Any margin attributes from the children are ignored and only the item_margin element
+ * is used.
+ */
+@SuppressWarnings("unused")
+public class ThemePreviewLayout extends ViewGroup {
+    private final int mMaxColumns;
+    private final int mMaxColumnWidth;
+    private final int mMinColumnWidth;
+    private final int mItemHorizontalMargin;
+    private final int mItemVerticalMargin;
+
+    /** Item width to use for every card component. This includes margins. */
+    private int mItemWidth;
+    /** Item height to use for every card component. This includes margins. */
+    private int mItemHeight;
+
+    /** Calculated number of columns */
+    private int mNumColumns;
+
+    public ThemePreviewLayout(Context context) {
+        this(context, null);
+    }
+
+    public ThemePreviewLayout(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public ThemePreviewLayout(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+
+        if (attrs == null) {
+            mMaxColumnWidth = Integer.MAX_VALUE;
+            mMinColumnWidth = 0;
+            mMaxColumns = Integer.MAX_VALUE;
+            mItemHorizontalMargin = 0;
+            mItemVerticalMargin = 0;
+            return;
+        }
+
+        DisplayMetrics dm = getResources().getDisplayMetrics();
+        int maxColumnWidth = attrs.getAttributeIntValue(null, "max_column_width", Integer
+                .MAX_VALUE);
+        int minColumnWidth = attrs.getAttributeIntValue(null, "min_column_width", 0);
+        int itemHorizontalMargin = attrs.getAttributeIntValue(null, "item_horizontal_margin", 0);
+        int itemVerticalMargin = attrs.getAttributeIntValue(null, "item_vertical_margin", 0);
+
+        mMaxColumnWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+                maxColumnWidth,
+                dm);
+        mMinColumnWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+                minColumnWidth,
+                dm);
+        mItemHorizontalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+                itemHorizontalMargin,
+                dm);
+        mItemVerticalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+                itemVerticalMargin,
+                dm);
+        mMaxColumns = attrs.getAttributeIntValue(null, "max_columns", Integer.MAX_VALUE);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        // Measure the column size.
+        // The column has a minimum width that will be used to calculate the maximum number of
+        // columns that we can fit in the available space.
+        //
+        // Once we have the maximum number of columns, we will span all columns width evenly to fill
+        // all the available space.
+        int wSize = MeasureSpec.getSize(widthMeasureSpec) - mPaddingLeft - mPaddingRight;
+
+        // Calculate the desired width of all columns and take the maximum.
+        // This step can be skipped if we have a fixed column height so we do not have to
+        // dynamically calculate it.
+        int childWidthSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+        int childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+        int itemWidth = 0;
+        int itemHeight = 0;
+        for (int i = 0; i < getChildCount(); i++) {
+            View v = getChildAt(i);
+
+            if (v.getVisibility() == GONE) {
+                continue;
+            }
+
+            measureChild(v, childWidthSpec, childHeightSpec);
+
+            itemWidth = Math.max(itemWidth, v.getMeasuredWidth());
+            itemHeight = Math.max(itemHeight, v.getMeasuredHeight());
+        }
+
+        itemWidth = Math.min(Math.max(itemWidth, mMinColumnWidth), mMaxColumnWidth);
+        mNumColumns = Math.min((int) Math.ceil((double) wSize / itemWidth), mMaxColumns);
+
+        // Check how much space this distribution would take taking into account the margins.
+        // If it's bigger than what we have, remove one column.
+        int wSizeNeeded = mNumColumns * itemWidth + (mNumColumns - 1) * mItemHorizontalMargin;
+        if (wSizeNeeded > wSize && mNumColumns > 1) {
+            mNumColumns--;
+        }
+
+        if (getChildCount() < mNumColumns) {
+            mNumColumns = getChildCount();
+        }
+        if (mNumColumns == 0) {
+            mNumColumns = 1;
+        }
+
+        // Inform each child of the measurement
+        childWidthSpec = MeasureSpec.makeMeasureSpec(itemWidth, MeasureSpec.EXACTLY);
+        childHeightSpec = MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY);
+        for (int i = 0; i < getChildCount(); i++) {
+            View v = getChildAt(i);
+
+            if (v.getVisibility() == GONE) {
+                continue;
+            }
+
+            measureChild(v, childWidthSpec, childHeightSpec);
+        }
+
+        // Calculate the height of the first column to measure our own size
+        int firstColumnItems = getChildCount() / mNumColumns + ((getChildCount() % mNumColumns) > 0
+                ? 1 : 0);
+
+        int horizontalMarginsTotalWidth = (mNumColumns - 1) * mItemHorizontalMargin;
+        int verticalMarginsTotalHeight = (firstColumnItems - 1) * mItemVerticalMargin;
+        int totalWidth = mNumColumns * itemWidth + horizontalMarginsTotalWidth +
+                mPaddingRight + mPaddingLeft;
+        int totalHeight = firstColumnItems * itemHeight + verticalMarginsTotalHeight +
+                mPaddingBottom + mPaddingTop;
+
+        setMeasuredDimension(resolveSize(totalWidth, widthMeasureSpec),
+                resolveSize(totalHeight, heightMeasureSpec));
+
+        mItemWidth = itemWidth;
+        mItemHeight = itemHeight;
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        int itemsPerColumn = getChildCount() / mNumColumns;
+        // The remainder items are distributed one per column.
+        int remainderItems = getChildCount() % mNumColumns;
+
+        int x = mPaddingLeft;
+        int y = mPaddingTop;
+        int position = 1;
+        for (int i = 0; i < getChildCount(); i++) {
+            View v = getChildAt(i);
+            v.layout(x,
+                    y,
+                    x + mItemWidth,
+                    y + mItemHeight);
+
+            if (position == itemsPerColumn + (remainderItems > 0 ? 1 : 0)) {
+                // Break column
+                position = 1;
+                remainderItems--;
+                x += mItemWidth + mItemHorizontalMargin;
+                y = mPaddingTop;
+            } else {
+                position++;
+                y += mItemHeight + mItemVerticalMargin;
+            }
+        }
+    }
+}
+
+
diff --git a/studio-custom-widgets/studio-android-widgets.iml b/studio-custom-widgets/studio-android-widgets.iml
new file mode 100644
index 0000000..b0363d7
--- /dev/null
+++ b/studio-custom-widgets/studio-android-widgets.iml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="layoutlib_api-prebuilt" level="project" />
+    <orderEntry type="library" name="framework.jar" level="project" />
+    <orderEntry type="module" module-name="bridge" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/validator/Android.bp b/validator/Android.bp
index ca68179..0eff99b 100644
--- a/validator/Android.bp
+++ b/validator/Android.bp
@@ -14,10 +14,6 @@
 // limitations under the License.
 //
 
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
 java_library_host {
     name: "layoutlib-validator",
 
@@ -27,7 +23,6 @@
     libs: [
         "tools-common-prebuilt",
         "temp_layoutlib",
-        "layoutlib_api-prebuilt",
         "layoutlib-common",
         "guava",
     ],
diff --git a/validator/resources/strings.properties b/validator/resources/strings.properties
index 7855142..af7d020 100644
--- a/validator/resources/strings.properties
+++ b/validator/resources/strings.properties
@@ -32,15 +32,8 @@
 check_title_text_style = Text Style
 check_title_touch_target_size = Touch target
 check_view_banned_word = Banned word
-checkbox_item_type = checkbox
-checkbox_item_type_separate_words = check box
-checked_state = checked
-click_action = click
 clickable = clickable
 clickable_and_long_clickable = clickable and long clickable
-description_remove_view_attribute = Remove the view attribute <tt>%1$s</tt>.
-description_set_view_attribute = Set the view attribute <tt>%1$s</tt> to <tt>%2$s</tt>.
-description_set_view_attribute_with_an_empty_string = Set the view attribute <tt>%1$s</tt> to a meaningful non-empty string or resource reference.
 italic_text = italic
 italic_underline_text = italic and underline
 long_clickable = long clickable
@@ -81,9 +74,7 @@
 result_message_class_name_not_supported_brief = This item\'s type may not be supported.
 result_message_class_name_not_supported_detail = This item\'s type <tt>%1$s</tt> may not be resolvable by accessibility services. Consider using a type defined by the Android SDK.
 result_message_clickablespan_no_determined_type = This item\'s type is undetermined.
-result_message_content_desc_contains_action = This item\'s <tt>android:contentDescription</tt>, \"<tt>%1$s</tt>\", contains the action \"<tt>%2$s</tt>\".
 result_message_content_desc_contains_redundant_word = This item\'s <tt>android:contentDescription</tt>, \"<tt>%1$s</tt>\" contains the item type \"<tt>%2$s</tt>\".
-result_message_content_desc_contains_state = This item\'s <tt>android:contentDescription</tt>, \"<tt>%1$s</tt>\", contains the state \"<tt>%2$s</tt>\".
 result_message_content_desc_ends_with_view_type = This item\'s <tt>android:contentDescription</tt>, \"<tt>%1$s</tt>\" ends with the item\'s type.
 result_message_could_not_get_background_color = This item\'s background color could not be determined.
 result_message_could_not_get_text_color = This item\'s text color could not be determined.
@@ -130,16 +121,11 @@
 result_message_textview_heuristic_contrast_not_sufficient_confirmed = The item\'s text contrast ratio is %1$.2f. This ratio is based on the provided foreground color of <tt>#%2$06X</tt> and provided background color of <tt>#%3$06X</tt>. Consider using colors that result in a contrast ratio greater than %4$.2f for small text, or %5$.2f for large text.
 result_message_textview_heuristic_customized_contrast_not_sufficient = The item\'s text contrast ratio is %1$.2f. This ratio is based on an estimated foreground color of <tt>#%2$06X</tt> and an estimated background color of <tt>#%3$06X</tt>. Consider increasing this item\'s text contrast ratio to the configured ratio of %4$.2f or greater.
 result_message_textview_heuristic_customized_contrast_not_sufficient_confirmed = The item\'s text contrast ratio is %1$.2f. This ratio is based on the provided foreground color of <tt>#%2$06X</tt> and provided background color of <tt>#%3$06X</tt>. Consider increasing this item\'s text contrast ratio to the configured ratio of %4$.2f or greater.
-result_message_traversal_cycle = This item may be part of a traversal ordering cycle due to its <tt>%1$s</tt> attribute. Traversal behavior with screen readers may be unpredictable.
+result_message_traversal_cycle = This item may be part of a traversal ordering cycle due to its <tt>%1$s</tt> attribute.  Traversal behavior with screen readers may be unpredictable.
 result_message_traversal_over_constrained = Traversal ordering for this item may be over constrained based on its <tt>android:accessibilityTraversalBefore</tt> and <tt>android:accessibilityTraversalAfter</tt> attributes. Traversal behavior with screen readers may be unpredictable.
 result_message_urlspan_invalid_url = Verify that the URL within this item\'s <tt>URLSpan</tt> is valid.
 result_message_urlspan_not_clickablespan = This item should use a <tt>URLSpan</tt> in place of a <tt>ClickableSpan</tt>.
 result_message_view_bounds = This %1$s item also has an on-screen location of <tt>%2$s</tt>.
 result_message_view_not_within_screencapture = This item\'s on-screen location (<tt>%1$s</tt>) were not within the screen capture on-screen location (<tt>%2$s</tt>).
 result_message_web_content = Web content is not evaluated.
-selected_state = selected
-swipe_action = swipe
-tap_action = tap
-unchecked_state = unchecked
 underline_text = underline
-unselected_state = unselected
diff --git a/validator/resources/values.xml b/validator/resources/values.xml
index 55dcf57..ae49a3c 100644
--- a/validator/resources/values.xml
+++ b/validator/resources/values.xml
@@ -33,15 +33,8 @@
     <string description="The title of a check on the styling of text. [CHAR LIMIT=50]" name="check_title_text_style">Text Style</string>
     <string description="The title of a check describing that the size of this clickable view (UI element) is below minimum requirements. [CHAR LIMIT=50]" name="check_title_touch_target_size">Touch target</string>
     <string description="The title of a check used to detect banned words within the text of a view. [CHAR LIMIT=50]" name="check_view_banned_word">Banned word</string>
-    <string description="The term for a UI element that functions as a checkbox, as a single word (ex. &apos;checkbox&apos; instead of &apos;check box&apos; in English). If there isn&apos;t a single word representation in the target language, use multiple words. [CHAR LIMIT=NONE]" name="checkbox_item_type">checkbox</string>
-    <string description="The term for a UI element that functions as a checkbox, as separate words (ex. &apos;check box&apos; instead of &apos;checkbox&apos; in English). If there isn&apos;t a multiple word representation in the target language, use a single word. [CHAR LIMIT=NONE]" name="checkbox_item_type_separate_words">check box</string>
-    <string description="Adjective describing a checkbox that is selected. [CHAR LIMIT=NONE]" name="checked_state">checked</string>
-    <string description="An action in a UI, as in the imperative &apos;click to send&apos;. [CHAR LIMIT=NONE]" name="click_action">click</string>
     <string description="Describes a UI element that is clickable [CHAR LIMIT=NONE]" name="clickable">clickable</string>
     <string description="Describes a UI element that is both clickable and long clickable [CHAR LIMIT=NONE]" name="clickable_and_long_clickable">clickable and long clickable</string>
-    <string description="The description for a fix suggestion which recommends removing a view attribute [CHAR LIMIT=NONE]" name="description_remove_view_attribute" translatable="false">Remove the view attribute &lt;tt><ns1:g example="android:contentDescription" id="view_attribute_fully_qualified_name">%1$s</ns1:g>&lt;/tt>.</string>
-    <string description="The description for a fix suggestion which recommends setting a value to a view attribute [CHAR LIMIT=NONE]" name="description_set_view_attribute" translatable="false">Set the view attribute &lt;tt><ns1:g example="android:contentDescription" id="view_attribute_fully_qualified_name">%1$s</ns1:g>&lt;/tt> to &lt;tt><ns1:g example="#FFFFFF" id="suggested_value">%2$s</ns1:g>&lt;/tt>.</string>
-    <string description="The description for a fix suggestion which recommends asking the developer to set the view attribute to a meaningful non-empty String literal or relevant resource [CHAR LIMIT=NONE]" name="description_set_view_attribute_with_an_empty_string" translatable="false">Set the view attribute &lt;tt><ns1:g example="android:contentDescription" id="view_attribute_fully_qualified_name">%1$s</ns1:g>&lt;/tt> to a meaningful non-empty string or resource reference.</string>
     <string description="Describes italic text styling. [CHAR LIMIT=NONE]" name="italic_text">italic</string>
     <string description="Describes text with both italic and underlined styling. [CHAR LIMIT=NONE]" name="italic_underline_text">italic and underline</string>
     <string description="Describes a UI element that is long clickable [CHAR LIMIT=NONE]" name="long_clickable">long clickable</string>
@@ -71,7 +64,7 @@
     <string description="The brief result message of a check describing that an element is not exposed to accessibility services [CHAR LIMIT=NONE]" name="result_message_brief_is_unexposed_item_screen_region">Consider exposing items in this region to accessibility services.</string>
     <string description="The brief result message of a check describing that link text is not descriptive. [CHAR LIMIT=NONE]" name="result_message_brief_link_text_not_descriptive">Consider using more descriptive text in the link.</string>
     <string description="The brief result message if text has a low readability score. [CHAR LIMIT=NONE]" name="result_message_brief_low_reading_score">This text may have a low readability score.</string>
-    <string description="The brief result message of a check describing that multiple items (UI elements) share the same description that would be spoken by a screen reader. [CHAR LIMIT=NONE]" name="result_message_brief_same_speakable_text">Multiple items have the same description.</string>
+    <string description="The brief result message of a check describing that multiple items (UI elements) share the same description that would be spoken by a screen reader. [CHAR LIMIT=NONE}" name="result_message_brief_same_speakable_text">Multiple items have the same description.</string>
     <string description="The brief result message of a check describing that multiple actionable items (UI elements) share the same space on the screen. [CHAR LIMIT=NONE]" name="result_message_brief_same_view_bounds">Multiple <ns1:g example="clickable and long clickable" id="clickability">%1$s</ns1:g> items share this location on the screen.</string>
     <string description="The brief result message of a check describing that the size of this view (UI element) may be too small to be touched or interacted with reliably. [CHAR LIMIT=NONE]" name="result_message_brief_small_touch_target">Consider making this clickable item larger.</string>
     <string description="The brief message describing that using bold typeface is ideal. [CHAR LIMIT=NONE]" name="result_message_brief_styled_text">Consider removing <ns1:g example="italic" id="style_info">%1$s</ns1:g> styling on longer passages of text.</string>
@@ -82,17 +75,7 @@
     <string description="The result message of a check describing that the class name is not supported by the accessibility service. [CHAR LIMIT=NONE]" name="result_message_class_name_not_supported_brief">This item\'s type may not be supported.</string>
     <string description="The result message of a check describing that the class name is not supported by the accessibility service. [CHAR LIMIT=NONE]" name="result_message_class_name_not_supported_detail">This item\'s type <ns1:g example="com.example.MyButton" id="class_name">&lt;tt>%1$s&lt;/tt></ns1:g> may not be resolvable by accessibility services. Consider using a type defined by the Android SDK.</string>
     <string description="The result message of a check describing the specific android class of the view (UI element) could not be determined. [CHAR LIMIT=NONE]" name="result_message_clickablespan_no_determined_type">This item\'s type is undetermined.</string>
-    <string description="The result message of a check stating that a description of a view (UI element) might specify an available action within its &apos;android:contentDescription&apos; attribute. [CHAR LIMIT=NONE]" name="result_message_content_desc_contains_action">
-    This item\'s <ns1:g example="android:contentDescription" id="content_description_attr">&lt;tt>android:contentDescription&lt;/tt></ns1:g>,
-    \"<ns1:g example="Tap to send" id="content_desc">&lt;tt>%1$s&lt;/tt></ns1:g>\",
-    contains the action \"<ns1:g example="tap" id="item_action">&lt;tt>%2$s&lt;/tt></ns1:g>\".
-  </string>
     <string description="The result message of a check stating that a description of a view (UI element) has redundant or unnecessary text (ex: a view of type Button whose &apos;android:contentDescription&apos; is &apos;Save button&apos;). [CHAR LIMIT=NONE]" name="result_message_content_desc_contains_redundant_word">This item\'s <ns1:g example="android:contentDescription" id="content_description_attr">&lt;tt>android:contentDescription&lt;/tt></ns1:g>, \"<ns1:g example="Save button" id="content_desc">&lt;tt>%1$s&lt;/tt></ns1:g>\" contains the item type \"<ns1:g example="button" id="item_type">&lt;tt>%2$s&lt;/tt></ns1:g>\".</string>
-    <string description="The result message of a check stating that a description of a view (UI element) might specify an element state within its &apos;android:contentDescription&apos; attribute. [CHAR LIMIT=NONE]" name="result_message_content_desc_contains_state">
-    This item\'s <ns1:g example="android:contentDescription" id="content_description_attr">&lt;tt>android:contentDescription&lt;/tt></ns1:g>,
-    \"<ns1:g example="Rush delivery selected" id="content_desc">&lt;tt>%1$s&lt;/tt></ns1:g>\",
-    contains the state \"<ns1:g example="selected" id="item_state">&lt;tt>%2$s&lt;/tt></ns1:g>\".
-  </string>
     <string description="The result message of a check stating that a description of a view (UI element) ends with that view&apos;s type (ex: a view of type Button whose &apos;android:contentDescription&apos; is &apos;Save button&apos;). [CHAR LIMIT=NONE]" name="result_message_content_desc_ends_with_view_type">This item\'s <ns1:g example="android:contentDescription" id="content_description_attr">&lt;tt>android:contentDescription&lt;/tt></ns1:g>, \"<ns1:g example="Save button" id="content_desc">&lt;tt>%1$s&lt;/tt></ns1:g>\" ends with the item\'s type.</string>
     <string description="The result message of a check describing that the background color of a view (UI element) could not be determined. [CHAR LIMIT=NONE]" name="result_message_could_not_get_background_color">This item\'s background color could not be determined.</string>
     <string description="The result message of a check describing that the color of the text within a view (UI element) could not be determined. [CHAR LIMIT=NONE]" name="result_message_could_not_get_text_color">This item\'s text color could not be determined.</string>
@@ -143,13 +126,8 @@
     <string description="The result message of a check describing that this view (UI element) may be presented incorrectly to the user when traversed with a screen reader. [CHAR LIMIT=NONE]" name="result_message_traversal_over_constrained">Traversal ordering for this item may be over constrained based on its <ns1:g example="android:accessibilityTraversalBefore" id="traversal_before_attr">&lt;tt>android:accessibilityTraversalBefore&lt;/tt></ns1:g> and <ns1:g example="android:accessibilityTraversalAfter" id="traversal_after_attr">&lt;tt>android:accessibilityTraversalAfter&lt;/tt></ns1:g> attributes. Traversal behavior with screen readers may be unpredictable.</string>
     <string description="The result message of a check describing that the view has text marked up with an android URLSpan (a hyperlink), which has an invalid URL. [CHAR LIMIT=NONE]" name="result_message_urlspan_invalid_url">Verify that the URL within this item\'s <ns1:g example="URLSpan" id="url_span_class">&lt;tt>URLSpan&lt;/tt></ns1:g> is valid.</string>
     <string description="The result message of a check describing that views should use the android concept of a &apos;URLSpan&apos; instead of a &apos;ClickableSpan&apos;, for improved accessibility. [CHAR LIMIT=NONE]" name="result_message_urlspan_not_clickablespan">This item should use a <ns1:g example="URLSpan" id="url_span_class">&lt;tt>URLSpan&lt;/tt></ns1:g> in place of a <ns1:g example="ClickableSpan" id="clickable_span_class">&lt;tt>ClickableSpan&lt;/tt></ns1:g>.</string>
-    <string description="The result message of a check describing the position of this view (UI element) on the screen. [CHAR LIMIT=NONE]" name="result_message_view_bounds">This <ns1:g example="clickable and long clickable" id="clickability">%1$s</ns1:g> item also has an on-screen location of <ns1:g example="[0,0][100,100]" id="view_bounds">&lt;tt>%2$s&lt;/tt></ns1:g>.</string>
+    <string description="The result message of a check describing the position of this view (UI element) on the screen." name="result_message_view_bounds">This <ns1:g example="clickable and long clickable" id="clickability">%1$s</ns1:g> item also has an on-screen location of <ns1:g example="[0,0][100,100]" id="view_bounds">&lt;tt>%2$s&lt;/tt></ns1:g>.</string>
     <string description="The result message of a check describing that all or part of the view (UI element) was off the screen when the screenshot was taken. [CHAR LIMIT=NONE]" name="result_message_view_not_within_screencapture">This item\'s on-screen location (<ns1:g example="[0,0][100,100]" id="view_bounds">&lt;tt>%1$s&lt;/tt></ns1:g>) were not within the screen capture on-screen location (<ns1:g example="[0,0][1920,1080]" id="capture_bounds">&lt;tt>%2$s&lt;/tt></ns1:g>).</string>
     <string description="The result message of a check describing that web content (UI element shown within a browser) was not evaluated. [CHAR LIMIT=NONE]" name="result_message_web_content">Web content is not evaluated.</string>
-    <string description="Adjective describing a view that is selected. [CHAR LIMIT=NONE]" name="selected_state">selected</string>
-    <string description="An action in a UI, as in the imperative &apos;swipe to unlock&apos;. [CHAR LIMIT=NONE]" name="swipe_action">swipe</string>
-    <string description="An action in a UI, as in the imperative &apos;tap to select&apos;. [CHAR LIMIT=NONE]" name="tap_action">tap</string>
-    <string description="Adjective describing a checkbox that is not selected. [CHAR LIMIT=NONE]" name="unchecked_state">unchecked</string>
     <string description="Describes underlined text styling. [CHAR LIMIT=NONE]" name="underline_text">underline</string>
-    <string description="Adjective describing a view that is not selected. [CHAR LIMIT=NONE]" name="unselected_state">unselected</string>
 </resources>
\ No newline at end of file
diff --git a/validator/src/ResourceConverter.java b/validator/src/ResourceConverter.java
index 6b9d73e..18ffda8 100644
--- a/validator/src/ResourceConverter.java
+++ b/validator/src/ResourceConverter.java
@@ -102,19 +102,13 @@
              */
             for (int j = 0; j < node.getChildNodes().getLength(); j++) {
                 Node child = node.getChildNodes().item(j);
-                String toAdd = null;
                 if ("ns1:g".equals(child.getNodeName())) {
-                    toAdd = child.getFirstChild().getNodeValue();
+                    valueBuilder.append(child.getFirstChild().getNodeValue());
                 } else {
-                    toAdd = child.getNodeValue();
+                    valueBuilder.append(child.getNodeValue());
                 }
-                // Replace all tab, newline and multi indentations.
-                toAdd = toAdd.replaceAll("[\n\t]", "");
-                toAdd = toAdd.replaceAll("[ ]+", " ");
-                valueBuilder.append(toAdd);
             }
-            String finalString = valueBuilder.toString().trim();
-            toReturn.put(name, finalString);
+            toReturn.put(name, valueBuilder.toString());
         }
         return toReturn;
     }
diff --git a/validator/src/com/android/tools/idea/validator/ValidatorData.java b/validator/src/com/android/tools/idea/validator/ValidatorData.java
index 49f0e30..6d9d6b6 100644
--- a/validator/src/com/android/tools/idea/validator/ValidatorData.java
+++ b/validator/src/com/android/tools/idea/validator/ValidatorData.java
@@ -79,8 +79,6 @@
      */
     public static class Issue {
         @NotNull
-        public final String mCategory;
-        @NotNull
         public final Type mType;
         @NotNull
         public final String mMsg;
@@ -96,7 +94,6 @@
         public final String mHelpfulUrl;
 
         private Issue(
-                @NotNull String category,
                 @NotNull Type type,
                 @NotNull String msg,
                 @NotNull Level level,
@@ -104,7 +101,6 @@
                 @Nullable Fix fix,
                 @NotNull String sourceClass,
                 @Nullable String helpfulUrl) {
-            mCategory = category;
             mType = type;
             mMsg = msg;
             mLevel = level;
@@ -115,7 +111,6 @@
         }
 
         public static class IssueBuilder {
-            private String mCategory;
             private Type mType = Type.ACCESSIBILITY;
             private String mMsg;
             private Level mLevel;
@@ -124,11 +119,6 @@
             private String mSourceClass;
             private String mHelpfulUrl;
 
-            public IssueBuilder setCategory(String category) {
-                mCategory = category;
-                return this;
-            }
-
             public IssueBuilder setType(Type type) {
                 mType = type;
                 return this;
@@ -165,19 +155,11 @@
             }
 
             public Issue build() {
-                assert(mCategory != null);
                 assert(mType != null);
                 assert(mMsg != null);
                 assert(mLevel != null);
                 assert(mSourceClass != null);
-                return new Issue(mCategory,
-                        mType,
-                        mMsg,
-                        mLevel,
-                        mSrcId,
-                        mFix,
-                        mSourceClass,
-                        mHelpfulUrl);
+                return new Issue(mType, mMsg, mLevel, mSrcId, mFix, mSourceClass, mHelpfulUrl);
             }
         }
     }
diff --git a/validator/src/com/android/tools/idea/validator/accessibility/AccessibilityValidator.java b/validator/src/com/android/tools/idea/validator/accessibility/AccessibilityValidator.java
index 859e5bc..a2ec2c4 100644
--- a/validator/src/com/android/tools/idea/validator/accessibility/AccessibilityValidator.java
+++ b/validator/src/com/android/tools/idea/validator/accessibility/AccessibilityValidator.java
@@ -95,8 +95,6 @@
                 policy.mChecks);
 
         for (AccessibilityHierarchyCheckResult result : results) {
-            String category = getCheckClassCategory(result.getSourceCheckClass());
-
             ValidatorData.Level level = convertLevel(result.getType());
             if (!filter.contains(level)) {
                 continue;
@@ -104,7 +102,6 @@
 
             try {
                 IssueBuilder issueBuilder = new IssueBuilder()
-                        .setCategory(category)
                         .setMsg(result.getMessage(Locale.ENGLISH).toString())
                         .setLevel(level)
                         .setFix(generateFix(result))
@@ -122,7 +119,6 @@
                 builder.mIssues.add(issueBuilder.build());
             } catch (Exception e) {
                 builder.mIssues.add(new IssueBuilder()
-                        .setCategory(category)
                         .setType(Type.INTERNAL_ERROR)
                         .setMsg(e.getMessage())
                         .setLevel(Level.ERROR)
@@ -134,19 +130,6 @@
     }
 
     @NotNull
-    private static String getCheckClassCategory(@NotNull Class<?> checkClass) {
-        try {
-            Class<? extends AccessibilityHierarchyCheck> subClass =
-                    checkClass.asSubclass(AccessibilityHierarchyCheck.class);
-            AccessibilityHierarchyCheck check =
-                    AccessibilityCheckPreset.getHierarchyCheckForClass(subClass);
-            return (check == null) ? "Accessibility" : check.getCategory().name();
-        } catch (ClassCastException e) {
-            return "Accessibility";
-        }
-    }
-
-    @NotNull
     private static ValidatorData.Level convertLevel(@NotNull AccessibilityCheckResultType type) {
         switch (type) {
             case ERROR:
diff --git a/validator/src/com/google/android/apps/common/testing/accessibility/framework/uielement/AccessibilityHierarchyAndroid_ViewElementClassNamesAndroid_Delegate.java b/validator/src/com/google/android/apps/common/testing/accessibility/framework/uielement/AccessibilityHierarchyAndroid_ViewElementClassNamesAndroid_Delegate.java
deleted file mode 100644
index 025bd77..0000000
--- a/validator/src/com/google/android/apps/common/testing/accessibility/framework/uielement/AccessibilityHierarchyAndroid_ViewElementClassNamesAndroid_Delegate.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2020 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.google.android.apps.common.testing.accessibility.framework.uielement;
-
-import com.android.ide.common.rendering.api.LayoutlibCallback;
-import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
-
-public class AccessibilityHierarchyAndroid_ViewElementClassNamesAndroid_Delegate {
-
-    public static LayoutlibCallback sLayoutlibCallback;
-
-    @LayoutlibDelegate
-    public static Class<?> getClassByName(ViewHierarchyElementAndroid view, String className) {
-        Class toReturn = AccessibilityHierarchyAndroid
-                .ViewElementClassNamesAndroid.getClassByName_Original(view, className);
-        if (toReturn == null && sLayoutlibCallback != null) {
-            try {
-                return sLayoutlibCallback.findClass(className);
-            } catch (ClassNotFoundException ignore) {
-            }
-        }
-
-        return toReturn;
-    }
-}
diff --git a/validator/validator.iml b/validator/validator.iml
index 6d92c11..f580aa3 100644
--- a/validator/validator.iml
+++ b/validator/validator.iml
@@ -41,6 +41,5 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntry type="library" name="layoutlib_api-prebuilt" level="project" />
   </component>
 </module>
\ No newline at end of file