LoadedApk: Avoid unnecessary work when mIncludeCode == false.
am: 8995b00ce8
* commit '8995b00ce8f68f2a285a97c2ce711bea8c61179e':
LoadedApk: Avoid unnecessary work when mIncludeCode == false.
Change-Id: I53ae61c1e5aed49f25ba473d33e3cbe27a475b4f
This commit is contained in:
@@ -450,9 +450,6 @@ public final class LoadedApk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> zipPaths = new ArrayList<>();
|
|
||||||
final List<String> libPaths = new ArrayList<>();
|
|
||||||
|
|
||||||
if (mRegisterPackage) {
|
if (mRegisterPackage) {
|
||||||
try {
|
try {
|
||||||
ActivityManagerNative.getDefault().addPackageDependency(mPackageName);
|
ActivityManagerNative.getDefault().addPackageDependency(mPackageName);
|
||||||
@@ -461,8 +458,10 @@ public final class LoadedApk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<String> zipPaths = new ArrayList<>();
|
||||||
|
final List<String> libPaths = new ArrayList<>();
|
||||||
makePaths(mActivityThread, mApplicationInfo, zipPaths, libPaths);
|
makePaths(mActivityThread, mApplicationInfo, zipPaths, libPaths);
|
||||||
final String zip = mIncludeCode ? TextUtils.join(File.pathSeparator, zipPaths) : "";
|
|
||||||
final boolean isBundledApp = mApplicationInfo.isSystemApp()
|
final boolean isBundledApp = mApplicationInfo.isSystemApp()
|
||||||
&& !mApplicationInfo.isUpdatedSystemApp();
|
&& !mApplicationInfo.isUpdatedSystemApp();
|
||||||
|
|
||||||
@@ -476,10 +475,28 @@ public final class LoadedApk {
|
|||||||
|
|
||||||
final String librarySearchPath = TextUtils.join(File.pathSeparator, libPaths);
|
final String librarySearchPath = TextUtils.join(File.pathSeparator, libPaths);
|
||||||
|
|
||||||
|
// If we're not asked to include code, we construct a classloader that has
|
||||||
|
// no code path included. We still need to set up the library search paths
|
||||||
|
// and permitted path because NativeActivity relies on it (it attempts to
|
||||||
|
// call System.loadLibrary() on a classloader from a LoadedApk with
|
||||||
|
// mIncludeCode == false).
|
||||||
|
if (!mIncludeCode) {
|
||||||
|
if (mClassLoader == null) {
|
||||||
|
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
|
||||||
|
mClassLoader = ApplicationLoaders.getDefault().getClassLoader(
|
||||||
|
"" /* codePath */, mApplicationInfo.targetSdkVersion, isBundledApp,
|
||||||
|
librarySearchPath, libraryPermittedPath, mBaseClassLoader);
|
||||||
|
StrictMode.setThreadPolicy(oldPolicy);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* With all the combination done (if necessary, actually
|
* With all the combination done (if necessary, actually create the java class
|
||||||
* create the class loader.
|
* loader and set up JIT profiling support if necessary.
|
||||||
*/
|
*/
|
||||||
|
final String zip = TextUtils.join(File.pathSeparator, zipPaths);
|
||||||
|
|
||||||
if (ActivityThread.localLOGV)
|
if (ActivityThread.localLOGV)
|
||||||
Slog.v(ActivityThread.TAG, "Class path: " + zip +
|
Slog.v(ActivityThread.TAG, "Class path: " + zip +
|
||||||
|
|||||||
Reference in New Issue
Block a user