summaryrefslogtreecommitdiff
path: root/src/test/java/com
AgeCommit message (Collapse)Author
2018-02-07Update package to com.android.tools.build.apkzlib.android-wear-p-preview-2android-p-preview-3android-p-preview-2android-p-preview-1Chris Warrington
From com.android.apkzlib. Test: existing. Change-Id: Ib3b21722d9052aded3f3071bfac38a07978ef933
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-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-26Added support for zip file comments in apkzlib.Paulo Casanova
Test: included Bug: 67995565 Change-Id: I1984fce4f96fa82eae0dad6fd8dde05720bfeda1
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-06-19Update to guava 22.Chris Warrington
Test: existing. Change-Id: I4aff40a45343a74cf524811d799b1eca733925da
2017-05-23Fix JarSigningTestIzabela Orlowska
The missing AndroidManifest.xml in the tested zip files was causing setting the "dirty" field to be set to true and the zip file being needlessly overwritten. Test: JarSigningTest Change-Id: I494fbcc257332d0eb8eceadf2938c2d74dd5bce5
2017-05-22Ignores a test broken by apksignestebandlc
This CL https://android-review.googlesource.com/#/c/390556/ Seems to have permanently broken the SignatureTest. But it cannot simply be reverted. Test: This is it. To be re-enabled. Change-Id: I3f6e2bac3346ef08601a04675420af0160f306a9
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-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-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-03-10Revert Change Ie45a734cDana Dahlstrom
… since we convinced Error Prone to drop InsecureCryptoUsage from error severity by default outside google3. Change-Id: Ic7d26ec2382189650c4faf7af533f7ba203bf309
2017-02-13Add @SuppressWarnings("InsecureCryptoUsage")Dana Dahlstrom
… to KeystoreHelper.generateKeyAndCertificate and SignatureTestUtils.generateSignature, which use algorithm specifications that aren't compile-time constant expressions. Change-Id: Ie45a734c883c9b687aab07c693b54446e61d7a03
2017-02-06Update to mockito-core 2.7.1Siva Velusamy
Code changes during this update: - Replace deprecated MockJUnitRunner with MockitoRule - Some tests include unncessary stubs. This CL simply allows them to continue by relaxing the strictness of the stub verification in those cases. - Remove use of mockito internal Sets class with "new HashSet<>" - Tests that assumed that anyString() will match nulls will now fail since the behavior has changed in mockito 2.0+. Such uses have been replaced with nullable(String.class) - Replace Matchers w/ ArgumentMatchers Test: existing tests pass Change-Id: Ie2b898da1ee61e7a4779919fec929efa47d2e0f9
2017-01-13ZFileTest fixes and improvementsPaulo Casanova
Fixed incorrect test and added some more tests to ZFileTest. Test: This is what this CL is all about Change-Id: I4dbc87580fab059f810344e1f86673e0b49c04d6
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
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-20Replacing com.android.annotations.* with JSR305 annotations.Pierre Lecesne
Test: Ran bazel build Change-Id: Iea73e46d3fd090bead2978f4960722cff59bcaaf
2016-11-17Fix bazel tests on apkzlib.Paulo Casanova
Test: This is what was actually fixed :) Change-Id: Idb2bb328896586dc54ff375ad5dd077cfc80f314
2016-11-16Renamed apkzlib packages.Paulo Casanova
Test: Included Change-Id: I9cce74b77719003875deaa5a0056e35f2930429e
2016-11-04Created apkzlib.Paulo Casanova
Moved all apk packaging code to a new library, apkzlib. This allows the code to be used by other projects that need to repackage apks. This CL will be followed by another one that will change the package names to something more appropriate, but this keeps changes smaller. Test: N/A Change-Id: I127940a00770871864ad00961ba94ab18bb160bc