am e1b63d22
: Merge change 21033 into donut
Merge commit 'e1b63d224a0a68191f087186c470cde317e3fa76' into eclair * commit 'e1b63d224a0a68191f087186c470cde317e3fa76': Mock ServiceManager and AccesibilityManager to make the view renders in ADT
This commit is contained in:
70
tools/layoutlib/bridge/src/android/os/ServiceManager.java
Normal file
70
tools/layoutlib/bridge/src/android/os/ServiceManager.java
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 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.os;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public final class ServiceManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a reference to a service with the given name.
|
||||||
|
*
|
||||||
|
* @param name the name of the service to get
|
||||||
|
* @return a reference to the service, or <code>null</code> if the service doesn't exist
|
||||||
|
*/
|
||||||
|
public static IBinder getService(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place a new @a service called @a name into the service
|
||||||
|
* manager.
|
||||||
|
*
|
||||||
|
* @param name the name of the new service
|
||||||
|
* @param service the service object
|
||||||
|
*/
|
||||||
|
public static void addService(String name, IBinder service) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve an existing service called @a name from the
|
||||||
|
* service manager. Non-blocking.
|
||||||
|
*/
|
||||||
|
public static IBinder checkService(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a list of all currently running services.
|
||||||
|
*/
|
||||||
|
public static String[] listServices() throws RemoteException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is only intended to be called when the process is first being brought
|
||||||
|
* up and bound by the activity manager. There is only one thread in the process
|
||||||
|
* at that time, so no locking is done.
|
||||||
|
*
|
||||||
|
* @param cache the cache of service references
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static void initServiceCache(Map<String, IBinder> cache) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 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.view.accessibility;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.ServiceInfo;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* System level service that serves as an event dispatch for {@link AccessibilityEvent}s.
|
||||||
|
* Such events are generated when something notable happens in the user interface,
|
||||||
|
* for example an {@link android.app.Activity} starts, the focus or selection of a
|
||||||
|
* {@link android.view.View} changes etc. Parties interested in handling accessibility
|
||||||
|
* events implement and register an accessibility service which extends
|
||||||
|
* {@link android.accessibilityservice.AccessibilityService}.
|
||||||
|
*
|
||||||
|
* @see AccessibilityEvent
|
||||||
|
* @see android.accessibilityservice.AccessibilityService
|
||||||
|
* @see android.content.Context#getSystemService
|
||||||
|
*/
|
||||||
|
public final class AccessibilityManager {
|
||||||
|
private static AccessibilityManager sInstance = new AccessibilityManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an AccessibilityManager instance (create one if necessary).
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static AccessibilityManager getInstance(Context context) {
|
||||||
|
return sInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an instance.
|
||||||
|
*
|
||||||
|
* @param context A {@link Context}.
|
||||||
|
*/
|
||||||
|
private AccessibilityManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the {@link AccessibilityManager} is enabled.
|
||||||
|
*
|
||||||
|
* @return True if this {@link AccessibilityManager} is enabled, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends an {@link AccessibilityEvent}. If this {@link AccessibilityManager} is not
|
||||||
|
* enabled the call is a NOOP.
|
||||||
|
*
|
||||||
|
* @param event The {@link AccessibilityEvent}.
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException if a client tries to send an {@link AccessibilityEvent}
|
||||||
|
* while accessibility is not enabled.
|
||||||
|
*/
|
||||||
|
public void sendAccessibilityEvent(AccessibilityEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests interruption of the accessibility feedback from all accessibility services.
|
||||||
|
*/
|
||||||
|
public void interrupt() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link ServiceInfo}s of the installed accessibility services.
|
||||||
|
*
|
||||||
|
* @return An unmodifiable list with {@link ServiceInfo}s.
|
||||||
|
*/
|
||||||
|
public List<ServiceInfo> getAccessibilityServiceList() {
|
||||||
|
List<ServiceInfo> services = null;
|
||||||
|
return Collections.unmodifiableList(services);
|
||||||
|
}
|
||||||
|
}
|
@ -64,7 +64,7 @@ import java.util.Map.Entry;
|
|||||||
* Custom implementation of Context to handle non compiled resources.
|
* Custom implementation of Context to handle non compiled resources.
|
||||||
*/
|
*/
|
||||||
public final class BridgeContext extends Context {
|
public final class BridgeContext extends Context {
|
||||||
|
|
||||||
private Resources mResources;
|
private Resources mResources;
|
||||||
private Theme mTheme;
|
private Theme mTheme;
|
||||||
private HashMap<View, Object> mViewKeyMap = new HashMap<View, Object>();
|
private HashMap<View, Object> mViewKeyMap = new HashMap<View, Object>();
|
||||||
@ -73,12 +73,12 @@ public final class BridgeContext extends Context {
|
|||||||
private Map<String, Map<String, IResourceValue>> mProjectResources;
|
private Map<String, Map<String, IResourceValue>> mProjectResources;
|
||||||
private Map<String, Map<String, IResourceValue>> mFrameworkResources;
|
private Map<String, Map<String, IResourceValue>> mFrameworkResources;
|
||||||
private Map<IStyleResourceValue, IStyleResourceValue> mStyleInheritanceMap;
|
private Map<IStyleResourceValue, IStyleResourceValue> mStyleInheritanceMap;
|
||||||
|
|
||||||
// maps for dynamically generated id representing style objects (IStyleResourceValue)
|
// maps for dynamically generated id representing style objects (IStyleResourceValue)
|
||||||
private Map<Integer, IStyleResourceValue> mDynamicIdToStyleMap;
|
private Map<Integer, IStyleResourceValue> mDynamicIdToStyleMap;
|
||||||
private Map<IStyleResourceValue, Integer> mStyleToDynamicIdMap;
|
private Map<IStyleResourceValue, Integer> mStyleToDynamicIdMap;
|
||||||
private int mDynamicIdGenerator = 0x01030000; // Base id for framework R.style
|
private int mDynamicIdGenerator = 0x01030000; // Base id for framework R.style
|
||||||
|
|
||||||
// cache for TypedArray generated from IStyleResourceValue object
|
// cache for TypedArray generated from IStyleResourceValue object
|
||||||
private Map<int[], Map<Integer, TypedArray>> mTypedArrayCache;
|
private Map<int[], Map<Integer, TypedArray>> mTypedArrayCache;
|
||||||
private BridgeInflater mInflater;
|
private BridgeInflater mInflater;
|
||||||
@ -112,7 +112,7 @@ public final class BridgeContext extends Context {
|
|||||||
mProjectCallback = customViewLoader;
|
mProjectCallback = customViewLoader;
|
||||||
mLogger = logger;
|
mLogger = logger;
|
||||||
Configuration config = new Configuration();
|
Configuration config = new Configuration();
|
||||||
|
|
||||||
AssetManager assetManager = BridgeAssetManager.initSystem();
|
AssetManager assetManager = BridgeAssetManager.initSystem();
|
||||||
mResources = BridgeResources.initSystem(
|
mResources = BridgeResources.initSystem(
|
||||||
this,
|
this,
|
||||||
@ -120,19 +120,19 @@ public final class BridgeContext extends Context {
|
|||||||
metrics,
|
metrics,
|
||||||
config,
|
config,
|
||||||
customViewLoader);
|
customViewLoader);
|
||||||
|
|
||||||
mTheme = mResources.newTheme();
|
mTheme = mResources.newTheme();
|
||||||
|
|
||||||
mThemeValues = currentTheme;
|
mThemeValues = currentTheme;
|
||||||
mProjectResources = projectResources;
|
mProjectResources = projectResources;
|
||||||
mFrameworkResources = frameworkResources;
|
mFrameworkResources = frameworkResources;
|
||||||
mStyleInheritanceMap = styleInheritanceMap;
|
mStyleInheritanceMap = styleInheritanceMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBridgeInflater(BridgeInflater inflater) {
|
public void setBridgeInflater(BridgeInflater inflater) {
|
||||||
mInflater = inflater;
|
mInflater = inflater;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addViewKey(View view, Object viewKey) {
|
public void addViewKey(View view, Object viewKey) {
|
||||||
mViewKeyMap.put(view, viewKey);
|
mViewKeyMap.put(view, viewKey);
|
||||||
}
|
}
|
||||||
@ -140,19 +140,19 @@ public final class BridgeContext extends Context {
|
|||||||
public Object getViewKey(View view) {
|
public Object getViewKey(View view) {
|
||||||
return mViewKeyMap.get(view);
|
return mViewKeyMap.get(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getProjectKey() {
|
public Object getProjectKey() {
|
||||||
return mProjectKey;
|
return mProjectKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProjectCallback getProjectCallback() {
|
public IProjectCallback getProjectCallback() {
|
||||||
return mProjectCallback;
|
return mProjectCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILayoutLog getLogger() {
|
public ILayoutLog getLogger() {
|
||||||
return mLogger;
|
return mLogger;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------ Context methods
|
// ------------ Context methods
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -169,14 +169,14 @@ public final class BridgeContext extends Context {
|
|||||||
public ClassLoader getClassLoader() {
|
public ClassLoader getClassLoader() {
|
||||||
return this.getClass().getClassLoader();
|
return this.getClass().getClassLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSystemService(String service) {
|
public Object getSystemService(String service) {
|
||||||
if (LAYOUT_INFLATER_SERVICE.equals(service)) {
|
if (LAYOUT_INFLATER_SERVICE.equals(service)) {
|
||||||
return mInflater;
|
return mInflater;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AutoCompleteTextView and MultiAutoCompleteTextView want a window
|
// AutoCompleteTextView and MultiAutoCompleteTextView want a window
|
||||||
// service. We don't have any but it's not worth an exception.
|
// service. We don't have any but it's not worth an exception.
|
||||||
if (WINDOW_SERVICE.equals(service)) {
|
if (WINDOW_SERVICE.equals(service)) {
|
||||||
return null;
|
return null;
|
||||||
@ -196,38 +196,38 @@ public final class BridgeContext extends Context {
|
|||||||
throws Resources.NotFoundException {
|
throws Resources.NotFoundException {
|
||||||
// get the IStyleResourceValue based on the resId;
|
// get the IStyleResourceValue based on the resId;
|
||||||
IStyleResourceValue style = getStyleByDynamicId(resid);
|
IStyleResourceValue style = getStyleByDynamicId(resid);
|
||||||
|
|
||||||
if (style == null) {
|
if (style == null) {
|
||||||
throw new Resources.NotFoundException();
|
throw new Resources.NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTypedArrayCache == null) {
|
if (mTypedArrayCache == null) {
|
||||||
mTypedArrayCache = new HashMap<int[], Map<Integer,TypedArray>>();
|
mTypedArrayCache = new HashMap<int[], Map<Integer,TypedArray>>();
|
||||||
|
|
||||||
Map<Integer, TypedArray> map = new HashMap<Integer, TypedArray>();
|
Map<Integer, TypedArray> map = new HashMap<Integer, TypedArray>();
|
||||||
mTypedArrayCache.put(attrs, map);
|
mTypedArrayCache.put(attrs, map);
|
||||||
|
|
||||||
BridgeTypedArray ta = createStyleBasedTypedArray(style, attrs);
|
BridgeTypedArray ta = createStyleBasedTypedArray(style, attrs);
|
||||||
map.put(resid, ta);
|
map.put(resid, ta);
|
||||||
|
|
||||||
return ta;
|
return ta;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the 2nd map
|
// get the 2nd map
|
||||||
Map<Integer, TypedArray> map = mTypedArrayCache.get(attrs);
|
Map<Integer, TypedArray> map = mTypedArrayCache.get(attrs);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
map = new HashMap<Integer, TypedArray>();
|
map = new HashMap<Integer, TypedArray>();
|
||||||
mTypedArrayCache.put(attrs, map);
|
mTypedArrayCache.put(attrs, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the array from the 2nd map
|
// get the array from the 2nd map
|
||||||
TypedArray ta = map.get(resid);
|
TypedArray ta = map.get(resid);
|
||||||
|
|
||||||
if (ta == null) {
|
if (ta == null) {
|
||||||
ta = createStyleBasedTypedArray(style, attrs);
|
ta = createStyleBasedTypedArray(style, attrs);
|
||||||
map.put(resid, ta);
|
map.put(resid, ta);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ta;
|
return ta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,11 +235,11 @@ public final class BridgeContext extends Context {
|
|||||||
public final TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs) {
|
public final TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs) {
|
||||||
return obtainStyledAttributes(set, attrs, 0, 0);
|
return obtainStyledAttributes(set, attrs, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs,
|
public TypedArray obtainStyledAttributes(AttributeSet set, int[] attrs,
|
||||||
int defStyleAttr, int defStyleRes) {
|
int defStyleAttr, int defStyleRes) {
|
||||||
|
|
||||||
// Hint: for XmlPullParser, attach source //DEVICE_SRC/dalvik/libcore/xml/src/java
|
// Hint: for XmlPullParser, attach source //DEVICE_SRC/dalvik/libcore/xml/src/java
|
||||||
BridgeXmlBlockParser parser = null;
|
BridgeXmlBlockParser parser = null;
|
||||||
if (set instanceof BridgeXmlBlockParser) {
|
if (set instanceof BridgeXmlBlockParser) {
|
||||||
@ -252,10 +252,10 @@ public final class BridgeContext extends Context {
|
|||||||
|
|
||||||
boolean[] frameworkAttributes = new boolean[1];
|
boolean[] frameworkAttributes = new boolean[1];
|
||||||
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes);
|
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes);
|
||||||
|
|
||||||
BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
|
BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
|
||||||
parser.isPlatformFile());
|
parser.isPlatformFile());
|
||||||
|
|
||||||
// resolve the defStyleAttr value into a IStyleResourceValue
|
// resolve the defStyleAttr value into a IStyleResourceValue
|
||||||
IStyleResourceValue defStyleValues = null;
|
IStyleResourceValue defStyleValues = null;
|
||||||
if (defStyleAttr != 0) {
|
if (defStyleAttr != 0) {
|
||||||
@ -265,7 +265,7 @@ public final class BridgeContext extends Context {
|
|||||||
// look for the style in the current theme, and its parent:
|
// look for the style in the current theme, and its parent:
|
||||||
if (mThemeValues != null) {
|
if (mThemeValues != null) {
|
||||||
IResourceValue item = findItemInStyle(mThemeValues, defStyleName);
|
IResourceValue item = findItemInStyle(mThemeValues, defStyleName);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
// item is a reference to a style entry. Search for it.
|
// item is a reference to a style entry. Search for it.
|
||||||
item = findResValue(item.getValue());
|
item = findResValue(item.getValue());
|
||||||
@ -279,12 +279,12 @@ public final class BridgeContext extends Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defStyleRes != 0) {
|
if (defStyleRes != 0) {
|
||||||
// FIXME: See what we need to do with this.
|
// FIXME: See what we need to do with this.
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
String namespace = BridgeConstants.NS_RESOURCES;
|
String namespace = BridgeConstants.NS_RESOURCES;
|
||||||
if (frameworkAttributes[0] == false) {
|
if (frameworkAttributes[0] == false) {
|
||||||
// need to use the application namespace
|
// need to use the application namespace
|
||||||
@ -294,32 +294,32 @@ public final class BridgeContext extends Context {
|
|||||||
if (styleNameMap != null) {
|
if (styleNameMap != null) {
|
||||||
for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
|
for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
|
||||||
int index = styleAttribute.getKey().intValue();
|
int index = styleAttribute.getKey().intValue();
|
||||||
|
|
||||||
String name = styleAttribute.getValue();
|
String name = styleAttribute.getValue();
|
||||||
String value = parser.getAttributeValue(namespace, name);
|
String value = parser.getAttributeValue(namespace, name);
|
||||||
|
|
||||||
// if there's no direct value for this attribute in the XML, we look for default
|
// if there's no direct value for this attribute in the XML, we look for default
|
||||||
// values in the widget defStyle, and then in the theme.
|
// values in the widget defStyle, and then in the theme.
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
IResourceValue resValue = null;
|
IResourceValue resValue = null;
|
||||||
|
|
||||||
// look for the value in the defStyle first (and its parent if needed)
|
// look for the value in the defStyle first (and its parent if needed)
|
||||||
if (defStyleValues != null) {
|
if (defStyleValues != null) {
|
||||||
resValue = findItemInStyle(defStyleValues, name);
|
resValue = findItemInStyle(defStyleValues, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the item is not present in the defStyle, we look in the main theme (and
|
// if the item is not present in the defStyle, we look in the main theme (and
|
||||||
// its parent themes)
|
// its parent themes)
|
||||||
if (resValue == null && mThemeValues != null) {
|
if (resValue == null && mThemeValues != null) {
|
||||||
resValue = findItemInStyle(mThemeValues, name);
|
resValue = findItemInStyle(mThemeValues, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we found a value, we make sure this doesn't reference another value.
|
// if we found a value, we make sure this doesn't reference another value.
|
||||||
// So we resolve it.
|
// So we resolve it.
|
||||||
if (resValue != null) {
|
if (resValue != null) {
|
||||||
resValue = resolveResValue(resValue);
|
resValue = resolveResValue(resValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
ta.bridgeSetValue(index, name, resValue);
|
ta.bridgeSetValue(index, name, resValue);
|
||||||
} else {
|
} else {
|
||||||
// there is a value in the XML, but we need to resolve it in case it's
|
// there is a value in the XML, but we need to resolve it in case it's
|
||||||
@ -328,15 +328,20 @@ public final class BridgeContext extends Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ta.sealArray();
|
ta.sealArray();
|
||||||
|
|
||||||
return ta;
|
return ta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Looper getMainLooper() {
|
||||||
|
return Looper.myLooper();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------- private new methods
|
// ------------- private new methods
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link BridgeTypedArray} by filling the values defined by the int[] with the
|
* Creates a {@link BridgeTypedArray} by filling the values defined by the int[] with the
|
||||||
* values found in the given style.
|
* values found in the given style.
|
||||||
@ -345,30 +350,30 @@ public final class BridgeContext extends Context {
|
|||||||
private BridgeTypedArray createStyleBasedTypedArray(IStyleResourceValue style, int[] attrs)
|
private BridgeTypedArray createStyleBasedTypedArray(IStyleResourceValue style, int[] attrs)
|
||||||
throws Resources.NotFoundException {
|
throws Resources.NotFoundException {
|
||||||
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, null);
|
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, null);
|
||||||
|
|
||||||
BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
|
BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
|
||||||
false /* platformResourceFlag */);
|
false /* platformResourceFlag */);
|
||||||
|
|
||||||
// loop through all the values in the style map, and init the TypedArray with
|
// loop through all the values in the style map, and init the TypedArray with
|
||||||
// the style we got from the dynamic id
|
// the style we got from the dynamic id
|
||||||
for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
|
for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
|
||||||
int index = styleAttribute.getKey().intValue();
|
int index = styleAttribute.getKey().intValue();
|
||||||
|
|
||||||
String name = styleAttribute.getValue();
|
String name = styleAttribute.getValue();
|
||||||
|
|
||||||
// get the value from the style, or its parent styles.
|
// get the value from the style, or its parent styles.
|
||||||
IResourceValue resValue = findItemInStyle(style, name);
|
IResourceValue resValue = findItemInStyle(style, name);
|
||||||
|
|
||||||
// resolve it to make sure there are no references left.
|
// resolve it to make sure there are no references left.
|
||||||
ta.bridgeSetValue(index, name, resolveResValue(resValue));
|
ta.bridgeSetValue(index, name, resolveResValue(resValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
ta.sealArray();
|
ta.sealArray();
|
||||||
|
|
||||||
return ta;
|
return ta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves the value of a resource, if the value references a theme or resource value.
|
* Resolves the value of a resource, if the value references a theme or resource value.
|
||||||
* <p/>
|
* <p/>
|
||||||
@ -391,13 +396,13 @@ public final class BridgeContext extends Context {
|
|||||||
|
|
||||||
// get the IResourceValue referenced by this value
|
// get the IResourceValue referenced by this value
|
||||||
IResourceValue resValue = findResValue(value);
|
IResourceValue resValue = findResValue(value);
|
||||||
|
|
||||||
// if resValue is null, but value is not null, this means it was not a reference.
|
// 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
|
// we return the name/value wrapper in a IResourceValue
|
||||||
if (resValue == null) {
|
if (resValue == null) {
|
||||||
return new ResourceValue(type, name, value);
|
return new ResourceValue(type, name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we resolved a first reference, but we need to make sure this isn't a reference also.
|
// we resolved a first reference, but we need to make sure this isn't a reference also.
|
||||||
return resolveResValue(resValue);
|
return resolveResValue(resValue);
|
||||||
}
|
}
|
||||||
@ -411,7 +416,7 @@ public final class BridgeContext extends Context {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* If a value that does not need to be resolved is given, the method will return the input
|
* If a value that does not need to be resolved is given, the method will return the input
|
||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @param value the value containing the reference to resolve.
|
* @param value the value containing the reference to resolve.
|
||||||
* @return a {@link IResourceValue} object or <code>null</code>
|
* @return a {@link IResourceValue} object or <code>null</code>
|
||||||
*/
|
*/
|
||||||
@ -419,7 +424,7 @@ public final class BridgeContext extends Context {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the resource value is a style, we simply return it.
|
// if the resource value is a style, we simply return it.
|
||||||
if (value instanceof IStyleResourceValue) {
|
if (value instanceof IStyleResourceValue) {
|
||||||
return value;
|
return value;
|
||||||
@ -436,7 +441,7 @@ public final class BridgeContext extends Context {
|
|||||||
// otherwise, we attempt to resolve this new value as well
|
// otherwise, we attempt to resolve this new value as well
|
||||||
return resolveResValue(resolvedValue);
|
return resolveResValue(resolvedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for, and returns a {@link IResourceValue} by its reference.
|
* Searches for, and returns a {@link IResourceValue} by its reference.
|
||||||
* <p/>
|
* <p/>
|
||||||
@ -451,7 +456,7 @@ public final class BridgeContext extends Context {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* The actual format of a reference is <pre>@[namespace:]resType/resName</pre> but this method
|
* The actual format of a reference is <pre>@[namespace:]resType/resName</pre> but this method
|
||||||
* only support the android namespace.
|
* only support the android namespace.
|
||||||
*
|
*
|
||||||
* @param reference the resource reference to search for.
|
* @param reference the resource reference to search for.
|
||||||
* @return a {@link IResourceValue} or <code>null</code>.
|
* @return a {@link IResourceValue} or <code>null</code>.
|
||||||
*/
|
*/
|
||||||
@ -481,7 +486,7 @@ public final class BridgeContext extends Context {
|
|||||||
|
|
||||||
// we look for the referenced item name.
|
// we look for the referenced item name.
|
||||||
String referenceName = null;
|
String referenceName = null;
|
||||||
|
|
||||||
if (segments.length == 2) {
|
if (segments.length == 2) {
|
||||||
// there was a resType in the reference. If it's attr, we ignore it
|
// there was a resType in the reference. If it's attr, we ignore it
|
||||||
// else, we assert for now.
|
// else, we assert for now.
|
||||||
@ -495,7 +500,7 @@ public final class BridgeContext extends Context {
|
|||||||
// it's just an item name.
|
// it's just an item name.
|
||||||
referenceName = segments[0];
|
referenceName = segments[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// now we look for android: in the referenceName in order to support format
|
// now we look for android: in the referenceName in order to support format
|
||||||
// such as: ?attr/android:name
|
// such as: ?attr/android:name
|
||||||
if (referenceName.startsWith(BridgeConstants.PREFIX_ANDROID)) {
|
if (referenceName.startsWith(BridgeConstants.PREFIX_ANDROID)) {
|
||||||
@ -512,9 +517,9 @@ public final class BridgeContext extends Context {
|
|||||||
return findItemInStyle(mThemeValues, referenceName);
|
return findItemInStyle(mThemeValues, referenceName);
|
||||||
} else if (reference.startsWith(BridgeConstants.PREFIX_RESOURCE_REF)) {
|
} else if (reference.startsWith(BridgeConstants.PREFIX_RESOURCE_REF)) {
|
||||||
boolean frameworkOnly = false;
|
boolean frameworkOnly = false;
|
||||||
|
|
||||||
// check for the specific null reference value.
|
// check for the specific null reference value.
|
||||||
if (BridgeConstants.REFERENCE_NULL.equals(reference)) {
|
if (BridgeConstants.REFERENCE_NULL.equals(reference)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,20 +531,20 @@ public final class BridgeContext extends Context {
|
|||||||
} else {
|
} else {
|
||||||
reference = reference.substring(BridgeConstants.PREFIX_RESOURCE_REF.length());
|
reference = reference.substring(BridgeConstants.PREFIX_RESOURCE_REF.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
// at this point, value contains type/[android:]name (drawable/foo for instance)
|
// at this point, value contains type/[android:]name (drawable/foo for instance)
|
||||||
String[] segments = reference.split("\\/");
|
String[] segments = reference.split("\\/");
|
||||||
|
|
||||||
// now we look for android: in the resource name in order to support format
|
// now we look for android: in the resource name in order to support format
|
||||||
// such as: @drawable/android:name
|
// such as: @drawable/android:name
|
||||||
if (segments[1].startsWith(BridgeConstants.PREFIX_ANDROID)) {
|
if (segments[1].startsWith(BridgeConstants.PREFIX_ANDROID)) {
|
||||||
frameworkOnly = true;
|
frameworkOnly = true;
|
||||||
segments[1] = segments[1].substring(BridgeConstants.PREFIX_ANDROID.length());
|
segments[1] = segments[1].substring(BridgeConstants.PREFIX_ANDROID.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
return findResValue(segments[0], segments[1], frameworkOnly);
|
return findResValue(segments[0], segments[1], frameworkOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Looks like the value didn't reference anything. Return null.
|
// Looks like the value didn't reference anything. Return null.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -565,7 +570,7 @@ public final class BridgeContext extends Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now search in the framework resources.
|
// now search in the framework resources.
|
||||||
typeMap = mFrameworkResources.get(resType);
|
typeMap = mFrameworkResources.get(resType);
|
||||||
if (typeMap != null) {
|
if (typeMap != null) {
|
||||||
@ -574,11 +579,11 @@ public final class BridgeContext extends Context {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// didn't find the resource anywhere.
|
// didn't find the resource anywhere.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a framework resource by type and name. The returned resource is resolved.
|
* Returns a framework resource by type and name. The returned resource is resolved.
|
||||||
* @param resourceType the type of the resource
|
* @param resourceType the type of the resource
|
||||||
@ -587,7 +592,7 @@ public final class BridgeContext extends Context {
|
|||||||
public IResourceValue getFrameworkResource(String resourceType, String resourceName) {
|
public IResourceValue getFrameworkResource(String resourceType, String resourceName) {
|
||||||
return getResource(resourceType, resourceName, mFrameworkResources);
|
return getResource(resourceType, resourceName, mFrameworkResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a project resource by type and name. The returned resource is resolved.
|
* Returns a project resource by type and name. The returned resource is resolved.
|
||||||
* @param resourceType the type of the resource
|
* @param resourceType the type of the resource
|
||||||
@ -596,7 +601,7 @@ public final class BridgeContext extends Context {
|
|||||||
public IResourceValue getProjectResource(String resourceType, String resourceName) {
|
public IResourceValue getProjectResource(String resourceType, String resourceName) {
|
||||||
return getResource(resourceType, resourceName, mProjectResources);
|
return getResource(resourceType, resourceName, mProjectResources);
|
||||||
}
|
}
|
||||||
|
|
||||||
IResourceValue getResource(String resourceType, String resourceName,
|
IResourceValue getResource(String resourceType, String resourceName,
|
||||||
Map<String, Map<String, IResourceValue>> resourceRepository) {
|
Map<String, Map<String, IResourceValue>> resourceRepository) {
|
||||||
Map<String, IResourceValue> typeMap = resourceRepository.get(resourceType);
|
Map<String, IResourceValue> typeMap = resourceRepository.get(resourceType);
|
||||||
@ -607,12 +612,12 @@ public final class BridgeContext extends Context {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// didn't find the resource anywhere.
|
// didn't find the resource anywhere.
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link IResourceValue} matching a given name in a given style. If the
|
* 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.
|
* 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 findItemInStyle(IStyleResourceValue style, String itemName) {
|
||||||
IResourceValue item = style.findItem(itemName);
|
IResourceValue item = style.findItem(itemName);
|
||||||
|
|
||||||
// if we didn't find it, we look in the parent style (if applicable)
|
// if we didn't find it, we look in the parent style (if applicable)
|
||||||
if (item == null && mStyleInheritanceMap != null) {
|
if (item == null && mStyleInheritanceMap != null) {
|
||||||
IStyleResourceValue parentStyle = mStyleInheritanceMap.get(style);
|
IStyleResourceValue parentStyle = mStyleInheritanceMap.get(style);
|
||||||
@ -630,7 +635,7 @@ public final class BridgeContext extends Context {
|
|||||||
return findItemInStyle(parentStyle, itemName);
|
return findItemInStyle(parentStyle, itemName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
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
|
* 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
|
* 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.
|
* that is used to reference the attribute later in the TypedArray.
|
||||||
*
|
*
|
||||||
* @param attrs An attribute array reference given to obtainStyledAttributes.
|
* @param attrs An attribute array reference given to obtainStyledAttributes.
|
||||||
* @return A sorted map Attribute-Value to Attribute-Name for all attributes declared by the
|
* @return A sorted map Attribute-Value to Attribute-Name for all attributes declared by the
|
||||||
* attribute array. Returns null if nothing is found.
|
* attribute array. Returns null if nothing is found.
|
||||||
@ -662,14 +667,14 @@ public final class BridgeContext extends Context {
|
|||||||
attributes.put(i, null);
|
attributes.put(i, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outFrameworkFlag != null) {
|
if (outFrameworkFlag != null) {
|
||||||
outFrameworkFlag[0] = true;
|
outFrameworkFlag[0] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the name was not found in the framework resources, look in the project
|
// if the name was not found in the framework resources, look in the project
|
||||||
// resources
|
// resources
|
||||||
arrayName = mProjectCallback.resolveResourceValue(attrs);
|
arrayName = mProjectCallback.resolveResourceValue(attrs);
|
||||||
@ -697,7 +702,7 @@ public final class BridgeContext extends Context {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for the attribute referenced by its internal id.
|
* Searches for the attribute referenced by its internal id.
|
||||||
*
|
*
|
||||||
* @param attr An attribute reference given to obtainStyledAttributes such as defStyle.
|
* @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
|
* @return The unique name of the attribute, if found, e.g. "buttonStyle". Returns null
|
||||||
* if nothing is found.
|
* if nothing is found.
|
||||||
@ -707,12 +712,12 @@ public final class BridgeContext extends Context {
|
|||||||
if (info != null) {
|
if (info != null) {
|
||||||
return info[0];
|
return info[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
info = mProjectCallback.resolveResourceValue(attr);
|
info = mProjectCallback.resolveResourceValue(attr);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
return info[0];
|
return info[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,27 +727,27 @@ public final class BridgeContext extends Context {
|
|||||||
mDynamicIdToStyleMap = new HashMap<Integer, IStyleResourceValue>();
|
mDynamicIdToStyleMap = new HashMap<Integer, IStyleResourceValue>();
|
||||||
mStyleToDynamicIdMap = new HashMap<IStyleResourceValue, Integer>();
|
mStyleToDynamicIdMap = new HashMap<IStyleResourceValue, Integer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for an existing id
|
// look for an existing id
|
||||||
Integer id = mStyleToDynamicIdMap.get(resValue);
|
Integer id = mStyleToDynamicIdMap.get(resValue);
|
||||||
|
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
// generate a new id
|
// generate a new id
|
||||||
id = Integer.valueOf(++mDynamicIdGenerator);
|
id = Integer.valueOf(++mDynamicIdGenerator);
|
||||||
|
|
||||||
// and add it to the maps.
|
// and add it to the maps.
|
||||||
mDynamicIdToStyleMap.put(id, resValue);
|
mDynamicIdToStyleMap.put(id, resValue);
|
||||||
mStyleToDynamicIdMap.put(resValue, id);
|
mStyleToDynamicIdMap.put(resValue, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IStyleResourceValue getStyleByDynamicId(int i) {
|
private IStyleResourceValue getStyleByDynamicId(int i) {
|
||||||
if (mDynamicIdToStyleMap != null) {
|
if (mDynamicIdToStyleMap != null) {
|
||||||
return mDynamicIdToStyleMap.get(i);
|
return mDynamicIdToStyleMap.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -751,10 +756,10 @@ public final class BridgeContext extends Context {
|
|||||||
if (value != null) {
|
if (value != null) {
|
||||||
return value.intValue();
|
return value.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
return defValue;
|
return defValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getProjectIdValue(String idName, int defValue) {
|
int getProjectIdValue(String idName, int defValue) {
|
||||||
if (mProjectCallback != null) {
|
if (mProjectCallback != null) {
|
||||||
Integer value = mProjectCallback.getResourceValue(BridgeConstants.RES_ID, idName);
|
Integer value = mProjectCallback.getResourceValue(BridgeConstants.RES_ID, idName);
|
||||||
@ -762,7 +767,7 @@ public final class BridgeContext extends Context {
|
|||||||
return value.intValue();
|
return value.intValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return defValue;
|
return defValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -820,7 +825,7 @@ public final class BridgeContext extends Context {
|
|||||||
@Override
|
@Override
|
||||||
public void clearWallpaper() {
|
public void clearWallpaper() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -850,46 +855,46 @@ public final class BridgeContext extends Context {
|
|||||||
@Override
|
@Override
|
||||||
public void enforceCallingOrSelfPermission(String arg0, String arg1) {
|
public void enforceCallingOrSelfPermission(String arg0, String arg1) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enforceCallingOrSelfUriPermission(Uri arg0, int arg1,
|
public void enforceCallingOrSelfUriPermission(Uri arg0, int arg1,
|
||||||
String arg2) {
|
String arg2) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enforceCallingPermission(String arg0, String arg1) {
|
public void enforceCallingPermission(String arg0, String arg1) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enforceCallingUriPermission(Uri arg0, int arg1, String arg2) {
|
public void enforceCallingUriPermission(Uri arg0, int arg1, String arg2) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enforcePermission(String arg0, int arg1, int arg2, String arg3) {
|
public void enforcePermission(String arg0, int arg1, int arg2, String arg3) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3,
|
public void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3,
|
||||||
String arg4) {
|
String arg4) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enforceUriPermission(Uri arg0, String arg1, String arg2,
|
public void enforceUriPermission(Uri arg0, String arg1, String arg2,
|
||||||
int arg3, int arg4, int arg5, String arg6) {
|
int arg3, int arg4, int arg5, String arg6) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -965,7 +970,7 @@ public final class BridgeContext extends Context {
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPackageResourcePath() {
|
public String getPackageResourcePath() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
@ -1003,7 +1008,7 @@ public final class BridgeContext extends Context {
|
|||||||
@Override
|
@Override
|
||||||
public void grantUriPermission(String arg0, Uri arg1, int arg2) {
|
public void grantUriPermission(String arg0, Uri arg1, int arg2) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@ -1051,31 +1056,31 @@ public final class BridgeContext extends Context {
|
|||||||
@Override
|
@Override
|
||||||
public void removeStickyBroadcast(Intent arg0) {
|
public void removeStickyBroadcast(Intent arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void revokeUriPermission(Uri arg0, int arg1) {
|
public void revokeUriPermission(Uri arg0, int arg1) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendBroadcast(Intent arg0) {
|
public void sendBroadcast(Intent arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendBroadcast(Intent arg0, String arg1) {
|
public void sendBroadcast(Intent arg0, String arg1) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendOrderedBroadcast(Intent arg0, String arg1) {
|
public void sendOrderedBroadcast(Intent arg0, String arg1) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1083,39 +1088,39 @@ public final class BridgeContext extends Context {
|
|||||||
BroadcastReceiver arg2, Handler arg3, int arg4, String arg5,
|
BroadcastReceiver arg2, Handler arg3, int arg4, String arg5,
|
||||||
Bundle arg6) {
|
Bundle arg6) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendStickyBroadcast(Intent arg0) {
|
public void sendStickyBroadcast(Intent arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTheme(int arg0) {
|
public void setTheme(int arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public void setWallpaper(Bitmap arg0) throws IOException {
|
public void setWallpaper(Bitmap arg0) throws IOException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
public void setWallpaper(InputStream arg0) throws IOException {
|
public void setWallpaper(InputStream arg0) throws IOException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startActivity(Intent arg0) {
|
public void startActivity(Intent arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1140,20 +1145,15 @@ public final class BridgeContext extends Context {
|
|||||||
@Override
|
@Override
|
||||||
public void unbindService(ServiceConnection arg0) {
|
public void unbindService(ServiceConnection arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unregisterReceiver(BroadcastReceiver arg0) {
|
public void unregisterReceiver(BroadcastReceiver arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Looper getMainLooper() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Context getApplicationContext() {
|
public Context getApplicationContext() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -40,7 +40,7 @@ public class Main {
|
|||||||
for (String path : osJarPath) {
|
for (String path : osJarPath) {
|
||||||
log.info("Input : %1$s", path);
|
log.info("Input : %1$s", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AsmGenerator agen = new AsmGenerator(log, osDestJar[0],
|
AsmGenerator agen = new AsmGenerator(log, osDestJar[0],
|
||||||
new Class<?>[] { // classes to inject in the final JAR
|
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.ComposeShader", "android.graphics._Original_ComposeShader",
|
||||||
"android.graphics.RadialGradient", "android.graphics._Original_RadialGradient",
|
"android.graphics.RadialGradient", "android.graphics._Original_RadialGradient",
|
||||||
"android.graphics.SweepGradient", "android.graphics._Original_SweepGradient",
|
"android.graphics.SweepGradient", "android.graphics._Original_SweepGradient",
|
||||||
|
"android.os.ServiceManager", "android.os._Original_ServiceManager",
|
||||||
"android.util.FloatMath", "android.util._Original_FloatMath",
|
"android.util.FloatMath", "android.util._Original_FloatMath",
|
||||||
"android.view.SurfaceView", "android.view._Original_SurfaceView",
|
"android.view.SurfaceView", "android.view._Original_SurfaceView",
|
||||||
|
"android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
|
||||||
},
|
},
|
||||||
new String[] { // methods deleted from their return type.
|
new String[] { // methods deleted from their return type.
|
||||||
"android.graphics.Paint", // class to delete method from
|
"android.graphics.Paint", // class to delete method from
|
||||||
@ -101,7 +103,7 @@ public class Main {
|
|||||||
});
|
});
|
||||||
aa.analyze();
|
aa.analyze();
|
||||||
agen.generate();
|
agen.generate();
|
||||||
|
|
||||||
// Throw an error if any class failed to get renamed by the generator
|
// 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,
|
// 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(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.exception(e, "Failed to load jar");
|
log.exception(e, "Failed to load jar");
|
||||||
@ -158,7 +160,7 @@ public class Main {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osJarPath.isEmpty()) {
|
if (osJarPath.isEmpty()) {
|
||||||
log.error("Missing parameter: path to input jar");
|
log.error("Missing parameter: path to input jar");
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user