Merge "Use shared namespace for bundled app classloader"
This commit is contained in:
@@ -27,7 +27,7 @@ class ApplicationLoaders
|
||||
return gApplicationLoaders;
|
||||
}
|
||||
|
||||
public ClassLoader getClassLoader(String zip, String librarySearchPath,
|
||||
public ClassLoader getClassLoader(String zip, boolean isBundled, String librarySearchPath,
|
||||
String libraryPermittedPath, ClassLoader parent)
|
||||
{
|
||||
/*
|
||||
@@ -56,7 +56,8 @@ class ApplicationLoaders
|
||||
|
||||
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, zip);
|
||||
PathClassLoader pathClassloader =
|
||||
new PathClassLoader(zip, librarySearchPath, libraryPermittedPath, parent);
|
||||
new PathClassLoader(zip, isBundled, librarySearchPath,
|
||||
libraryPermittedPath, parent);
|
||||
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
|
||||
|
||||
mLoaders.put(zip, pathClassloader);
|
||||
|
||||
@@ -359,12 +359,21 @@ public final class LoadedApk {
|
||||
}
|
||||
}
|
||||
|
||||
String libraryPermittedPath = mAppDir + File.pathSeparator + mDataDir;
|
||||
boolean isBundledApp = false;
|
||||
|
||||
if (mApplicationInfo.isSystemApp()) {
|
||||
isBundledApp = true;
|
||||
// Add path to system libraries to libPaths;
|
||||
// Access to system libs should be limited
|
||||
// to bundled applications; this is why updated
|
||||
// system apps are not included.
|
||||
libPaths.add(System.getProperty("java.library.path"));
|
||||
|
||||
// This is necessary to grant bundled apps access to
|
||||
// libraries located in subdirectories of /system/lib
|
||||
libraryPermittedPath += File.pathSeparator +
|
||||
System.getProperty("java.library.path");
|
||||
}
|
||||
|
||||
final String librarySearchPath = TextUtils.join(File.pathSeparator, libPaths);
|
||||
@@ -382,10 +391,8 @@ public final class LoadedApk {
|
||||
// as this is early and necessary.
|
||||
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
|
||||
|
||||
String libraryPermittedPath = mAppDir + File.pathSeparator + mDataDir;
|
||||
|
||||
mClassLoader = ApplicationLoaders.getDefault().getClassLoader(zip, librarySearchPath,
|
||||
libraryPermittedPath, mBaseClassLoader);
|
||||
mClassLoader = ApplicationLoaders.getDefault().getClassLoader(zip, isBundledApp,
|
||||
librarySearchPath, libraryPermittedPath, mBaseClassLoader);
|
||||
|
||||
StrictMode.setThreadPolicy(oldPolicy);
|
||||
} else {
|
||||
|
||||
@@ -270,7 +270,7 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName
|
||||
bool needNativeBridge = false;
|
||||
|
||||
void* handle = OpenNativeLibrary(env, sdkVersion, pathStr, classLoader,
|
||||
libraryPath, isolationPath);
|
||||
false, libraryPath, isolationPath);
|
||||
if (handle == NULL) {
|
||||
if (NativeBridgeIsSupported(pathStr)) {
|
||||
handle = NativeBridgeLoadLibrary(pathStr, RTLD_LAZY);
|
||||
|
||||
Reference in New Issue
Block a user