summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 14:04:24 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 14:04:24 -0800
commit076357b8567458d4b6dfdcf839ef751634cd2bfb (patch)
treeefbb2fd6f1dc67d2d606382fc3b82983e7cb2e1f /tools
parent3dec7d563a2f3e1eb967ce2054a00b6620e3558c (diff)
downloadframeworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.zip
frameworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.tar.gz
frameworks_base-076357b8567458d4b6dfdcf839ef751634cd2bfb.tar.bz2
auto import from //depot/cupcake/@132589
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt/Images.cpp8
-rw-r--r--tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java57
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java42
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java21
-rw-r--r--tools/preload/Android.mk14
5 files changed, 22 insertions, 120 deletions
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index edb12ea..4c776fb 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -859,14 +859,6 @@ static void write_png(const char* imageName,
analyze_image(imageName, imageInfo, grayscaleTolerance, rgbPalette, alphaPalette,
&paletteEntries, &hasTransparency, &color_type, outRows);
-
- // If the image is a 9-patch, we need to preserve it as a ARGB file to make
- // sure the pixels will not be pre-dithered/clamped until we decide they are
- if (imageInfo.is9Patch && (color_type == PNG_COLOR_TYPE_RGB ||
- color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_PALETTE)) {
- color_type = PNG_COLOR_TYPE_RGB_ALPHA;
- }
-
switch (color_type) {
case PNG_COLOR_TYPE_PALETTE:
NOISY(printf("Image %s has %d colors%s, using PNG_COLOR_TYPE_PALETTE\n",
diff --git a/tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java b/tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java
index df1876d..0810d29 100644
--- a/tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java
+++ b/tools/layoutlib/api/src/com/android/layoutlib/api/ILayoutBridge.java
@@ -24,35 +24,28 @@ import java.util.Map;
* <p/>
* <p/>{@link #getApiLevel()} gives the ability to know which methods are available.
* <p/>
- * Changes in API level 3:
- * <ul>
- * <li>{@link #computeLayout(IXmlPullParser, Object, int, int, int, float, float, String, boolean, Map, Map, IProjectCallback, ILayoutLog)}</li>
- * <li> deprecated {@link #computeLayout(IXmlPullParser, Object, int, int, String, boolean, Map, Map, IProjectCallback, ILayoutLog)}</li>
- * </ul>
* Changes in API level 2:
* <ul>
* <li>{@link #getApiLevel()}</li>
- * <li>{@link #computeLayout(IXmlPullParser, Object, int, int, String, boolean, Map, Map, IProjectCallback, ILayoutLog)}</li>
- * <li>deprecated {@link #computeLayout(IXmlPullParser, Object, int, int, String, Map, Map, IProjectCallback, ILayoutLog)}</li>
+ * <li>{@link #computeLayout(IXmlPullParser, Object, int, int, String, boolean, Map, Map, IProjectCallback, ILayoutLog)},
+ * deprecated {@link #computeLayout(IXmlPullParser, Object, int, int, String, Map, Map, IProjectCallback, ILayoutLog)}.</li>
* </ul>
*/
public interface ILayoutBridge {
- final int API_CURRENT = 3;
+ final int API_CURRENT = 2;
/**
* Returns the API level of the layout library.
* While no methods will ever be removed, some may become deprecated, and some new ones
* will appear.
- * <p/>If calling this method throws an {@link AbstractMethodError}, then the API level
- * should be considered to be 1.
*/
int getApiLevel();
/**
* Initializes the Bridge object.
* @param fontOsLocation the location of the fonts.
- * @param enumValueMap map attrName => { map enumFlagName => Integer value }.
+ * @param enumValueMap map attrName => { map enumFlagName => Integer value }.
* @return true if success.
* @since 1
*/
@@ -63,42 +56,8 @@ public interface ILayoutBridge {
* @param layoutDescription the {@link IXmlPullParser} letting the LayoutLib Bridge visit the
* layout file.
* @param projectKey An Object identifying the project. This is used for the cache mechanism.
- * @param screenWidth the screen width
- * @param screenHeight the screen height
- * @param density the density factor for the screen.
- * @param xdpi the screen actual dpi in X
- * @param ydpi the screen actual dpi in Y
- * @param themeName The name of the theme to use.
- * @param isProjectTheme true if the theme is a project theme, false if it is a framework theme.
- * @param projectResources the resources of the project. The map contains (String, map) pairs
- * where the string is the type of the resource reference used in the layout file, and the
- * map contains (String, {@link IResourceValue}) pairs where the key is the resource name,
- * and the value is the resource value.
- * @param frameworkResources the framework resources. The map contains (String, map) pairs
- * where the string is the type of the resource reference used in the layout file, and the map
- * contains (String, {@link IResourceValue}) pairs where the key is the resource name, and the
- * value is the resource value.
- * @param projectCallback The {@link IProjectCallback} object to get information from
- * the project.
- * @param logger the object responsible for displaying warning/errors to the user.
- * @return an {@link ILayoutResult} object that contains the result of the layout.
- * @since 3
- */
- ILayoutResult computeLayout(IXmlPullParser layoutDescription,
- Object projectKey,
- int screenWidth, int screenHeight, int density, float xdpi, float ydpi,
- String themeName, boolean isProjectTheme,
- Map<String, Map<String, IResourceValue>> projectResources,
- Map<String, Map<String, IResourceValue>> frameworkResources,
- IProjectCallback projectCallback, ILayoutLog logger);
-
- /**
- * Computes and renders a layout
- * @param layoutDescription the {@link IXmlPullParser} letting the LayoutLib Bridge visit the
- * layout file.
- * @param projectKey An Object identifying the project. This is used for the cache mechanism.
- * @param screenWidth the screen width
- * @param screenHeight the screen height
+ * @param screenWidth
+ * @param screenHeight
* @param themeName The name of the theme to use.
* @param isProjectTheme true if the theme is a project theme, false if it is a framework theme.
* @param projectResources the resources of the project. The map contains (String, map) pairs
@@ -113,10 +72,8 @@ public interface ILayoutBridge {
* the project.
* @param logger the object responsible for displaying warning/errors to the user.
* @return an {@link ILayoutResult} object that contains the result of the layout.
- * @deprecated Use {@link #computeLayout(IXmlPullParser, Object, int, int, int, float, float, String, boolean, Map, Map, IProjectCallback, ILayoutLog)}
* @since 2
*/
- @Deprecated
ILayoutResult computeLayout(IXmlPullParser layoutDescription,
Object projectKey,
int screenWidth, int screenHeight, String themeName, boolean isProjectTheme,
@@ -145,7 +102,7 @@ public interface ILayoutBridge {
* the project.
* @param logger the object responsible for displaying warning/errors to the user.
* @return an {@link ILayoutResult} object that contains the result of the layout.
- * @deprecated Use {@link #computeLayout(IXmlPullParser, Object, int, int, int, float, float, String, boolean, Map, Map, IProjectCallback, ILayoutLog)}
+ * @deprecated Use {@link #computeLayout(IXmlPullParser, Object, int, int, String, boolean, Map, Map, IProjectCallback, ILayoutLog)}.
* @since 1
*/
@Deprecated
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index 6abc452d..82fe365 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -40,7 +40,6 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
-import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.BridgeInflater;
import android.view.IWindow;
@@ -73,8 +72,6 @@ public final class Bridge implements ILayoutBridge {
private static final int DEFAULT_STATUS_BAR_HEIGHT = 25;
public static class StaticMethodNotImplementedException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
public StaticMethodNotImplementedException(String msg) {
super(msg);
}
@@ -280,40 +277,20 @@ public final class Bridge implements ILayoutBridge {
isProjectTheme = true;
}
- return computeLayout(layoutDescription, projectKey,
- screenWidth, screenHeight, DisplayMetrics.DEFAULT_DENSITY,
- DisplayMetrics.DEFAULT_DENSITY, DisplayMetrics.DEFAULT_DENSITY,
- themeName, isProjectTheme,
+ return computeLayout(layoutDescription, projectKey, screenWidth, screenHeight, themeName, isProjectTheme,
projectResources, frameworkResources, customViewLoader, logger);
}
/*
- * For compatilibty purposes, we implement the old deprecated version of computeLayout.
* (non-Javadoc)
* @see com.android.layoutlib.api.ILayoutBridge#computeLayout(com.android.layoutlib.api.IXmlPullParser, java.lang.Object, int, int, java.lang.String, boolean, java.util.Map, java.util.Map, com.android.layoutlib.api.IProjectCallback, com.android.layoutlib.api.ILayoutLog)
*/
- public ILayoutResult computeLayout(IXmlPullParser layoutDescription, Object projectKey,
+ public ILayoutResult computeLayout(IXmlPullParser layoutDescription,
+ Object projectKey,
int screenWidth, int screenHeight, String themeName, boolean isProjectTheme,
Map<String, Map<String, IResourceValue>> projectResources,
Map<String, Map<String, IResourceValue>> frameworkResources,
IProjectCallback customViewLoader, ILayoutLog logger) {
- return computeLayout(layoutDescription, projectKey,
- screenWidth, screenHeight, DisplayMetrics.DEFAULT_DENSITY,
- DisplayMetrics.DEFAULT_DENSITY, DisplayMetrics.DEFAULT_DENSITY,
- themeName, isProjectTheme,
- projectResources, frameworkResources, customViewLoader, logger);
- }
-
- /*
- * (non-Javadoc)
- * @see com.android.layoutlib.api.ILayoutBridge#computeLayout(com.android.layoutlib.api.IXmlPullParser, java.lang.Object, int, int, int, float, float, java.lang.String, boolean, java.util.Map, java.util.Map, com.android.layoutlib.api.IProjectCallback, com.android.layoutlib.api.ILayoutLog)
- */
- public ILayoutResult computeLayout(IXmlPullParser layoutDescription, Object projectKey,
- int screenWidth, int screenHeight, int density, float xdpi, float ydpi,
- String themeName, boolean isProjectTheme,
- Map<String, Map<String, IResourceValue>> projectResources,
- Map<String, Map<String, IResourceValue>> frameworkResources,
- IProjectCallback customViewLoader, ILayoutLog logger) {
if (logger == null) {
logger = sDefaultLogger;
}
@@ -321,7 +298,7 @@ public final class Bridge implements ILayoutBridge {
synchronized (sDefaultLogger) {
sLogger = logger;
}
-
+
// find the current theme and compute the style inheritance map
Map<IStyleResourceValue, IStyleResourceValue> styleParentMap =
new HashMap<IStyleResourceValue, IStyleResourceValue>();
@@ -332,16 +309,7 @@ public final class Bridge implements ILayoutBridge {
BridgeContext context = null;
try {
- // setup the display Metrics.
- DisplayMetrics metrics = new DisplayMetrics();
- metrics.density = density / (float) DisplayMetrics.DEFAULT_DENSITY;
- metrics.scaledDensity = metrics.density;
- metrics.widthPixels = screenWidth;
- metrics.heightPixels = screenHeight;
- metrics.xdpi = xdpi;
- metrics.ydpi = ydpi;
-
- context = new BridgeContext(projectKey, metrics, currentTheme, projectResources,
+ context = new BridgeContext(projectKey, currentTheme, projectResources,
frameworkResources, styleParentMap, customViewLoader, logger);
BridgeInflater inflater = new BridgeInflater(context, customViewLoader);
context.setBridgeInflater(inflater);
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java
index baa3d53..0df20e4 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java
@@ -87,21 +87,14 @@ public final class BridgeContext extends Context {
private BridgeContentResolver mContentResolver;
/**
- * @param projectKey An Object identifying the project. This is used for the cache mechanism.
- * @param metrics the {@link DisplayMetrics}.
- * @param themeName The name of the theme to use.
- * @param projectResources the resources of the project. The map contains (String, map) pairs
- * where the string is the type of the resource reference used in the layout file, and the
- * map contains (String, {@link IResourceValue}) pairs where the key is the resource name,
- * and the value is the resource value.
- * @param frameworkResources the framework resources. The map contains (String, map) pairs
- * where the string is the type of the resource reference used in the layout file, and the map
- * contains (String, {@link IResourceValue}) pairs where the key is the resource name, and the
- * value is the resource value.
+ * @param projectKey
+ * @param currentTheme
+ * @param projectResources
+ * @param frameworkResources
* @param styleInheritanceMap
* @param customViewLoader
*/
- public BridgeContext(Object projectKey, DisplayMetrics metrics,
+ public BridgeContext(Object projectKey,
IStyleResourceValue currentTheme,
Map<String, Map<String, IResourceValue>> projectResources,
Map<String, Map<String, IResourceValue>> frameworkResources,
@@ -112,6 +105,10 @@ public final class BridgeContext extends Context {
mLogger = logger;
Configuration config = new Configuration();
+ DisplayMetrics metrics = new DisplayMetrics();
+ metrics.setToDefaults();
+
+
AssetManager assetManager = BridgeAssetManager.initSystem();
mResources = BridgeResources.initSystem(
this,
diff --git a/tools/preload/Android.mk b/tools/preload/Android.mk
index e6fa103..d3457fe 100644
--- a/tools/preload/Android.mk
+++ b/tools/preload/Android.mk
@@ -2,19 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
- ClassRank.java \
- Compile.java \
- LoadedClass.java \
- MemoryUsage.java \
- Operation.java \
- Policy.java \
- PrintCsv.java \
- PrintPsTree.java \
- Proc.java \
- Record.java \
- Root.java \
- WritePreloadedClassFile.java
+LOCAL_SRC_FILES := *.java
LOCAL_MODULE:= preload