summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorYohann Roussel <yroussel@google.com>2017-01-02 16:40:52 +0100
committerYohann Roussel <yroussel@google.com>2017-01-20 14:58:35 +0000
commitfe10f9fd25a4d7bb287d36b3730aa0d605115053 (patch)
tree9fda846e09accde83d80156315164a043ffffed1 /library
parentf5832474ebd6ec48f0f37bc1fd9e2576068e4ef2 (diff)
downloadmultidex-fe10f9fd25a4d7bb287d36b3730aa0d605115053.tar.gz
Check extracted dex only once per usage
The check is unnecessary in MultiDex.install because it was already done by MultiDexExtractor.load. The retry on bad extraction is also included in MultiDexExtractor.load so it was redundant too. Test: SupportMultidexHostTest (from tradefed) Change-Id: I877a99db0e0c562ac47a7c5c87d7f3e1d70884e6
Diffstat (limited to 'library')
-rw-r--r--library/src/android/support/multidex/MultiDex.java28
-rw-r--r--library/src/android/support/multidex/MultiDexExtractor.java2
2 files changed, 2 insertions, 28 deletions
diff --git a/library/src/android/support/multidex/MultiDex.java b/library/src/android/support/multidex/MultiDex.java
index 142f125..fad50d7 100644
--- a/library/src/android/support/multidex/MultiDex.java
+++ b/library/src/android/support/multidex/MultiDex.java
@@ -156,20 +156,7 @@ public final class MultiDex {
File dexDir = getDexDir(context, applicationInfo);
List<File> files = MultiDexExtractor.load(context, applicationInfo, dexDir, false);
- if (checkValidZipFiles(files)) {
- installSecondaryDexes(loader, dexDir, files);
- } else {
- Log.w(TAG, "Files were not valid zip files. Forcing a reload.");
- // Try again, but this time force a reload of the zip file.
- files = MultiDexExtractor.load(context, applicationInfo, dexDir, true);
-
- if (checkValidZipFiles(files)) {
- installSecondaryDexes(loader, dexDir, files);
- } else {
- // Second time didn't work, give up
- throw new RuntimeException("Zip files were not valid.");
- }
- }
+ installSecondaryDexes(loader, dexDir, files);
}
} catch (Exception e) {
@@ -245,19 +232,6 @@ public final class MultiDex {
}
/**
- * Returns whether all files in the list are valid zip files. If {@code files} is empty, then
- * returns true.
- */
- private static boolean checkValidZipFiles(List<File> files) {
- for (File file : files) {
- if (!MultiDexExtractor.verifyZipFile(file)) {
- return false;
- }
- }
- return true;
- }
-
- /**
* Locates a given field anywhere in the class inheritance hierarchy.
*
* @param instance an object to search the field into.
diff --git a/library/src/android/support/multidex/MultiDexExtractor.java b/library/src/android/support/multidex/MultiDexExtractor.java
index 6d09245..998ccec 100644
--- a/library/src/android/support/multidex/MultiDexExtractor.java
+++ b/library/src/android/support/multidex/MultiDexExtractor.java
@@ -374,7 +374,7 @@ final class MultiDexExtractor {
/**
* Returns whether the file is a valid zip file.
*/
- static boolean verifyZipFile(File file) {
+ private static boolean verifyZipFile(File file) {
try {
ZipFile zipFile = new ZipFile(file);
try {