Google has announced a new method of updating your apps on the Play Store. A previous change had reduced the size of updates by 47% on average, but this new one can reduce the size by a further 65%.
The new method is called File-by-File patching. Since APKs are zipped up and compressed, one can’t just replace a single file without changing the entire file’s compressed output. Therefore this new method will decompress both the old and the new APK, apply the patch from the new APK, and compress the APK on your device. While this takes less data, it takes more time and processing power.
Because these patches can take longer, Google has opted to only use file-by-file patching for background auto-updates right now. So, your Play Store client may end up using a lot fewer data. It won't necessarily be faster at updating, though.
Because of these drawbacks, Google is limiting this new update method to automatic updates that it can do in the background. Manually updating apps won’t utilize this new technique in saving data.
Techniques used in File-by-File patching
Android apps are packaged as APKs, which are ZIP files with special conventions. Most of the content within the ZIP files (and APKs) is compressed using a technology called Deflate. Deflate is really good at compressing data but it has a drawback: it makes identifying changes in the original (uncompressed) content really hard. Even a tiny change to the original content (like changing one word in a book) can make the compressed output of deflating look completely different. Describing the differences between the original content is easy, but describing the differences between the compressed content is so hard that it leads to inefficient patches. File-by-File, therefore, is based on detecting changes in the uncompressed data.
To generate a patch, First decompress both old and new files before computing the delta. Then to apply the patch, decompress the old file, apply the delta to the uncompressed content and then recompress the new file. In doing so, make sure that the APK on your device is a perfect match, byte for byte, to the one on the Play Store
Thankfully, developers won’t have to change anything to utilize this new update system. It’s all on Google’s end. If you want to learn more about File-by-File patching, hit the source link!
Source: Android Developers Blog
No comments:
Post a Comment