summaryrefslogtreecommitdiffstats
path: root/core/java/android/app
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-08-26 10:13:11 -0700
committerKenny Root <kroot@google.com>2010-08-27 16:40:06 -0700
commit85387d7ba36e56b291cbde87acb5a5b2200fe01c (patch)
treeadea29b181a25c2ffd8ecaebded62fb4d2dc1a93 /core/java/android/app
parent4f8c2f26bfd9de8c8a31369dbedd415c7d6d9699 (diff)
downloadframeworks_base-85387d7ba36e56b291cbde87acb5a5b2200fe01c.zip
frameworks_base-85387d7ba36e56b291cbde87acb5a5b2200fe01c.tar.gz
frameworks_base-85387d7ba36e56b291cbde87acb5a5b2200fe01c.tar.bz2
Allow native shared libraries in ASEC containers
This change moves the native library handling earlier in the package installation process so that it may be inserted into ASEC containers before they are finalized in the DefaultContainerService. Note that native libraries on SD card requires that vold mount ASEC containers without the "noexec" flag on the mount point. Change-Id: Ib34b1886bf6f94b99bb7b3781db6e9b5a58807ba
Diffstat (limited to 'core/java/android/app')
-rw-r--r--core/java/android/app/ActivityThread.java1
-rw-r--r--core/java/android/app/ApplicationLoaders.java10
-rw-r--r--core/java/android/app/LoadedApk.java8
3 files changed, 12 insertions, 7 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 084f637..ca6fc8a 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -3181,6 +3181,7 @@ public final class ActivityThread {
instrApp.sourceDir = ii.sourceDir;
instrApp.publicSourceDir = ii.publicSourceDir;
instrApp.dataDir = ii.dataDir;
+ instrApp.nativeLibraryDir = ii.nativeLibraryDir;
LoadedApk pi = getPackageInfo(instrApp,
appContext.getClassLoader(), false, true);
ContextImpl instrContext = new ContextImpl();
diff --git a/core/java/android/app/ApplicationLoaders.java b/core/java/android/app/ApplicationLoaders.java
index 2e301c9..9e3cd7e 100644
--- a/core/java/android/app/ApplicationLoaders.java
+++ b/core/java/android/app/ApplicationLoaders.java
@@ -19,6 +19,7 @@ package android.app;
import dalvik.system.PathClassLoader;
import java.util.HashMap;
+import java.util.Map;
class ApplicationLoaders
{
@@ -27,8 +28,7 @@ class ApplicationLoaders
return gApplicationLoaders;
}
- public ClassLoader getClassLoader(String zip, String appDataDir,
- ClassLoader parent)
+ public ClassLoader getClassLoader(String zip, String libPath, ClassLoader parent)
{
/*
* This is the parent we use if they pass "null" in. In theory
@@ -49,13 +49,13 @@ class ApplicationLoaders
* new ClassLoader for the zip archive.
*/
if (parent == baseParent) {
- ClassLoader loader = (ClassLoader)mLoaders.get(zip);
+ ClassLoader loader = mLoaders.get(zip);
if (loader != null) {
return loader;
}
PathClassLoader pathClassloader =
- new PathClassLoader(zip, appDataDir + "/lib", parent);
+ new PathClassLoader(zip, libPath, parent);
mLoaders.put(zip, pathClassloader);
return pathClassloader;
@@ -65,7 +65,7 @@ class ApplicationLoaders
}
}
- private final HashMap mLoaders = new HashMap();
+ private final Map<String, ClassLoader> mLoaders = new HashMap<String, ClassLoader>();
private static final ApplicationLoaders gApplicationLoaders
= new ApplicationLoaders();
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index 0f98152..0644f96 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -72,6 +72,7 @@ final class LoadedApk {
private final String mResDir;
private final String[] mSharedLibraries;
private final String mDataDir;
+ private final String mLibDir;
private final File mDataDirFile;
private final ClassLoader mBaseClassLoader;
private final boolean mSecurityViolation;
@@ -108,6 +109,7 @@ final class LoadedApk {
mSharedLibraries = aInfo.sharedLibraryFiles;
mDataDir = aInfo.dataDir;
mDataDirFile = mDataDir != null ? new File(mDataDir) : null;
+ mLibDir = aInfo.nativeLibraryDir;
mBaseClassLoader = baseLoader;
mSecurityViolation = securityViolation;
mIncludeCode = includeCode;
@@ -140,6 +142,7 @@ final class LoadedApk {
mSharedLibraries = null;
mDataDir = null;
mDataDirFile = null;
+ mLibDir = null;
mBaseClassLoader = null;
mSecurityViolation = false;
mIncludeCode = true;
@@ -279,11 +282,12 @@ final class LoadedApk {
* create the class loader.
*/
- if (ActivityThread.localLOGV) Slog.v(ActivityThread.TAG, "Class path: " + zip);
+ if (ActivityThread.localLOGV)
+ Slog.v(ActivityThread.TAG, "Class path: " + zip + ", JNI path: " + mLibDir);
mClassLoader =
ApplicationLoaders.getDefault().getClassLoader(
- zip, mDataDir, mBaseClassLoader);
+ zip, mLibDir, mBaseClassLoader);
initializeJavaContextClassLoader();
} else {
if (mBaseClassLoader == null) {