Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; import static android.os._Original_Build.VERSION_CODES.JELLY_BEAN_MR1; import static com.android.layoutlib.bridge.android.RenderParamsFlags.FLAG_KEY_APPLICATION_PACKAGE; /** Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,13 @@ package com.android.layoutlib.bridge.bars; import android.os.Build.VERSION_CODES; import android.os._Original_Build.VERSION_CODES; import java.util.ArrayList; import java.util.Collections; import java.util.List; import static android.os.Build.VERSION_CODES.*; import static android.os._Original_Build.VERSION_CODES.*; /** * Various helper methods to simulate older versions of platform. Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ import android.widget.TextView; import java.io.IOException; import java.io.InputStream; import static android.os.Build.VERSION_CODES.LOLLIPOP; import static android.os._Original_Build.VERSION_CODES.LOLLIPOP; /** * Base "bar" class for the window decor around the the edited layout. Loading tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java +9 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import java.util.TreeMap; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Class that generates a new JAR from a list of classes, some of which are to be kept as-is Loading Loading @@ -127,7 +128,10 @@ public class AsmGenerator { // Create the map of classes to rename. mRenameClasses = new HashMap<>(); mClassesNotRenamed = new HashSet<>(); String[] renameClasses = createInfo.getRenamedClasses(); String[] renameClasses = Stream.concat( Arrays.stream(createInfo.getRenamedClasses()), Arrays.stream(createInfo.getRefactoredClasses())) .toArray(String[]::new); int n = renameClasses.length; for (int i = 0; i < n; i += 2) { assert i + 1 < n; Loading @@ -140,7 +144,10 @@ public class AsmGenerator { // Create a map of classes to be refactored. mRefactorClasses = new HashMap<>(); String[] refactorClasses = createInfo.getJavaPkgClasses(); String[] refactorClasses = Stream.concat( Arrays.stream(createInfo.getJavaPkgClasses()), Arrays.stream(createInfo.getRefactoredClasses())) .toArray(String[]::new); n = refactorClasses.length; for (int i = 0; i < n; i += 2) { assert i + 1 < n; Loading tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +18 −30 Original line number Diff line number Diff line Loading @@ -36,65 +36,41 @@ import java.util.Set; */ public final class CreateInfo implements ICreateInfo { /** * Returns the list of class from layoutlib_create to inject in layoutlib. * The list can be empty but must not be null. */ @Override public Class<?>[] getInjectedClasses() { return INJECTED_CLASSES; } /** * Returns the list of methods to rewrite as delegates. * The list can be empty but must not be null. */ @Override public String[] getDelegateMethods() { return DELEGATE_METHODS; } /** * Returns the list of classes on which to delegate all native methods. * The list can be empty but must not be null. */ @Override public String[] getDelegateClassNatives() { return DELEGATE_CLASS_NATIVES; } /** * Returns the list of classes to rename, must be an even list: the binary FQCN * of class to replace followed by the new FQCN. * The list can be empty but must not be null. */ @Override public String[] getRenamedClasses() { return RENAMED_CLASSES; } /** * Returns the list of classes for which the methods returning them should be deleted. * The array contains a list of null terminated section starting with the name of the class * to rename in which the methods are deleted, followed by a list of return types identifying * the methods to delete. * The list can be empty but must not be null. */ @Override public String[] getDeleteReturns() { return DELETE_RETURNS; } /** * Returns the list of classes to refactor, must be an even list: the binary FQCN of class to * replace followed by the new FQCN. All references to the old class should be updated to the * new class. The list can be empty but must not be null. */ @Override public String[] getJavaPkgClasses() { return JAVA_PKG_CLASSES; } @Override public String[] getRefactoredClasses() { return REFACTOR_CLASSES; } @Override public Set<String> getExcludedClasses() { String[] refactoredClasses = getJavaPkgClasses(); Loading Loading @@ -333,10 +309,22 @@ public final class CreateInfo implements ICreateInfo { "java.text.SimpleDateFormat", "android.icu.text.SimpleDateFormat", }; /** * List of classes to refactor. This is similar to combining {@link #getRenamedClasses()} and * {@link #getJavaPkgClasses()}. * Classes included here will be renamed and then all their references in any other classes * will be also modified. * FQCN of class to refactor followed by its new FQCN. */ private final static String[] REFACTOR_CLASSES = new String[] { "android.os.Build", "android.os._Original_Build", }; private final static String[] EXCLUDED_CLASSES = new String[] { "android.preference.PreferenceActivity", "org.kxml2.io.KXmlParser" "org.kxml2.io.KXmlParser", }; /** Loading Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; import static android.os._Original_Build.VERSION_CODES.JELLY_BEAN_MR1; import static com.android.layoutlib.bridge.android.RenderParamsFlags.FLAG_KEY_APPLICATION_PACKAGE; /** Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,13 +16,13 @@ package com.android.layoutlib.bridge.bars; import android.os.Build.VERSION_CODES; import android.os._Original_Build.VERSION_CODES; import java.util.ArrayList; import java.util.Collections; import java.util.List; import static android.os.Build.VERSION_CODES.*; import static android.os._Original_Build.VERSION_CODES.*; /** * Various helper methods to simulate older versions of platform. Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ import android.widget.TextView; import java.io.IOException; import java.io.InputStream; import static android.os.Build.VERSION_CODES.LOLLIPOP; import static android.os._Original_Build.VERSION_CODES.LOLLIPOP; /** * Base "bar" class for the window decor around the the edited layout. Loading
tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java +9 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import java.util.TreeMap; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Class that generates a new JAR from a list of classes, some of which are to be kept as-is Loading Loading @@ -127,7 +128,10 @@ public class AsmGenerator { // Create the map of classes to rename. mRenameClasses = new HashMap<>(); mClassesNotRenamed = new HashSet<>(); String[] renameClasses = createInfo.getRenamedClasses(); String[] renameClasses = Stream.concat( Arrays.stream(createInfo.getRenamedClasses()), Arrays.stream(createInfo.getRefactoredClasses())) .toArray(String[]::new); int n = renameClasses.length; for (int i = 0; i < n; i += 2) { assert i + 1 < n; Loading @@ -140,7 +144,10 @@ public class AsmGenerator { // Create a map of classes to be refactored. mRefactorClasses = new HashMap<>(); String[] refactorClasses = createInfo.getJavaPkgClasses(); String[] refactorClasses = Stream.concat( Arrays.stream(createInfo.getJavaPkgClasses()), Arrays.stream(createInfo.getRefactoredClasses())) .toArray(String[]::new); n = refactorClasses.length; for (int i = 0; i < n; i += 2) { assert i + 1 < n; Loading
tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +18 −30 Original line number Diff line number Diff line Loading @@ -36,65 +36,41 @@ import java.util.Set; */ public final class CreateInfo implements ICreateInfo { /** * Returns the list of class from layoutlib_create to inject in layoutlib. * The list can be empty but must not be null. */ @Override public Class<?>[] getInjectedClasses() { return INJECTED_CLASSES; } /** * Returns the list of methods to rewrite as delegates. * The list can be empty but must not be null. */ @Override public String[] getDelegateMethods() { return DELEGATE_METHODS; } /** * Returns the list of classes on which to delegate all native methods. * The list can be empty but must not be null. */ @Override public String[] getDelegateClassNatives() { return DELEGATE_CLASS_NATIVES; } /** * Returns the list of classes to rename, must be an even list: the binary FQCN * of class to replace followed by the new FQCN. * The list can be empty but must not be null. */ @Override public String[] getRenamedClasses() { return RENAMED_CLASSES; } /** * Returns the list of classes for which the methods returning them should be deleted. * The array contains a list of null terminated section starting with the name of the class * to rename in which the methods are deleted, followed by a list of return types identifying * the methods to delete. * The list can be empty but must not be null. */ @Override public String[] getDeleteReturns() { return DELETE_RETURNS; } /** * Returns the list of classes to refactor, must be an even list: the binary FQCN of class to * replace followed by the new FQCN. All references to the old class should be updated to the * new class. The list can be empty but must not be null. */ @Override public String[] getJavaPkgClasses() { return JAVA_PKG_CLASSES; } @Override public String[] getRefactoredClasses() { return REFACTOR_CLASSES; } @Override public Set<String> getExcludedClasses() { String[] refactoredClasses = getJavaPkgClasses(); Loading Loading @@ -333,10 +309,22 @@ public final class CreateInfo implements ICreateInfo { "java.text.SimpleDateFormat", "android.icu.text.SimpleDateFormat", }; /** * List of classes to refactor. This is similar to combining {@link #getRenamedClasses()} and * {@link #getJavaPkgClasses()}. * Classes included here will be renamed and then all their references in any other classes * will be also modified. * FQCN of class to refactor followed by its new FQCN. */ private final static String[] REFACTOR_CLASSES = new String[] { "android.os.Build", "android.os._Original_Build", }; private final static String[] EXCLUDED_CLASSES = new String[] { "android.preference.PreferenceActivity", "org.kxml2.io.KXmlParser" "org.kxml2.io.KXmlParser", }; /** Loading