Store entry alignment information in APK.
Data of uncompressed APK entries is often aligned to a multiple of 4 or 4096 in the APK to make it easier to mmap the data. Unfortunately, the current method for achieving alignment suffers from two issues: (1) the way it uses the Local File Header extra field is not compliant with ZIP format (for example, this prevents older versions of Python's zipfile from reading APKs: https://bugs.python.org/issue14315), and (2) it does not store information about the alignment multiple in the APK, making it harder/impossible to preserve the intended alignment when rearranging entries in the APK. This change solves these issues by switching to a different method for aligning data of uncompressed APK entries. Same as before, alignment is achieved using Local File Header entry field. What's different is that alignment is achieved by placing a well-formed extensible data field/block into the extra field. The new field/block contains the alignment multiple (e.g., 4 or 4096) as well as the necessary padding (if any). Compared to the original alignment method, the new method uses 6 more bytes for each uncompressed entry. Bug: 27461702 Change-Id: I8cffbecc50bf634b28fca5bc39eb23f671961cf9
Loading
Please register or sign in to comment