summaryrefslogtreecommitdiffstats
path: root/packages/DefaultContainerService/src/com
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2011-07-12 14:14:01 -0700
committerKenny Root <kroot@google.com>2011-07-26 10:14:58 -0700
commit66269ea6f68f2f25888ce1080c94ac782742fafc (patch)
tree0ecbefcdbecf98cbacd428a422e6a2a846ac726e /packages/DefaultContainerService/src/com
parente432a0005180ba9ac2c1d7822c4761b475fddc51 (diff)
downloadframeworks_base-66269ea6f68f2f25888ce1080c94ac782742fafc.zip
frameworks_base-66269ea6f68f2f25888ce1080c94ac782742fafc.tar.gz
frameworks_base-66269ea6f68f2f25888ce1080c94ac782742fafc.tar.bz2
Move extract native libraries to JNI code
The built-in ZipFile class was quite a long time to find an unpack libraries. Move everything to using the libutils ZipFileRO class that goes quite a bit faster. Initial measurements are 6 times faster than the Java code. Also, read files off the disk and compare their CRC against the APK's CRC to see if we need to write the new file to disk. This also cuts down the bootup time by up to a second per APK that has native files. Change-Id: Ic464a7969a17368fb6a6b81d026888c4136c7603
Diffstat (limited to 'packages/DefaultContainerService/src/com')
-rw-r--r--packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java29
1 files changed, 1 insertions, 28 deletions
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
index 15c1653..626cc86 100644
--- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
+++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
@@ -515,34 +515,7 @@ public class DefaultContainerService extends IntentService {
// Check all the native files that need to be copied and add that to the
// container size.
- ZipFile zipFile;
- final List<Pair<ZipEntry, String>> nativeFiles;
- try {
- zipFile = new ZipFile(apkFile);
-
- if (outFiles != null) {
- nativeFiles = outFiles;
- } else {
- nativeFiles = new ArrayList<Pair<ZipEntry, String>>();
- }
-
- NativeLibraryHelper.listPackageNativeBinariesLI(zipFile, nativeFiles);
-
- final int N = nativeFiles.size();
- for (int i = 0; i < N; i++) {
- final Pair<ZipEntry, String> entry = nativeFiles.get(i);
-
- /*
- * Note a 1MB padding is added to the claimed size, so we don't
- * have to worry about block alignment here.
- */
- sizeBytes += entry.first.getSize();
- }
- } catch (ZipException e) {
- Log.w(TAG, "Failed to extract data from package file", e);
- } catch (IOException e) {
- Log.w(TAG, "Failed to cache package shared libs", e);
- }
+ sizeBytes += NativeLibraryHelper.sumNativeBinariesLI(apkFile);
int sizeMb = (int) (sizeBytes >> 20);
if ((sizeBytes - (sizeMb * 1024 * 1024)) > 0) {