Monochrome as a bundle is larger than Monochrome as an apk |
||||
Issue description
Comparing these two files:
gs://chrome-signed/android-B0urB0N/72.0.3626.8/arm/MonochromeStable.apk
gs://chrome-signed/android-B0urB0N/72.0.3626.8/arm/MonochromeStable.apks
base-master.apk (within .apks) is 69042017 bytes.
Monochrome.apk is 68706080 bytes.
335937 bytes larger.
Looking at "Breakdown" stats from resource_sizes.py on both files:
* Java code size: 3342046 vs 3366340
* 24294 larger - expected from play core library.
* Non-compiled Android resources size: 339921 vs 473820
* 133899 larger
* Looks like res/**/*.xml files are larger.
* My guess is it's not using --no-xml-namespaces flag like we do for the apk.
* See 69007c4049a6640493175997b6d915ddbfa58ed6
* Compiled Android resources (.arsc file): 5095200 vs 5271952
* 176752 larger
* Looks like names are not stripped
* My guess is it's not using --enable-resource-obfuscation
* See e734bc5eb8b08668196b95a9e38e6bea0773748c
Not sure if these are flags that we can pass to aapt ourselves, or if these need to be added to bundletool / play store?
,
Dec 7
By "uncompressed resources", do you mean "Non-compiled Android resources"? res/**/*.xml files are stored compressed :P. What units are you using for res folders? 10344 bytes is way too small, but 10344kb is way to big :P The --no-xml-namespaces is a part of aapt2 optimizations, so fingers crossed that the same bug is responsible for both.
,
Dec 7
Looking more, it's in kB I believe. I just uncompressed both APKs and measures the res/ folder size with du. That's probably not correct. And, yeah, I mean the uncompiled resources.
,
Dec 7
For the resources.arsc bug, I have located and am working on a fix. For the non-compiled resources I have no idea why they are bigger. --no-xml-namespaces is not part of aapt2 optimize (it is part of link). But either way, there are no namespaces in the final binary xml (aapt dump xmltree does not show namespaces) so that is not the issue.
,
Dec 7
mheikal@ and me did some more research. The compiled XML files in the bundle contain the raw values. E.g. aapt dump xmltree <apk> res/anim/textbubble_in.xml gives
E: set (line=7)
A: interpolator(0x01010141)=@0x10a000b (Raw: "@android:anim/linear_interpolator")
A: duration(0x01010198)=@0x10e0000 (Raw: "@android:integer/config_shortAnimTime")
E: alpha (line=11)
A: fromAlpha(0x010101ca)=(type 0x4)0x0 (Raw: "0")
A: toAlpha(0x010101cb)=(type 0x4)0x3f800000 (Raw: "1.0")
E: translate (line=15)
A: fromYDelta(0x010101c8)=(type 0x4)0xc1200000 (Raw: "-10")
A: toYDelta(0x010101c9)=(type 0x4)0x0 (Raw: "0")
for the base module and
E: set (line=7)
A: interpolator(0x01010141)=@0x10a000b
A: duration(0x01010198)=@0x10e0000
E: alpha (line=11)
A: fromAlpha(0x010101ca)=(type 0x4)0x0
A: toAlpha(0x010101cb)=(type 0x4)0x3f800000
E: translate (line=15)
A: fromYDelta(0x010101c8)=(type 0x4)0xc1200000
A: toYDelta(0x010101c9)=(type 0x4)0x0
for the APK. Seems like the module is storing all raw values even though they are not needed.
,
Dec 7
Assigning to mheikal@ for now.
,
Dec 7
Ok the problem with resources.arsc is bigger than originally thought. The conversion between proto format resource table and binary format resource table is done by aapt2 but on play store's end (thus we do not control it). Looking at the code [1], if the proto format resource table contains all resources with the same name and type (because they are obfuscated), when the conversion occurs it would consider them all to be the same resource and fail. The problem with bigger .xml files is also due to conversion. The conversion code [2] that outputs binary xml sets "keep_raw_values=true" thus the raw string values are kept for all attributes increasing file size. I am not sure why that is the case or what normally happens when there is no conversion necessary (when aapt2 directly outputs binary xml). I can look at this a bit more. [1] https://cs.corp.google.com/pi-arc-dev/frameworks/base/tools/aapt2/format/proto/ProtoDeserialize.cpp?rcl=9d266a8609ebbee1fac932ad574ff7739d52b1ff&l=401 [2] https://cs.corp.google.com/pi-arc-dev/frameworks/base/tools/aapt2/cmd/Convert.cpp?rcl=9d266a8609ebbee1fac932ad574ff7739d52b1ff&l=142
,
Dec 20
Reminder M72 Stable is coming soon. Please review this bug and assess if this is indeed a RBS. If not, please remove the RBS label. If so, please make sure to land the fix and request a merge into the release branch ASAP. Thank you.
,
Dec 20
Thanks for the reminder govind@, pushing this to RSB for M73, like many other things for bundles :-/
,
Yesterday
(39 hours ago)
|
||||
►
Sign in to add a comment |
||||
Comment 1 by tiborg@chromium.org
, Dec 7