Merge "Frameworks/base: Optimize LoadedApk" into nyc-dev am: 8cb3b2bb5c
am: 3fbf298984
* commit '3fbf29898459d3b6d9fa1680c02650fd692c32e6':
Frameworks/base: Optimize LoadedApk
Change-Id: Id57874836bd9a4e13b57cad2fdc1ff28d6a8f19c
This commit is contained in:
@@ -458,8 +458,14 @@ public final class LoadedApk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> zipPaths = new ArrayList<>();
|
// Lists for the elements of zip/code and native libraries.
|
||||||
final List<String> libPaths = new ArrayList<>();
|
//
|
||||||
|
// Both lists are usually not empty. We expect on average one APK for the zip component,
|
||||||
|
// but shared libraries and splits are not uncommon. We expect at least three elements
|
||||||
|
// for native libraries (app-based, system, vendor). As such, give both some breathing
|
||||||
|
// space and initialize to a small value (instead of incurring growth code).
|
||||||
|
final List<String> zipPaths = new ArrayList<>(10);
|
||||||
|
final List<String> libPaths = new ArrayList<>(10);
|
||||||
makePaths(mActivityThread, mApplicationInfo, zipPaths, libPaths);
|
makePaths(mActivityThread, mApplicationInfo, zipPaths, libPaths);
|
||||||
|
|
||||||
final boolean isBundledApp = mApplicationInfo.isSystemApp()
|
final boolean isBundledApp = mApplicationInfo.isSystemApp()
|
||||||
@@ -495,8 +501,11 @@ public final class LoadedApk {
|
|||||||
/*
|
/*
|
||||||
* With all the combination done (if necessary, actually create the java class
|
* With all the combination done (if necessary, actually create the java class
|
||||||
* loader and set up JIT profiling support if necessary.
|
* loader and set up JIT profiling support if necessary.
|
||||||
|
*
|
||||||
|
* In many cases this is a single APK, so try to avoid the StringBuilder in TextUtils.
|
||||||
*/
|
*/
|
||||||
final String zip = TextUtils.join(File.pathSeparator, zipPaths);
|
final String zip = (zipPaths.size() == 1) ? zipPaths.get(0) :
|
||||||
|
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 +
|
||||||
|
|||||||
@@ -309,14 +309,13 @@ public class TextUtils {
|
|||||||
*/
|
*/
|
||||||
public static String join(CharSequence delimiter, Iterable tokens) {
|
public static String join(CharSequence delimiter, Iterable tokens) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
boolean firstTime = true;
|
Iterator<?> it = tokens.iterator();
|
||||||
for (Object token: tokens) {
|
if (it.hasNext()) {
|
||||||
if (firstTime) {
|
sb.append(it.next());
|
||||||
firstTime = false;
|
while (it.hasNext()) {
|
||||||
} else {
|
|
||||||
sb.append(delimiter);
|
sb.append(delimiter);
|
||||||
|
sb.append(it.next());
|
||||||
}
|
}
|
||||||
sb.append(token);
|
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user