You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
remove remaining dependencies on ARSClib
This commit is contained in:
@@ -8,6 +8,7 @@ import android.content.ContextWrapper;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.content.res.XmlResourceParser;
|
import android.content.res.XmlResourceParser;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -22,10 +23,7 @@ import android.view.ViewGroup;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.WindowManagerImpl;
|
import android.view.WindowManagerImpl;
|
||||||
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlAttribute;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -51,16 +49,27 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
*
|
*
|
||||||
* @param className class name of activity or null
|
* @param className class name of activity or null
|
||||||
* @return instance of main activity class
|
* @return instance of main activity class
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private static Activity createMainActivity(String className, long native_window) throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException {
|
private static Activity createMainActivity(String className, long native_window) throws Exception {
|
||||||
if (className == null) {
|
if (className == null) {
|
||||||
InputStream inStream = ClassLoader.getSystemClassLoader().getResourceAsStream("AndroidManifest.xml");
|
XmlResourceParser parser = Context.this_application.getAssets().openXmlResourceParser("AndroidManifest.xml");
|
||||||
AndroidManifestBlock block = AndroidManifestBlock.load(inStream);
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
className = block.getMainActivity().searchAttributeByResourceId(AndroidManifestBlock.ID_name).getValueAsString();
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "activity".equals(parser.getName())) {
|
||||||
|
className = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name");
|
||||||
|
}
|
||||||
|
// check if it is the main activity
|
||||||
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "action".equals(parser.getName())) {
|
||||||
|
if ("android.intent.action.MAIN".equals(parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name"))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parser.close();
|
||||||
if(className.indexOf('.') == -1)
|
if(className.indexOf('.') == -1)
|
||||||
className = "." + className;
|
className = "." + className;
|
||||||
if (className.startsWith("."))
|
if (className.startsWith("."))
|
||||||
className = block.getPackageName() + className;
|
className = Context.this_application.getPackageName() + className;
|
||||||
} else {
|
} else {
|
||||||
className = className.replace('/', '.');
|
className = className.replace('/', '.');
|
||||||
}
|
}
|
||||||
@@ -76,13 +85,30 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
layout_inflater = new LayoutInflater();
|
layout_inflater = new LayoutInflater();
|
||||||
intent = new Intent();
|
intent = new Intent();
|
||||||
|
|
||||||
ResXmlAttribute label;
|
CharSequence label = null;
|
||||||
if((label = manifest.getActivityByName(getClass().getName()).searchAttributeByResourceId(AndroidManifestBlock.ID_label)) != null
|
CharSequence app_label = null;
|
||||||
|| (label = manifest.getApplicationElement().searchAttributeByResourceId(AndroidManifestBlock.ID_label)) != null) {
|
try (XmlResourceParser parser = getAssets().openXmlResourceParser("AndroidManifest.xml")) {
|
||||||
if(label.getValueType() == com.reandroid.arsc.value.ValueType.STRING)
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
setTitle(label.getValueAsString());
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "application".equals(parser.getName())) {
|
||||||
else
|
TypedArray a = obtainStyledAttributes(parser, R.styleable.AndroidManifestApplication);
|
||||||
setTitle(getString(label.getData()));
|
app_label = a.getText(R.styleable.AndroidManifestApplication_label);
|
||||||
|
a.recycle();
|
||||||
|
} else if (parser.getEventType() == XmlResourceParser.START_TAG && "activity".equals(parser.getName())) {
|
||||||
|
if (getClass().getName().equals(parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name"))) {
|
||||||
|
TypedArray a = obtainStyledAttributes(parser, R.styleable.AndroidManifestActivity);
|
||||||
|
label = a.getText(R.styleable.AndroidManifestActivity_label);
|
||||||
|
a.recycle();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (label != null) {
|
||||||
|
setTitle(label);
|
||||||
|
} else if (app_label != null) {
|
||||||
|
setTitle(app_label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,15 @@ package android.app;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Bitmap;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.BitmapFactory;
|
import android.content.res.XmlResourceParser;
|
||||||
import com.reandroid.apk.AndroidFrameworks;
|
import android.R;
|
||||||
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.ContextWrapper;
|
import android.content.ContextWrapper;
|
||||||
|
|
||||||
public class Application extends ContextWrapper {
|
public class Application extends ContextWrapper {
|
||||||
private String app_icon_path = null;
|
private String app_icon_path = null;
|
||||||
|
private String app_label = null;
|
||||||
public long native_window;
|
public long native_window;
|
||||||
|
|
||||||
private String get_app_icon_path() {
|
private String get_app_icon_path() {
|
||||||
@@ -21,8 +18,7 @@ public class Application extends ContextWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String get_app_label() {
|
private String get_app_label() {
|
||||||
int app_label_resid = manifest.getApplicationElement().searchAttributeByResourceId(AndroidManifestBlock.ID_label).getData();
|
return app_label;
|
||||||
return getResources().getString(app_label_resid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ActivityLifecycleCallbacks {
|
public interface ActivityLifecycleCallbacks {
|
||||||
@@ -52,12 +48,16 @@ public class Application extends ContextWrapper {
|
|||||||
public Application() {
|
public Application() {
|
||||||
super(new Context());
|
super(new Context());
|
||||||
/* TODO: is this the right place to put this? */
|
/* TODO: is this the right place to put this? */
|
||||||
InputStream inStream = ClassLoader.getSystemClassLoader().getResourceAsStream("AndroidManifest.xml");
|
try (XmlResourceParser parser = getAssets().openXmlResourceParser("AndroidManifest.xml")) {
|
||||||
try {
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
AndroidManifestBlock manifest = AndroidManifestBlock.load(inStream);
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "application".equals(parser.getName())) {
|
||||||
int app_icon_resid = manifest.getIconResourceId();
|
TypedArray a = getResources().obtainAttributes(parser, R.styleable.AndroidManifestApplication);
|
||||||
app_icon_path = r.getString(app_icon_resid);
|
app_icon_path = a.getString(R.styleable.AndroidManifestApplication_icon);
|
||||||
} catch (IOException e) {
|
app_label = a.getString(R.styleable.AndroidManifestApplication_label);
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.content.pm.ActivityInfo;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.content.res.XmlResourceParser;
|
||||||
// import android.graphics.PixelFormat;
|
// import android.graphics.PixelFormat;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -34,13 +35,8 @@ import android.view.SurfaceView;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlAttribute;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlElement;
|
|
||||||
// import android.view.inputmethod.InputMethodManager;
|
// import android.view.inputmethod.InputMethodManager;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience for implementing an activity that will be implemented
|
* Convenience for implementing an activity that will be implemented
|
||||||
@@ -166,26 +162,28 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback,
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
// parse AndroidManifest.xml to get name and entry of native lib
|
// parse AndroidManifest.xml to get name and entry of native lib
|
||||||
try (InputStream inStream = ClassLoader.getSystemClassLoader().getResourceAsStream("AndroidManifest.xml")) {
|
try (XmlResourceParser parser = getAssets().openXmlResourceParser("AndroidManifest.xml")) {
|
||||||
for (ResXmlElement activity : AndroidManifestBlock.load(inStream).listActivities()) {
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
if (!getClass().getName().equals(activity.searchAttributeByResourceId(AndroidManifestBlock.ID_name).getValueAsString())) {
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "activity".equals(parser.getName())) {
|
||||||
continue;
|
if (!getClass().getName().equals(parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name"))) {
|
||||||
}
|
|
||||||
for (ResXmlElement metaData : activity.listElements(AndroidManifestBlock.TAG_meta_data)) {
|
|
||||||
ResXmlAttribute name = metaData.searchAttributeByResourceId(AndroidManifestBlock.ID_name);
|
|
||||||
ResXmlAttribute value = metaData.searchAttributeByResourceId(AndroidManifestBlock.ID_value);
|
|
||||||
if (name == null || value == null) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (META_DATA_LIB_NAME.equals(name.getValueAsString())) {
|
for (; !(parser.getEventType() == XmlResourceParser.END_TAG && "activity".equals(parser.getName())); parser.next()) {
|
||||||
libname = value.getValueAsString();
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "meta-data".equals(parser.getName())) {
|
||||||
}
|
String name = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name");
|
||||||
if (META_DATA_FUNC_NAME.equals(name.getValueAsString())) {
|
String value = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "value");
|
||||||
funcname = value.getValueAsString();
|
if (META_DATA_LIB_NAME.equals(name)) {
|
||||||
|
libname = value;
|
||||||
|
}
|
||||||
|
if (META_DATA_FUNC_NAME.equals(name)) {
|
||||||
|
funcname = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
package android.content;
|
package android.content;
|
||||||
|
|
||||||
import java.util.List;
|
import android.content.res.XmlResourceParser;
|
||||||
|
|
||||||
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlElement;
|
|
||||||
|
|
||||||
public class ContentProvider {
|
public class ContentProvider {
|
||||||
|
|
||||||
static void createContentProviders() throws ReflectiveOperationException {
|
static void createContentProviders() throws Exception {
|
||||||
List<ResXmlElement> providers = Context.manifest.getApplicationElement().listElements(AndroidManifestBlock.TAG_provider);
|
XmlResourceParser parser = Context.this_application.getAssets().openXmlResourceParser("AndroidManifest.xml");
|
||||||
System.out.println(providers);
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
for (ResXmlElement providerElement : providers) {
|
if (parser.getEventType() != XmlResourceParser.START_TAG || !"provider".equals(parser.getName()))
|
||||||
String providerName = providerElement.searchAttributeByResourceId(AndroidManifestBlock.ID_name).getValueAsString();
|
continue;
|
||||||
|
String providerName = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name");
|
||||||
if (providerName.startsWith(".")) {
|
if (providerName.startsWith(".")) {
|
||||||
providerName = Context.manifest.getPackageName() + providerName;
|
providerName = Context.this_application.getPackageName() + providerName;
|
||||||
}
|
}
|
||||||
System.out.println("creating " + providerName);
|
System.out.println("creating " + providerName);
|
||||||
Class<? extends ContentProvider> providerCls = Class.forName(providerName).asSubclass(ContentProvider.class);
|
Class<? extends ContentProvider> providerCls = Class.forName(providerName).asSubclass(ContentProvider.class);
|
||||||
ContentProvider provider = providerCls.getConstructor().newInstance();
|
ContentProvider provider = providerCls.getConstructor().newInstance();
|
||||||
provider.onCreate();
|
provider.onCreate();
|
||||||
}
|
}
|
||||||
|
parser.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCreate() {return false;}
|
public boolean onCreate() {return false;}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package android.content;
|
package android.content;
|
||||||
|
|
||||||
|
import android.R;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
@@ -15,6 +16,7 @@ import android.content.res.AssetManager;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
import android.content.res.XmlResourceParser;
|
||||||
import android.database.DatabaseErrorHandler;
|
import android.database.DatabaseErrorHandler;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@@ -43,9 +45,6 @@ import android.view.WindowManagerImpl;
|
|||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlAttribute;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@@ -68,7 +67,6 @@ public class Context extends Object {
|
|||||||
public static final String WINDOW_SERVICE = "window";
|
public static final String WINDOW_SERVICE = "window";
|
||||||
public static final String INPUT_METHOD_SERVICE = "input";
|
public static final String INPUT_METHOD_SERVICE = "input";
|
||||||
public static final String POWER_SERVICE = "power";
|
public static final String POWER_SERVICE = "power";
|
||||||
public static AndroidManifestBlock manifest = null;
|
|
||||||
|
|
||||||
public static Vibrator vibrator;
|
public static Vibrator vibrator;
|
||||||
|
|
||||||
@@ -101,33 +99,51 @@ public class Context extends Object {
|
|||||||
theme = r.newTheme();
|
theme = r.newTheme();
|
||||||
application_info = new ApplicationInfo();
|
application_info = new ApplicationInfo();
|
||||||
application_info.dataDir = Environment.getExternalStorageDirectory().getAbsolutePath();
|
application_info.dataDir = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||||
InputStream inStream = ClassLoader.getSystemClassLoader().getResourceAsStream("AndroidManifest.xml");
|
try (XmlResourceParser parser = assets.openXmlResourceParser("AndroidManifest.xml")) {
|
||||||
try {
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
manifest = AndroidManifestBlock.load(inStream);
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "uses-sdk".equals(parser.getName())) {
|
||||||
Integer targetSdkVersion = manifest.getTargetSdkVersion();
|
application_info.targetSdkVersion = parser.getAttributeIntValue(null, "targetSdkVersion", 0);
|
||||||
if (targetSdkVersion != null)
|
}
|
||||||
application_info.targetSdkVersion = targetSdkVersion;
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "manifest".equals(parser.getName())) {
|
||||||
} catch (IOException e) {
|
application_info.packageName = parser.getAttributeValue(null, "package");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static native void native_updateConfig(Configuration config);
|
protected static native void native_updateConfig(Configuration config);
|
||||||
|
|
||||||
static Application createApplication(long native_window) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException {
|
static Application createApplication(long native_window) throws Exception {
|
||||||
Application application;
|
Application application;
|
||||||
ResXmlAttribute application_name = manifest.getApplicationElement().searchAttributeByResourceId(AndroidManifestBlock.ID_name);
|
CharSequence application_name = null;
|
||||||
String className = (application_name != null) ? application_name.getValueAsString() : "android.app.Application";
|
int application_theme = 0;
|
||||||
|
String packageName = null;
|
||||||
|
XmlResourceParser parser = assets.openXmlResourceParser("AndroidManifest.xml");
|
||||||
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "manifest".equals(parser.getName())) {
|
||||||
|
packageName = parser.getAttributeValue(null, "package");
|
||||||
|
}
|
||||||
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "application".equals(parser.getName())) {
|
||||||
|
TypedArray a = r.obtainAttributes(parser, R.styleable.AndroidManifestApplication);
|
||||||
|
application_name = a.getText(R.styleable.AndroidManifestApplication_name);
|
||||||
|
application_theme = a.getResourceId(R.styleable.AndroidManifestApplication_theme, 0);
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parser.close();
|
||||||
|
|
||||||
|
String className = (application_name != null) ? application_name.toString() : "android.app.Application";
|
||||||
if(className.indexOf('.') == -1)
|
if(className.indexOf('.') == -1)
|
||||||
className = "." + className;
|
className = "." + className;
|
||||||
if (className.startsWith("."))
|
if (className.startsWith("."))
|
||||||
className = manifest.getPackageName() + className;
|
className = packageName + className;
|
||||||
Class<? extends Application> cls = Class.forName(className).asSubclass(Application.class);
|
Class<? extends Application> cls = Class.forName(className).asSubclass(Application.class);
|
||||||
Constructor<? extends Application> constructor = cls.getConstructor();
|
Constructor<? extends Application> constructor = cls.getConstructor();
|
||||||
application = constructor.newInstance();
|
application = constructor.newInstance();
|
||||||
ResXmlAttribute application_theme = manifest.getApplicationElement().searchAttributeByResourceId(AndroidManifestBlock.ID_theme);
|
if (application_theme != 0)
|
||||||
if (application_theme != null)
|
application.setTheme(application_theme);
|
||||||
application.setTheme(application_theme.getData());
|
|
||||||
application.native_window = native_window;
|
application.native_window = native_window;
|
||||||
this_application = application;
|
this_application = application;
|
||||||
return application;
|
return application;
|
||||||
@@ -228,7 +244,7 @@ public class Context extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPackageName() {
|
public String getPackageName() {
|
||||||
return manifest.getPackageName();
|
return application_info.packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPackageCodePath() {
|
public String getPackageCodePath() {
|
||||||
|
|||||||
@@ -16,22 +16,17 @@
|
|||||||
|
|
||||||
package android.content.pm;
|
package android.content.pm;
|
||||||
|
|
||||||
|
import android.R;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.content.res.XmlResourceParser;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
|
||||||
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlAttribute;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlElement;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overall information about the contents of a package. This corresponds
|
* Overall information about the contents of a package. This corresponds
|
||||||
* to all of the information collected from AndroidManifest.xml.
|
* to all of the information collected from AndroidManifest.xml.
|
||||||
*/
|
*/
|
||||||
public class PackageInfo {
|
public class PackageInfo {
|
||||||
private static AndroidManifestBlock manifest = null; // TODO: only ever load this once, in one place
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of this package. From the <manifest> tag's "name"
|
* The name of this package. From the <manifest> tag's "name"
|
||||||
@@ -242,64 +237,55 @@ public class PackageInfo {
|
|||||||
*/
|
*/
|
||||||
public String requiredAccountType;
|
public String requiredAccountType;
|
||||||
|
|
||||||
static {
|
public PackageInfo() {
|
||||||
InputStream inStream = ClassLoader.getSystemClassLoader().getResourceAsStream("AndroidManifest.xml");
|
applicationInfo = new ApplicationInfo();
|
||||||
try {
|
try {
|
||||||
manifest = AndroidManifestBlock.load(inStream);
|
XmlResourceParser parser = Context.this_application.getAssets().openXmlResourceParser("AndroidManifest.xml");
|
||||||
} catch (IOException e) {
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "manifest".equals(parser.getName())) {
|
||||||
|
packageName = parser.getAttributeValue(null, "package");
|
||||||
|
versionCode = parser.getAttributeIntValue("http://schemas.android.com/apk/res/android", "versionCode", -1);
|
||||||
|
versionName = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "versionName");
|
||||||
|
}
|
||||||
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "application".equals(parser.getName())) {
|
||||||
|
for (; !(parser.getEventType() == XmlResourceParser.END_TAG && "application".equals(parser.getName())); parser.next()) {
|
||||||
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "meta-data".equals(parser.getName())) {
|
||||||
|
TypedArray a = Context.this_application.getResources().obtainAttributes(parser, R.styleable.AndroidManifestMetaData);
|
||||||
|
String metadata_name = a.getString(R.styleable.AndroidManifestMetaData_name);
|
||||||
|
if (metadata_name == null || !a.hasValue(R.styleable.AndroidManifestMetaData_value)) {
|
||||||
|
a.recycle();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
TypedValue metadata_value = new TypedValue();
|
||||||
|
a.getValue(R.styleable.AndroidManifestMetaData_value, metadata_value);
|
||||||
|
a.recycle();
|
||||||
|
|
||||||
|
switch(metadata_value.type) {
|
||||||
|
case TypedValue.TYPE_STRING:
|
||||||
|
System.out.println("PackageInfo(): applicationInfo.metaData.putString("+metadata_name+", "+metadata_value.string+")");
|
||||||
|
applicationInfo.metaData.putString(metadata_name, metadata_value.string.toString());
|
||||||
|
break;
|
||||||
|
case TypedValue.TYPE_INT_BOOLEAN:
|
||||||
|
System.out.println("PackageInfo(): applicationInfo.metaData.putBoolean("+metadata_name+", "+(metadata_value.data != 0)+")");
|
||||||
|
applicationInfo.metaData.putBoolean(metadata_name, metadata_value.data != 0);
|
||||||
|
break;
|
||||||
|
case TypedValue.TYPE_INT_DEC:
|
||||||
|
case TypedValue.TYPE_INT_HEX:
|
||||||
|
System.out.println("PackageInfo(): applicationInfo.metaData.putInt("+metadata_name+", "+metadata_value.data+")");
|
||||||
|
applicationInfo.metaData.putInt(metadata_name, metadata_value.data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
System.out.println("PackageInfo(): metaData: "+metadata_name+": type "+metadata_value.type+" not handled!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public PackageInfo() {
|
|
||||||
packageName = manifest.getPackageName();
|
|
||||||
versionCode = manifest.getVersionCode();
|
|
||||||
versionName = manifest.getVersionName();
|
|
||||||
|
|
||||||
System.out.println("PackageInfo()");
|
|
||||||
|
|
||||||
applicationInfo = new ApplicationInfo();
|
|
||||||
|
|
||||||
ResXmlElement application = manifest.getApplicationElement();
|
|
||||||
for (ResXmlElement metaData : application.listElements(AndroidManifestBlock.TAG_meta_data)) {
|
|
||||||
ResXmlAttribute name = metaData.searchAttributeByResourceId(AndroidManifestBlock.ID_name);
|
|
||||||
ResXmlAttribute value = metaData.searchAttributeByResourceId(AndroidManifestBlock.ID_value);
|
|
||||||
if (name == null || value == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String metadata_name = name.getValueAsString();
|
|
||||||
TypedValue metadata_value = new TypedValue();
|
|
||||||
int data = value.getData();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Context.r.getValue(data, metadata_value, true);
|
|
||||||
} catch (android.content.res.Resources.NotFoundException e) {
|
|
||||||
System.out.println("PackageInfo(): error getting value for '"+metadata_name+"'");
|
|
||||||
e.printStackTrace();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(metadata_value.type) {
|
|
||||||
case TypedValue.TYPE_STRING:
|
|
||||||
System.out.println("PackageInfo(): applicationInfo.metaData.putString("+metadata_name+", "+metadata_value.string+")");
|
|
||||||
applicationInfo.metaData.putString(metadata_name, value.getValueAsString());
|
|
||||||
break;
|
|
||||||
case TypedValue.TYPE_INT_BOOLEAN:
|
|
||||||
System.out.println("PackageInfo(): applicationInfo.metaData.putBoolean("+metadata_name+", "+metadata_value.data != 0+")");
|
|
||||||
applicationInfo.metaData.putBoolean(metadata_name, metadata_value.data != 0);
|
|
||||||
break;
|
|
||||||
case TypedValue.TYPE_INT_DEC:
|
|
||||||
case TypedValue.TYPE_INT_HEX:
|
|
||||||
System.out.println("PackageInfo(): applicationInfo.metaData.putInt("+metadata_name+", "+metadata_value.data+")");
|
|
||||||
applicationInfo.metaData.putInt(metadata_name, metadata_value.data);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.out.println("PackageInfo(): metaData: "+metadata_name+": type "+metadata_value.type+" not handled!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("PackageInfo(): packageName: >"+packageName+"<, versionCode: >"+versionCode+"<, versionName: >"+versionName+"<");
|
System.out.println("PackageInfo(): packageName: >"+packageName+"<, versionCode: >"+versionCode+"<, versionName: >"+versionName+"<");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,10 +38,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlAttribute;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlElement;
|
|
||||||
|
|
||||||
class IPackageInstallObserver {}
|
class IPackageInstallObserver {}
|
||||||
class VerificationParams {}
|
class VerificationParams {}
|
||||||
class ContainerEncryptionParams {}
|
class ContainerEncryptionParams {}
|
||||||
@@ -1693,32 +1689,37 @@ public class PackageManager {
|
|||||||
* to modify the data returned.
|
* to modify the data returned.
|
||||||
*
|
*
|
||||||
* @return ProviderInfo containing information about the service.
|
* @return ProviderInfo containing information about the service.
|
||||||
|
* @throws Exception
|
||||||
*
|
*
|
||||||
* @see #GET_META_DATA
|
* @see #GET_META_DATA
|
||||||
* @see #GET_SHARED_LIBRARY_FILES
|
* @see #GET_SHARED_LIBRARY_FILES
|
||||||
*/
|
*/
|
||||||
public ProviderInfo getProviderInfo(ComponentName component,
|
public ProviderInfo getProviderInfo(ComponentName component,
|
||||||
int flags) throws NameNotFoundException {
|
int flags) throws Exception {
|
||||||
ProviderInfo providerInfo = new ProviderInfo();
|
ProviderInfo providerInfo = new ProviderInfo();
|
||||||
if ((flags & GET_META_DATA) == GET_META_DATA) {
|
if ((flags & GET_META_DATA) == GET_META_DATA) {
|
||||||
String cls = component.getClassName();
|
String cls = component.getClassName();
|
||||||
List<ResXmlElement> providers = Context.manifest.getApplicationElement().listElements(AndroidManifestBlock.TAG_provider);
|
XmlResourceParser parser = Context.this_application.getAssets().openXmlResourceParser("AndroidManifest.xml");
|
||||||
for (ResXmlElement providerElement : providers) {
|
for(; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
String providerName = providerElement.searchAttributeByResourceId(AndroidManifestBlock.ID_name).getValueAsString();
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "provider".equals(parser.getName())) {
|
||||||
if (providerName.startsWith(".")) {
|
String providerName = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name");
|
||||||
providerName = Context.manifest.getPackageName() + providerName;
|
if (providerName.startsWith("."))
|
||||||
}
|
providerName = Context.this_application.getPackageName() + providerName;
|
||||||
if (providerName.equals(cls)) {
|
if (!providerName.equals(cls))
|
||||||
List<ResXmlElement> metaDatas = providerElement.listElements(AndroidManifestBlock.TAG_meta_data);
|
continue;
|
||||||
Bundle bundle = new Bundle(metaDatas.size());
|
Bundle bundle = new Bundle();
|
||||||
for (ResXmlElement metaData : metaDatas) {
|
for (; !(parser.getEventType() == XmlResourceParser.END_TAG && "provider".equals(parser.getName())); parser.next()) {
|
||||||
bundle.putString(metaData.searchAttributeByResourceId(AndroidManifestBlock.ID_name).getValueAsString(),
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "meta-data".equals(parser.getName())) {
|
||||||
metaData.searchAttributeByResourceId(AndroidManifestBlock.ID_value).getValueAsString());
|
String metaName = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name");
|
||||||
|
String metaValue = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "value");
|
||||||
|
bundle.putString(metaName, metaValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
providerInfo.metaData = bundle;
|
providerInfo.metaData = bundle;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
parser.close();
|
||||||
}
|
}
|
||||||
return providerInfo;
|
return providerInfo;
|
||||||
}
|
}
|
||||||
@@ -2424,23 +2425,29 @@ public class PackageManager {
|
|||||||
*
|
*
|
||||||
* @return ContentProviderInfo Information about the provider, if found,
|
* @return ContentProviderInfo Information about the provider, if found,
|
||||||
* else null.
|
* else null.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public ProviderInfo resolveContentProvider(String authority, int flags) {
|
public ProviderInfo resolveContentProvider(String authority, int flags) throws Exception {
|
||||||
ProviderInfo providerInfo = new ProviderInfo();
|
ProviderInfo providerInfo = new ProviderInfo();
|
||||||
List<ResXmlElement> providers = Context.manifest.getApplicationElement().listElements(AndroidManifestBlock.TAG_provider);
|
XmlResourceParser parser = Context.this_application.getAssets().openXmlResourceParser("AndroidManifest.xml");
|
||||||
for (ResXmlElement providerElement : providers) {
|
for (; parser.getEventType() != XmlResourceParser.END_DOCUMENT; parser.next()) {
|
||||||
String providerAuthority = providerElement.searchAttributeByResourceId(AndroidManifestBlock.ID_authorities).getValueAsString();
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "provider".equals(parser.getName())) {
|
||||||
if (providerAuthority.startsWith("."))
|
String providerAuthority = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "authorities");
|
||||||
providerAuthority = Context.manifest.getPackageName() + providerAuthority;
|
if (providerAuthority.startsWith("."))
|
||||||
if (!providerAuthority.equals(authority))
|
providerAuthority = Context.this_application.getPackageName() + providerAuthority;
|
||||||
continue;
|
if (!providerAuthority.equals(authority))
|
||||||
for (ResXmlElement metaData : providerElement.listElements(AndroidManifestBlock.TAG_meta_data)) {
|
continue;
|
||||||
ResXmlAttribute metaName = metaData.searchAttributeByResourceId(AndroidManifestBlock.ID_name);
|
for (; !(parser.getEventType() == XmlResourceParser.END_TAG && "provider".equals(parser.getName())); parser.next()) {
|
||||||
ResXmlAttribute metaRes = metaData.searchAttributeByResourceId(AndroidManifestBlock.ID_resource);
|
if (parser.getEventType() == XmlResourceParser.START_TAG && "meta-data".equals(parser.getName())) {
|
||||||
providerInfo.metaData.putInt(metaName.getValueAsString(), metaRes.getData());
|
String metaName = parser.getAttributeValue("http://schemas.android.com/apk/res/android", "name");
|
||||||
|
int metaRes = parser.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "resource", -1);
|
||||||
|
providerInfo.metaData.putInt(metaName, metaRes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
parser.close();
|
||||||
return providerInfo;
|
return providerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ import android.util.AttributeSet;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlDocument;
|
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlPullParser;
|
|
||||||
import com.reandroid.arsc.value.ValueItem;
|
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -34,6 +30,7 @@ import java.net.URL;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -112,10 +109,17 @@ public final class AssetManager {
|
|||||||
// ensureSystemAssets()
|
// ensureSystemAssets()
|
||||||
try {
|
try {
|
||||||
Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources("resources.arsc");
|
Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources("resources.arsc");
|
||||||
|
ArrayList<String> paths = new ArrayList<String>();
|
||||||
|
paths.add(null); // reserve first slot for framework-res.apk
|
||||||
while (resources.hasMoreElements()) {
|
while (resources.hasMoreElements()) {
|
||||||
URL resource = resources.nextElement();
|
String path = resources.nextElement().getPath();
|
||||||
String path = resource.getPath();
|
if (path.contains("framework-res.apk")) // needs to be first, so it can be overridden
|
||||||
if (!path.contains("com.google.android.gms")) { // ignore MicroG .apk
|
paths.set(0, path);
|
||||||
|
else if (!path.contains("com.google.android.gms")) // microg resources can not be merged
|
||||||
|
paths.add(path);
|
||||||
|
}
|
||||||
|
for (String path : paths) {
|
||||||
|
if (path != null) {
|
||||||
path = path.substring(path.indexOf("file:") + 5, path.indexOf("!/resources.arsc"));
|
path = path.substring(path.indexOf("file:") + 5, path.indexOf("!/resources.arsc"));
|
||||||
addAssetPath(path);
|
addAssetPath(path);
|
||||||
}
|
}
|
||||||
@@ -759,18 +763,7 @@ public final class AssetManager {
|
|||||||
if (defStyleRes == 0 && theme != 0 && loadThemeAttributeValue(theme, defStyleAttr, value, true) >= 0)
|
if (defStyleRes == 0 && theme != 0 && loadThemeAttributeValue(theme, defStyleAttr, value, true) >= 0)
|
||||||
defStyleRes = value.data;
|
defStyleRes = value.data;
|
||||||
if (defStyleRes == 0 && set != null) {
|
if (defStyleRes == 0 && set != null) {
|
||||||
if (parser instanceof ResXmlPullParser) {
|
defStyleRes = parser.getStyleAttribute();
|
||||||
ValueItem valueItem = ((ResXmlPullParser)parser).getAttribute(null, "style");
|
|
||||||
if (valueItem != null) {
|
|
||||||
value.type = valueItem.getType();
|
|
||||||
value.data = valueItem.getData();
|
|
||||||
if (theme != 0 && (value.type == TypedValue.TYPE_ATTRIBUTE))
|
|
||||||
loadThemeAttributeValue(theme, value.data, value, true);
|
|
||||||
defStyleRes = value.data;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
defStyleRes = parser.getStyleAttribute();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outIndices[0] = 0;
|
outIndices[0] = 0;
|
||||||
@@ -798,14 +791,8 @@ public final class AssetManager {
|
|||||||
value.assetCookie = -1;
|
value.assetCookie = -1;
|
||||||
found = true;
|
found = true;
|
||||||
} else if (xmlCache.containsKey(resId)) {
|
} else if (xmlCache.containsKey(resId)) {
|
||||||
if (parser instanceof ResXmlPullParser) {
|
value.type = XmlBlock.nativeGetAttributeDataType(((XmlBlock.Parser)parser).mParseState, xmlCache.get(resId));
|
||||||
ValueItem valueItem = ((ResXmlPullParser)parser).getResXmlAttributeAt(xmlCache.get(resId));
|
value.data = XmlBlock.nativeGetAttributeData(((XmlBlock.Parser)parser).mParseState, xmlCache.get(resId));
|
||||||
value.type = valueItem.getType();
|
|
||||||
value.data = valueItem.getData();
|
|
||||||
} else {
|
|
||||||
value.type = XmlBlock.nativeGetAttributeDataType(((XmlBlock.Parser)parser).mParseState, xmlCache.get(resId));
|
|
||||||
value.data = XmlBlock.nativeGetAttributeData(((XmlBlock.Parser)parser).mParseState, xmlCache.get(resId));
|
|
||||||
}
|
|
||||||
value.resourceId = 0;
|
value.resourceId = 0;
|
||||||
value.assetCookie = -1;
|
value.assetCookie = -1;
|
||||||
if (value.type != TypedValue.TYPE_ATTRIBUTE)
|
if (value.type != TypedValue.TYPE_ATTRIBUTE)
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ import android.util.LongSparseArray;
|
|||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import com.android.internal.util.XmlUtils;
|
import com.android.internal.util.XmlUtils;
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlPullParser;
|
|
||||||
import com.reandroid.arsc.value.ValueItem;
|
|
||||||
// import android.view.DisplayAdjustments;
|
// import android.view.DisplayAdjustments;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|||||||
@@ -16,15 +16,12 @@
|
|||||||
|
|
||||||
package android.content.res;
|
package android.content.res;
|
||||||
|
|
||||||
import android.content.pm.ActivityInfo;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import com.android.internal.util.XmlUtils;
|
import com.android.internal.util.XmlUtils;
|
||||||
import com.reandroid.arsc.chunk.xml.ResXmlPullParser;
|
|
||||||
import com.reandroid.arsc.item.ResXmlString;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@@ -156,12 +153,9 @@ public class TypedArray {
|
|||||||
if (type == TypedValue.TYPE_STRING) {
|
if (type == TypedValue.TYPE_STRING) {
|
||||||
final int cookie = data[index + AssetManager.STYLE_ASSET_COOKIE];
|
final int cookie = data[index + AssetManager.STYLE_ASSET_COOKIE];
|
||||||
if (cookie < 0) {
|
if (cookie < 0) {
|
||||||
if (mXml instanceof ResXmlPullParser)
|
CharSequence string = ((XmlBlock.Parser)mXml).getPooledString(data[index + AssetManager.STYLE_DATA]);
|
||||||
return ((ResXmlPullParser )mXml).getResXmlDocument().getStringPool().get(data[index + AssetManager.STYLE_DATA]).get();
|
if (string != null)
|
||||||
else {
|
return string.toString();
|
||||||
Thread.dumpStack();
|
|
||||||
System.exit(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -700,15 +694,9 @@ public class TypedArray {
|
|||||||
final int cookie = data[index + AssetManager.STYLE_ASSET_COOKIE];
|
final int cookie = data[index + AssetManager.STYLE_ASSET_COOKIE];
|
||||||
if (cookie < 0) {
|
if (cookie < 0) {
|
||||||
if (mXml != null) {
|
if (mXml != null) {
|
||||||
if (mXml instanceof ResXmlPullParser) {
|
CharSequence string = ((XmlBlock.Parser)mXml).getPooledString(data[index + AssetManager.STYLE_DATA]);
|
||||||
ResXmlString xmlString = ((ResXmlPullParser)mXml).getResXmlDocument().getStringPool().get(data[index + AssetManager.STYLE_DATA]);
|
if (string != null)
|
||||||
if (xmlString != null)
|
return string;
|
||||||
return xmlString.get();
|
|
||||||
} else {
|
|
||||||
CharSequence string = ((XmlBlock.Parser)mXml).getPooledString(data[index + AssetManager.STYLE_DATA]);
|
|
||||||
if (string != null)
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (data[index + AssetManager.STYLE_RESOURCE_ID] != 0) {
|
if (data[index + AssetManager.STYLE_RESOURCE_ID] != 0) {
|
||||||
return mResources.mAssets.getResourceText(data[index + AssetManager.STYLE_RESOURCE_ID]);
|
return mResources.mAssets.getResourceText(data[index + AssetManager.STYLE_RESOURCE_ID]);
|
||||||
|
|||||||
@@ -514,9 +514,6 @@ hax_jar = jar('hax', [
|
|||||||
'javax/microedition/khronos/opengles/GL11ExtensionPack.java',
|
'javax/microedition/khronos/opengles/GL11ExtensionPack.java',
|
||||||
'org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java',
|
'org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java',
|
||||||
],
|
],
|
||||||
dependencies: [
|
|
||||||
declare_dependency(link_with: hax_arsc_lib_jar)
|
|
||||||
],
|
|
||||||
java_args: [
|
java_args: [
|
||||||
'-bootclasspath', bootclasspath,
|
'-bootclasspath', bootclasspath,
|
||||||
'-source', '1.8', '-target', '1.8',
|
'-source', '1.8', '-target', '1.8',
|
||||||
|
|||||||
Reference in New Issue
Block a user