summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2015-12-11 17:34:21 -0800
committerDimitry Ivanov <dimitry@google.com>2015-12-15 22:20:34 -0800
commit75b10ecccdd1881390075dd22c1d4f9bdf1c5828 (patch)
treee12397aa8e3c2ba205b1503722c3e360723406e8 /core/java
parentfbe12c4e0ff33f385704edd34aabe6eaa75fedbe (diff)
Use shared namespace for bundled app classloader
Allow bundled apps to reference platform native libraries located in subdirectories of the default library path (/system/lib/hw/* for example). In addition to this bundled apps need to share native libraries with default namespace. Added parameter to ApplicationLoaders.createClassLoader() to do just that. Bug: 26165097 Bug: 26164393 Change-Id: I833b4f758c4df8f8958d72eafd5d47ef14079ce1
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ApplicationLoaders.java5
-rw-r--r--core/java/android/app/LoadedApk.java15
2 files changed, 14 insertions, 6 deletions
diff --git a/core/java/android/app/ApplicationLoaders.java b/core/java/android/app/ApplicationLoaders.java
index ddb2d46eb118..7d0d1b4f5ee5 100644
--- a/core/java/android/app/ApplicationLoaders.java
+++ b/core/java/android/app/ApplicationLoaders.java
@@ -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);
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index 7313fd197c6d..855b21e80260 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -366,12 +366,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);
@@ -389,10 +398,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 {