styleAttribute : styleNameMap.entrySet()) {
int index = styleAttribute.getKey().intValue();
String name = styleAttribute.getValue();
-
+
// get the value from the style, or its parent styles.
IResourceValue resValue = findItemInStyle(style, name);
-
+
// resolve it to make sure there are no references left.
ta.bridgeSetValue(index, name, resolveResValue(resValue));
}
-
+
ta.sealArray();
return ta;
}
-
+
/**
* Resolves the value of a resource, if the value references a theme or resource value.
*
@@ -391,13 +396,13 @@ public final class BridgeContext extends Context {
// get the IResourceValue referenced by this value
IResourceValue resValue = findResValue(value);
-
+
// if resValue is null, but value is not null, this means it was not a reference.
// we return the name/value wrapper in a IResourceValue
if (resValue == null) {
return new ResourceValue(type, name, value);
}
-
+
// we resolved a first reference, but we need to make sure this isn't a reference also.
return resolveResValue(resValue);
}
@@ -411,7 +416,7 @@ public final class BridgeContext extends Context {
*
* If a value that does not need to be resolved is given, the method will return the input
* value.
- *
+ *
* @param value the value containing the reference to resolve.
* @return a {@link IResourceValue} object or null
*/
@@ -419,7 +424,7 @@ public final class BridgeContext extends Context {
if (value == null) {
return null;
}
-
+
// if the resource value is a style, we simply return it.
if (value instanceof IStyleResourceValue) {
return value;
@@ -436,7 +441,7 @@ public final class BridgeContext extends Context {
// otherwise, we attempt to resolve this new value as well
return resolveResValue(resolvedValue);
}
-
+
/**
* Searches for, and returns a {@link IResourceValue} by its reference.
*
@@ -451,7 +456,7 @@ public final class BridgeContext extends Context {
*
* The actual format of a reference is @[namespace:]resType/resName
but this method
* only support the android namespace.
- *
+ *
* @param reference the resource reference to search for.
* @return a {@link IResourceValue} or null.
*/
@@ -481,7 +486,7 @@ public final class BridgeContext extends Context {
// we look for the referenced item name.
String referenceName = null;
-
+
if (segments.length == 2) {
// there was a resType in the reference. If it's attr, we ignore it
// else, we assert for now.
@@ -495,7 +500,7 @@ public final class BridgeContext extends Context {
// it's just an item name.
referenceName = segments[0];
}
-
+
// now we look for android: in the referenceName in order to support format
// such as: ?attr/android:name
if (referenceName.startsWith(BridgeConstants.PREFIX_ANDROID)) {
@@ -512,9 +517,9 @@ public final class BridgeContext extends Context {
return findItemInStyle(mThemeValues, referenceName);
} else if (reference.startsWith(BridgeConstants.PREFIX_RESOURCE_REF)) {
boolean frameworkOnly = false;
-
+
// check for the specific null reference value.
- if (BridgeConstants.REFERENCE_NULL.equals(reference)) {
+ if (BridgeConstants.REFERENCE_NULL.equals(reference)) {
return null;
}
@@ -526,20 +531,20 @@ public final class BridgeContext extends Context {
} else {
reference = reference.substring(BridgeConstants.PREFIX_RESOURCE_REF.length());
}
-
+
// at this point, value contains type/[android:]name (drawable/foo for instance)
String[] segments = reference.split("\\/");
-
+
// now we look for android: in the resource name in order to support format
// such as: @drawable/android:name
if (segments[1].startsWith(BridgeConstants.PREFIX_ANDROID)) {
frameworkOnly = true;
segments[1] = segments[1].substring(BridgeConstants.PREFIX_ANDROID.length());
}
-
+
return findResValue(segments[0], segments[1], frameworkOnly);
}
-
+
// Looks like the value didn't reference anything. Return null.
return null;
}
@@ -565,7 +570,7 @@ public final class BridgeContext extends Context {
}
}
}
-
+
// now search in the framework resources.
typeMap = mFrameworkResources.get(resType);
if (typeMap != null) {
@@ -574,11 +579,11 @@ public final class BridgeContext extends Context {
return item;
}
}
-
+
// didn't find the resource anywhere.
return null;
}
-
+
/**
* Returns a framework resource by type and name. The returned resource is resolved.
* @param resourceType the type of the resource
@@ -587,7 +592,7 @@ public final class BridgeContext extends Context {
public IResourceValue getFrameworkResource(String resourceType, String resourceName) {
return getResource(resourceType, resourceName, mFrameworkResources);
}
-
+
/**
* Returns a project resource by type and name. The returned resource is resolved.
* @param resourceType the type of the resource
@@ -596,7 +601,7 @@ public final class BridgeContext extends Context {
public IResourceValue getProjectResource(String resourceType, String resourceName) {
return getResource(resourceType, resourceName, mProjectResources);
}
-
+
IResourceValue getResource(String resourceType, String resourceName,
Map> resourceRepository) {
Map typeMap = resourceRepository.get(resourceType);
@@ -607,12 +612,12 @@ public final class BridgeContext extends Context {
return item;
}
}
-
+
// didn't find the resource anywhere.
return null;
-
+
}
-
+
/**
* Returns the {@link IResourceValue} matching a given name in a given style. If the
* item is not directly available in the style, the method looks in its parent style.
@@ -622,7 +627,7 @@ public final class BridgeContext extends Context {
*/
IResourceValue findItemInStyle(IStyleResourceValue style, String itemName) {
IResourceValue item = style.findItem(itemName);
-
+
// if we didn't find it, we look in the parent style (if applicable)
if (item == null && mStyleInheritanceMap != null) {
IStyleResourceValue parentStyle = mStyleInheritanceMap.get(style);
@@ -630,7 +635,7 @@ public final class BridgeContext extends Context {
return findItemInStyle(parentStyle, itemName);
}
}
-
+
return item;
}
@@ -642,7 +647,7 @@ public final class BridgeContext extends Context {
* attrs == com.android.internal.R.styleable.View, this returns the list of the "xyz" where
* there's a field com.android.internal.R.styleable.View_xyz and the field value is the index
* that is used to reference the attribute later in the TypedArray.
- *
+ *
* @param attrs An attribute array reference given to obtainStyledAttributes.
* @return A sorted map Attribute-Value to Attribute-Name for all attributes declared by the
* attribute array. Returns null if nothing is found.
@@ -662,14 +667,14 @@ public final class BridgeContext extends Context {
attributes.put(i, null);
}
}
-
+
if (outFrameworkFlag != null) {
outFrameworkFlag[0] = true;
}
-
+
return attributes;
}
-
+
// if the name was not found in the framework resources, look in the project
// resources
arrayName = mProjectCallback.resolveResourceValue(attrs);
@@ -697,7 +702,7 @@ public final class BridgeContext extends Context {
/**
* Searches for the attribute referenced by its internal id.
- *
+ *
* @param attr An attribute reference given to obtainStyledAttributes such as defStyle.
* @return The unique name of the attribute, if found, e.g. "buttonStyle". Returns null
* if nothing is found.
@@ -707,12 +712,12 @@ public final class BridgeContext extends Context {
if (info != null) {
return info[0];
}
-
+
info = mProjectCallback.resolveResourceValue(attr);
if (info != null) {
return info[0];
}
-
+
return null;
}
@@ -722,27 +727,27 @@ public final class BridgeContext extends Context {
mDynamicIdToStyleMap = new HashMap();
mStyleToDynamicIdMap = new HashMap();
}
-
+
// look for an existing id
Integer id = mStyleToDynamicIdMap.get(resValue);
-
+
if (id == null) {
// generate a new id
id = Integer.valueOf(++mDynamicIdGenerator);
-
+
// and add it to the maps.
mDynamicIdToStyleMap.put(id, resValue);
mStyleToDynamicIdMap.put(resValue, id);
}
-
+
return id;
}
-
+
private IStyleResourceValue getStyleByDynamicId(int i) {
if (mDynamicIdToStyleMap != null) {
return mDynamicIdToStyleMap.get(i);
}
-
+
return null;
}
@@ -751,10 +756,10 @@ public final class BridgeContext extends Context {
if (value != null) {
return value.intValue();
}
-
+
return defValue;
}
-
+
int getProjectIdValue(String idName, int defValue) {
if (mProjectCallback != null) {
Integer value = mProjectCallback.getResourceValue(BridgeConstants.RES_ID, idName);
@@ -762,7 +767,7 @@ public final class BridgeContext extends Context {
return value.intValue();
}
}
-
+
return defValue;
}
@@ -820,7 +825,7 @@ public final class BridgeContext extends Context {
@Override
public void clearWallpaper() {
// TODO Auto-generated method stub
-
+
}
@Override
@@ -850,46 +855,46 @@ public final class BridgeContext extends Context {
@Override
public void enforceCallingOrSelfPermission(String arg0, String arg1) {
// TODO Auto-generated method stub
-
+
}
@Override
public void enforceCallingOrSelfUriPermission(Uri arg0, int arg1,
String arg2) {
// TODO Auto-generated method stub
-
+
}
@Override
public void enforceCallingPermission(String arg0, String arg1) {
// TODO Auto-generated method stub
-
+
}
@Override
public void enforceCallingUriPermission(Uri arg0, int arg1, String arg2) {
// TODO Auto-generated method stub
-
+
}
@Override
public void enforcePermission(String arg0, int arg1, int arg2, String arg3) {
// TODO Auto-generated method stub
-
+
}
@Override
public void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3,
String arg4) {
// TODO Auto-generated method stub
-
+
}
@Override
public void enforceUriPermission(Uri arg0, String arg1, String arg2,
int arg3, int arg4, int arg5, String arg6) {
// TODO Auto-generated method stub
-
+
}
@Override
@@ -965,7 +970,7 @@ public final class BridgeContext extends Context {
// TODO Auto-generated method stub
return null;
}
-
+
@Override
public String getPackageResourcePath() {
// TODO Auto-generated method stub
@@ -1003,7 +1008,7 @@ public final class BridgeContext extends Context {
@Override
public void grantUriPermission(String arg0, Uri arg1, int arg2) {
// TODO Auto-generated method stub
-
+
}
@SuppressWarnings("unused")
@@ -1051,31 +1056,31 @@ public final class BridgeContext extends Context {
@Override
public void removeStickyBroadcast(Intent arg0) {
// TODO Auto-generated method stub
-
+
}
@Override
public void revokeUriPermission(Uri arg0, int arg1) {
// TODO Auto-generated method stub
-
+
}
@Override
public void sendBroadcast(Intent arg0) {
// TODO Auto-generated method stub
-
+
}
@Override
public void sendBroadcast(Intent arg0, String arg1) {
// TODO Auto-generated method stub
-
+
}
@Override
public void sendOrderedBroadcast(Intent arg0, String arg1) {
// TODO Auto-generated method stub
-
+
}
@Override
@@ -1083,39 +1088,39 @@ public final class BridgeContext extends Context {
BroadcastReceiver arg2, Handler arg3, int arg4, String arg5,
Bundle arg6) {
// TODO Auto-generated method stub
-
+
}
@Override
public void sendStickyBroadcast(Intent arg0) {
// TODO Auto-generated method stub
-
+
}
@Override
public void setTheme(int arg0) {
// TODO Auto-generated method stub
-
+
}
@SuppressWarnings("unused")
@Override
public void setWallpaper(Bitmap arg0) throws IOException {
// TODO Auto-generated method stub
-
+
}
@SuppressWarnings("unused")
@Override
public void setWallpaper(InputStream arg0) throws IOException {
// TODO Auto-generated method stub
-
+
}
@Override
public void startActivity(Intent arg0) {
// TODO Auto-generated method stub
-
+
}
@Override
@@ -1140,20 +1145,15 @@ public final class BridgeContext extends Context {
@Override
public void unbindService(ServiceConnection arg0) {
// TODO Auto-generated method stub
-
+
}
@Override
public void unregisterReceiver(BroadcastReceiver arg0) {
// TODO Auto-generated method stub
-
+
}
- @Override
- public Looper getMainLooper() {
- throw new UnsupportedOperationException();
- }
-
@Override
public Context getApplicationContext() {
throw new UnsupportedOperationException();
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
index 76bd8d4a5ca41..c07baffe0b54f 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
@@ -40,7 +40,7 @@ public class Main {
for (String path : osJarPath) {
log.info("Input : %1$s", path);
}
-
+
try {
AsmGenerator agen = new AsmGenerator(log, osDestJar[0],
new Class>[] { // classes to inject in the final JAR
@@ -66,8 +66,10 @@ public class Main {
"android.graphics.ComposeShader", "android.graphics._Original_ComposeShader",
"android.graphics.RadialGradient", "android.graphics._Original_RadialGradient",
"android.graphics.SweepGradient", "android.graphics._Original_SweepGradient",
+ "android.os.ServiceManager", "android.os._Original_ServiceManager",
"android.util.FloatMath", "android.util._Original_FloatMath",
"android.view.SurfaceView", "android.view._Original_SurfaceView",
+ "android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
},
new String[] { // methods deleted from their return type.
"android.graphics.Paint", // class to delete method from
@@ -101,7 +103,7 @@ public class Main {
});
aa.analyze();
agen.generate();
-
+
// Throw an error if any class failed to get renamed by the generator
//
// IMPORTANT: if you're building the platform and you get this error message,
@@ -123,7 +125,7 @@ public class Main {
}
System.exit(1);
}
-
+
System.exit(0);
} catch (IOException e) {
log.exception(e, "Failed to load jar");
@@ -158,7 +160,7 @@ public class Main {
return false;
}
}
-
+
if (osJarPath.isEmpty()) {
log.error("Missing parameter: path to input jar");
return false;