summaryrefslogtreecommitdiff
path: root/src/main/java/com/android/apkzlib
AgeCommit message (Collapse)Author
2017-12-06Improve overlapping detection in ZFile.Paulo Casanova
ZFile now reports when files overlap in a zip. It previously failed with a VerifyException and now, at least in cases where the local header can still be read correctly (for example, a file contained inside another file), it reports a nice error that allows users to understand what the problem is. Bug: 69835362 Change-Id: Ib34df31f97805f1d5ec9ba917dce7374ea6a7d22 Test: included
2017-11-03Add read-only mode to ZFile.Paulo Casanova
When opening the zip file in read-only mode the file is never modified and any attempt to modify throws IllegalStateExeption. Test: included Bug: 62249349 Change-Id: I5e589502dfd4d8d112bc563d7ed28291143ec5ea
2017-11-02Fix buffer underflow bug in apkzlib.Paulo Casanova
If the extra fields has a header with data size that exceeds the available buffer, ExtraField would throw a buffer underflow instead of IOException and this would not be caught in ZFile's update. Test: included Bug: 68763077 Change-Id: I34db018526c8cd3a2bc3ebf6fb97604ed941ddfa
2017-10-30Minor fixes in apkzlib to remove warnings in G3.Paulo Casanova
Test: not needed Change-Id: I803c44cb78331a5df60c5d75fb96e0713aa85c0a
2017-10-27Improved 4-byte alignment fixes.Paulo Casanova
This improves tests for 4-byte alignment and does some small code cleanup to make the reason why we need 6 bytes of header for 4 byte alignment more clear. Bug: http://b/67995001 Test: Included Change-Id: I12148519bb360c3b71e97d880f31f111c4feb4aa
2017-10-27Minor fixes in EncodeUtils.Paulo Casanova
Made two minor fixes in EncodeUtils to remove Error Prone warnings and to get rid of a while(true) with a recursion loop that (reasonably) makes developers nervous. Test: no changes needed Bug: http://b/38159772 Change-Id: I12a5cf2310ded05bd2ca2f0565324a7d99331b70
2017-10-26Added support for zip file comments in apkzlib.Paulo Casanova
Test: included Bug: 67995565 Change-Id: I1984fce4f96fa82eae0dad6fd8dde05720bfeda1
2017-10-11Enable D8 by defaultIvan Gavrilovic
Set the android.enableD8 to true by default. This CL also improves the error logging when using D8. BUG: 67226453 Test: existing Change-Id: I1eb9d9382a0c15d293ecd96e29bae7456b5f49d5
2017-08-11Fix alignment when merging zips.Paulo Casanova
When merging a zip into an apk, apkzlib used to copy all the non-ignored files from the zip as-is. This was done to improve performance as it avoid recompressing files that were already compressed. However, if the files need to be uncompressed (for example, native libraries in M+ devices), this would not ensure that the libraries were uncompressed: if the libraries were compressed in the original zip file, they were copied as-is, i.e., compressed, to the apk breaking alignment. This CL fixes this by ensuring that files that *need* to be uncompressed (and only those) are actually added to the apk following compression and alignment rules. Test: included Bug: http://b/37926537 Change-Id: I69848b37ef33b4f0af07dde8c778c7823443d55b
2017-07-06Revert "Revert "move dexing to WorkerExecutor.""Ivan Gavrilovic
Original change: Icc60a18fd6850ab10bddb297fe7754f81f53809c This reverts commit 493e54f4aae54dec2e143a6835d260ce97c479ec. Test: existing Change-Id: I64864622e4c0d21fef4aee8ca8bfd313b0a49b38
2017-07-04Revert "move dexing to WorkerExecutor."Ivan Gavrilovic
This reverts commit 213b2542e6a1940e06798333737512bfa07c744f. Reason for revert: This breaks instant run e.g. Failure to verify dex file '/data/app/com.example.myapplication-2/split_lib_slice_1_apk.apk': Bad checksum (d6872a46, expected 31c62a46) I am reverting this change until I figure out what is wrong. Change-Id: Ica212868c99952f424d982e44561b282e591fa1c
2017-07-04move dexing to WorkerExecutor.Jerome Dochez
provide ability to run wit the WorkerExecutor as well as plain old Executor. remove the double locking effect of locking the file cache when dexing which lead to numerous deadlocks. Provide only one level of multiplexing by sharding all .jar files and folders and further bucketizing into 5 shards. Test: adapted existing unit tests, added new ones for new code. Change-Id: Icc60a18fd6850ab10bddb297fe7754f81f53809c
2017-06-28Don't leave a future uncompleted in case of a thrown ErrorSergey Prigogin
Test: existing tests Change-Id: I6ab471879d816173534d90024ba20ec1abecde50
2017-05-08Updated ZFile to use UTF-8 if needed.Paulo Casanova
If ASCII decoding fails, ZFile will now automatically try UTF-8. Change-Id: I29ef2cf3c043cf31d6c07c70271297356d2571f2 Test: Included
2017-05-02Allow javac to output resources.Chris Warrington
As some annotation processors output resources. This also updates various instant run components to properly detect if there were changes rather than assuming that if transforms ran that the changed inputs were interesting. Test: AutoServiceTest. Issue: https://issuetracker.google.com/37140464 Change-Id: I614f48cd52e65d35a5d1c188fce9357c37e1208e
2017-04-28Fix another directExecutor missing.Paulo Casanova
Test: None needed Change-Id: Iad0fc1b13d7521a2ddfada2ba27392d8d78d207e
2017-04-24Fixed array style declarations in ZFile.Paulo Casanova
https://www.google.com/url?sa=D&q=http%3A%2F%2Fgo%2Fjava-style%23s4.8.3.2-array-declarations Test: Not needed Change-Id: I1788dd8acd7cdd675914b4835fcf014d2b41bfea
2017-04-24Fixed use of direct executor.Paulo Casanova
go/lsc-require-executor-for-futures Change-Id: I8e111ace95cf6317d5ccbf340528f29782ff0421 Test: Not needed
2017-04-21Fixed bug in ZFile that did not allow RO open.Paulo Casanova
When opening a V2 signed APK, ZFile would force the file to be marked "dirty" when setting the extra offset for the central directory required by V2 signature. This would force the zip to be written. Test: included Change-Id: I799c1b7dd3a927591e9d3ed410494bfa0b33300b
2017-04-12Switch from out of process AAPT2 to jni.Chris Warrington
This depends on an updated aapt2 prebuilt. Test: existing gradle integration tests. Bug: 36165697 Change-Id: I1d0dbf2853db4111417421ebf0591659671e7b14
2017-03-23Merge "Make ZFileOptions setters return "this" for easier chaining." into ↵Pierre Lecesne
studio-master-dev am: fe8a72b490 Change-Id: I8c342193ac8b76f0870e21a927b9b2e874d72e64
2017-03-23Make ZFileOptions setters return "this" for easier chaining.Pierre Lecesne
Test: Compiles with bazel. Change-Id: I784bdf60ea336665e364601b94cb1327fe4539b3
2017-03-22Merge "Fix bug 35841603: updating zip with invalid extra" into studio-master-devPaulo Casanova
am: 9a5309c7a2 Change-Id: I92b700f615382582c52140dbe107a52d4e2d4fff
2017-03-22Fix bug 35841603: updating zip with invalid extraPaulo Casanova
ZFile did not support updating a zip that required aligning an entry using the extra field if the previous entry had an extra field that was non-empty but did not match the format in the spec. With this update, the contents of the extra field are discarded if they cannot be parsed. http://b/35841603 Test: Included JUnit. Change-Id: I977269b0648cd1b3fb7629929e02b9a00f2f0bbf
2017-02-15Various javadoc fixes.Chris Warrington
Test: cd tools && ./gradlew javadoc Change-Id: I61a4d788894aa76c2506b1fa9f529e418ce1e6ac
2017-02-06Merge "Added IncrementalFileMerger; update MergeJavaRes" into studio-master-devPaulo Casanova
2017-01-24Added IncrementalFileMerger; update MergeJavaResPaulo Casanova
Added IncrementalFileManager and associated classes. This class is capable of doing a perfect incremental merge of sets of relative files into a destination file, keeping track of where information came from. It makes java res merging incremental. Test: Included Change-Id: Iddc28655bb00e7859ebd9b5dc04093f6d886ea05
2017-01-24Workaround for not handling Zip64.Jerome Dochez
In the PackageAndroidArtifact, when receiving a Zip64 not handled exception, we will copy the zip64 file into a new one stripping all the .class files. This should hopefully generate a much smaller Zip file that's below the 64K limit. Bug : b.android.com/232803 Test: added unit tests. Change-Id: I536568dd86a4015a8dbc2fdfd8c896c2c4831543
2017-01-06Remove data descriptor entries from zip on writePaulo Casanova
ZFile does not support writing zip entries with data descriptor since it is silly in the use cases ZFile is supposed to be used. However, when opening an existing zip and changing entries, such as sorting or aligning entries, it may happen that some of the sorted entries have a data descriptor and writing them is unsupported. This CL fixes this by removing the data descriptor from all entries when the zip file is open for writing. Test: JUnit tests included Change-Id: Ifa4d11218d6c22701b784c879367da454d6322fc
2017-01-06Made apkzlib more forgiving with zip errors.Paulo Casanova
Non-critical errors are now reported to an optional verify log instead of failing to open the zip. By default the verify log just discards messages, but a verify that keeps them is also provided. Test: junit tests updated Change-Id: I74dd88a69035586d588b2343c04173b96a08c8c3
2017-01-04Standardize apkzfile.Paulo Casanova
Standardize field names and some minor comment issues. Test: No tests needed Change-Id: Ia2fd816d913239f73640656069ba9ae82e09f08a
2016-12-28Allow disabling version to extract in zip.Paulo Casanova
Add an option to ZFile to ignore the "version to extract" in the central directory header and in the local header. This allows supporting some zip tools that write weird values in the field. Test: JUnit tests included Change-Id: If8f14737ddb50f30508937e13f376cb30bde71e2
2016-12-12Use apksig's ApkSignerEngine for signing APKsAlex Klyubin
This switches the new APK build pipeline from its own logic for signing APKs to the logic provided by DefaultApkSignerEngine primitive from apksig library. The switch to apksig library also fixes two bugs in the APK signing pipeline: 1. digests of named sections of MANIFEST.MF are now correct in .SF files, and 2. signatures of DSA-signed APKs will now verify on Android platforms with API Level 8 and lower. Test: ./gradlew :base:integration-test:test --tests *SigningTest Test: ./tools/base/bazel/bazel build //tools/base/build-system/builder:builder_maven Bug: 31060257 Bug: 31306164 Change-Id: I742c1362a9eff63dc009a5419636041341cf7309
2016-11-25PackageSplitAbi now uses new packager.Paulo Casanova
The new IncrementalPackager is still only used in full mode as the task does not have usable incremental inputs. Change-Id: I08acf23b6609173a14e1fc7f9082e3ebf5e4c2a8 Test: Refactoring, no new tests needed.
2016-11-20Replacing com.android.annotations.* with JSR305 annotations.Pierre Lecesne
Test: Ran bazel build Change-Id: Iea73e46d3fd090bead2978f4960722cff59bcaaf
2016-11-17Removed use of direct executor.Paulo Casanova
This method was introduced in guava 18, but the new version of gradle still uses 17. The equivalent method in guava 17 has been deprecated in guava 18 so there is no way to have this working in both 17 and 18 without using the deprecated method. This fixes the dilemma by removing guava's call :) Test: Unnecessary Change-Id: I4469216f27f91ed8be10d88102454e32cdab4660
2016-11-16Renamed apkzlib packages.Paulo Casanova
Test: Included Change-Id: I9cce74b77719003875deaa5a0056e35f2930429e