New issue
Advanced search Search tips

Issue 782316 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Switch from aapt -> aapt2

Project Member Reported by agrieve@chromium.org, Nov 7 2017

Issue description

aapt2 has some additional optimizations that we should use, and runs faster than aapt (although I haven't found aapt's speed to be slow for us...)

It also should be a fairly straight-forward switch.

I believe it has built-in support for the logic we do in generate_v14_compatible_resources.py (thus, we could delete this file).
Why I believe this: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/tools/aapt2/readme.md#version-2_16


Optimizations are all on by default, except: --no-xml-namespaces

To use aapt2, we would:
 * Change process_resources.py to run: aapt2 compile -o foo.ap_ --dir res/
 * Change package_resources.py to run: aapt2 link foo1.ap_ foo2.ap_ ...


It's strange to me that aapt2 compile does not generate .java files (that's done only by aapt2 link). However, it's not an issue for us since we already generate these files manually in the python.

Example usage:
$ aapt2 compile --dir ui/android/java/res -o ui.ap_
$ aapt2 compile --dir content/public/android/java/res -o content.ap_
$ aapt2 link -o foo.apk --manifest build/android/AndroidManifest.xml -I third_party/android_tools/sdk/platforms/android-26/android.jar ui.ap_ content.ap_
$ unzip -lv content.ap_

 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
    8123  Stored     8123   0% 1980-12-31 19:00 6e3b2ff1  drawable-xhdpi_ondemand_overlay.9.png.flat
     573  Stored      573   0% 1980-12-31 19:00 314fdf74  drawable-xhdpi_ic_search.png.flat
     684  Stored      684   0% 1980-12-31 19:00 ed235434  drawable-xhdpi_ic_menu_share_holo_light.png.flat
    1063  Stored     1063   0% 1980-12-31 19:00 13168201  drawable-xxxhdpi_ic_search.png.flat
    1211  Stored     1211   0% 1980-12-31 19:00 5ad9ac73  drawable-xxxhdpi_ic_menu_share_holo_light.png.flat
    1864  Stored     1864   0% 1980-12-31 19:00 39058a2f  values-v17_styles.arsc.flat
    1562  Stored     1562   0% 1980-12-31 19:00 c6b21372  layout-land_date_time_picker_dialog.xml.flat
    6422  Stored     6422   0% 1980-12-31 19:00 d16de6d2  drawable-hdpi_ondemand_overlay.9.png.flat
     548  Stored      548   0% 1980-12-31 19:00 1440041d  drawable-hdpi_ic_search.png.flat
     520  Stored      520   0% 1980-12-31 19:00 4c664bf2  drawable-hdpi_ic_menu_share_holo_light.png.flat
    3336  Stored     3336   0% 1980-12-31 19:00 6dd42e61  menu_select_action_menu.xml.flat
     359  Stored      359   0% 1980-12-31 19:00 f0c7cbf1  values_attrs.arsc.flat
      38  Stored       38   0% 1980-12-31 19:00 b6d63fe6  values_strings.arsc.flat
     635  Stored      635   0% 1980-12-31 19:00 86dae18c  values_dimens.arsc.flat
     199  Stored      199   0% 1980-12-31 19:00 db1a1a27  values_colors.arsc.flat
     684  Stored      684   0% 1980-12-31 19:00 e0847b24  drawable_floating_popup_background_light.xml.flat
     859  Stored      859   0% 1980-12-31 19:00 39dfb408  drawable-xxhdpi_ic_search.png.flat
     963  Stored      963   0% 1980-12-31 19:00 980c68ea  drawable-xxhdpi_ic_menu_share_holo_light.png.flat
    4029  Stored     4029   0% 1980-12-31 19:00 49767920  drawable-mdpi_ondemand_overlay.9.png.flat
     363  Stored      363   0% 1980-12-31 19:00 6c2bcd51  drawable-mdpi_ic_search.png.flat
     397  Stored      397   0% 1980-12-31 19:00 fb1b17da  drawable-mdpi_ic_menu_share_holo_light.png.flat
    1381  Stored     1381   0% 1980-12-31 19:00 06472373  values-v21_styles.arsc.flat
    1602  Stored     1602   0% 1980-12-31 19:00 60f36650  layout_date_time_suggestion.xml.flat
    1548  Stored     1548   0% 1980-12-31 19:00 3cb8033b  layout_date_time_picker_dialog.xml.flat
    4192  Stored     4192   0% 1980-12-31 19:00 fc82e74d  layout_multi_field_time_picker_dialog.xml.flat
    1326  Stored     1326   0% 1980-12-31 19:00 a48dde0f  layout_text_edit_suggestion_list_footer.xml.flat
     776  Stored      776   0% 1980-12-31 19:00 7bab0baf  layout_text_edit_suggestion_container.xml.flat
    1080  Stored     1080   0% 1980-12-31 19:00 1ff8cf57  layout_text_edit_suggestion_item.xml.flat
    1444  Stored     1444   0% 1980-12-31 19:00 21ac7a42  layout_two_field_date_picker.xml.flat
--------          -------  ---                            -------
   47781            47781   0%                            29 files

$ unzip -lv foo.apk
Archive:  foo.apk
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
     448  Defl:N      239  47% 1980-12-31 19:00 382b0f1c  AndroidManifest.xml
     384  Stored      384   0% 1980-12-31 19:00 a86dfcd8  resources.arsc
--------          -------  ---                            -------
     832              623  25%                            2 files

$ aapt2 link --no-xml-namespaces -o foo.apk --manifest build/android/AndroidManifest.xml -I third_party/android_tools/sdk/platforms/android-26/android.jar ui.ap_ content.ap_
$ unzip -lv foo.apk

 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
     384  Defl:N      219  43% 1980-12-31 19:00 a251a0d7  AndroidManifest.xml
     384  Stored      384   0% 1980-12-31 19:00 a86dfcd8  resources.arsc
--------          -------  ---                            -------
     768              603  22%                            2 files
 
Looking more closely at this, it would be quite complicated to use aapt "properly" (aka, have it replace our per-library process_resources() calls outputs).

Here are some considerations:
* strip xxxhdpi:
   * This removes most xxxhdpi images, but leaves a few whitelisted ones.
   * We'd need to duplicate all input .apc files with filter applied
* png2webp
   * This converts png->webp for non-9 patch.
   * We'd need to filter existing .apc files (as in stripping), then create a new .apc will all new .webp.flat files
   * Alternatively, we could post-process the .apc, replacing pngs with webp, while keeping their names as ".png" (simpler, but confusing).
* Generating R.java files for library targets
   * We'd need to run "aapt2 link" on all intermediary .apc files to produce the R.txt, since "compile" doesn't have this option
   * We could also attempt to parse the information out of the .apc (store in protobufs).
* --support-zh-hk:
   * This copies all zh-rTW strings -> zh-rHK.
   * We'd need to create a second .apc file for each library, and have them linked in at the end only when the flag is present

Given all the "extras" we need, it's not clear to me that our build would become faster or simpler by using aapt2's compile step.

The main reason to use aapt2 is:
 - We can delete our generate_v14_compatible_resources.py logic
 - It creates more efficient .arsc files (has some optimizations that aapt does not)
 - It creates smarter proguard rules.

So, to get the bare minimum out of aapt2, I think we should:
 * Keep existing per-library process_resources.py logic, but remove generate_v14_compatible_resources.py (aka, keep it using aapt1)
 * Fold package_resources.py into process_resources.py (and also combine the 2 steps into 1 in GN)
 * Replace process_resources.py --all-resources-zip-out with a --create-apk, which would cause it to:
   * Call "aapt2 compile", followed by "aapt2 link" to create the .ap_ file
   * Write out the final R.txt using aapt2, and generate the final R.java using it

For junit_binary (robolectric), we'll still need to maintain the flags that allow generating all R.java files using aapt1 (in order to avoid needing to call aapt2 linke and throwing away the result)

That last note about junit_binary will also be needed for resource shrinking (bug 636448).
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ea0f96c8c0132c60d10a254466bf70af5d763741

commit ea0f96c8c0132c60d10a254466bf70af5d763741
Author: Mohamed Heikal <mheikal@google.com>
Date: Tue Nov 28 21:29:02 2017

Merges process and package resources script

process_resources.py and package_resources.py are currently both required to
create the final apk. They currently communicate using zipfiles. This ends up
having 3-4 zips/unzips during the final build of the same apk in order to
perform modifications. This merger allows all the required processing to be
done before apk creation with no need for zipping. It also simplifies the
process_resources.py script to separate the code that runs during library
builds vs apk builds.

Bug:  782316 
Change-Id: I958c1d107d593b0932275d3c4452c2c51c499b55
Reviewed-on: https://chromium-review.googlesource.com/791152
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519850}
[modify] https://crrev.com/ea0f96c8c0132c60d10a254466bf70af5d763741/base/android/java/src/org/chromium/base/LocaleUtils.java
[delete] https://crrev.com/3159570e74460eaf7b16799aac7cea644c71808a/build/android/gyp/package_resources.py
[modify] https://crrev.com/ea0f96c8c0132c60d10a254466bf70af5d763741/build/android/gyp/process_resources.py
[modify] https://crrev.com/ea0f96c8c0132c60d10a254466bf70af5d763741/build/config/android/internal_rules.gni
[modify] https://crrev.com/ea0f96c8c0132c60d10a254466bf70af5d763741/build/config/android/rules.gni

Project Member

Comment 4 by bugdroid1@chromium.org, Nov 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/52affce6e2e486732e39053c87dfa1349edd202a

commit 52affce6e2e486732e39053c87dfa1349edd202a
Author: Bo <boliu@chromium.org>
Date: Wed Nov 29 17:17:53 2017

Revert "Merges process and package resources script"

This reverts commit ea0f96c8c0132c60d10a254466bf70af5d763741.

Reason for revert:
Causing resource errors in the real webview (not on cq)
https://build.chromium.org/p/chromium.android/builders/Android%20WebView%20L%20%28dbg%29/builds/10729

Original change's description:
> Merges process and package resources script
> 
> process_resources.py and package_resources.py are currently both required to
> create the final apk. They currently communicate using zipfiles. This ends up
> having 3-4 zips/unzips during the final build of the same apk in order to
> perform modifications. This merger allows all the required processing to be
> done before apk creation with no need for zipping. It also simplifies the
> process_resources.py script to separate the code that runs during library
> builds vs apk builds.
> 
> Bug:  782316 
> Change-Id: I958c1d107d593b0932275d3c4452c2c51c499b55
> Reviewed-on: https://chromium-review.googlesource.com/791152
> Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
> Reviewed-by: agrieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#519850}

TBR=agrieve@chromium.org,mheikal@chromium.org

Change-Id: If0d30f7e57b18ff56bd17c2c918398158fb3dffa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  782316 
Reviewed-on: https://chromium-review.googlesource.com/796717
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520149}
[modify] https://crrev.com/52affce6e2e486732e39053c87dfa1349edd202a/base/android/java/src/org/chromium/base/LocaleUtils.java
[add] https://crrev.com/52affce6e2e486732e39053c87dfa1349edd202a/build/android/gyp/package_resources.py
[modify] https://crrev.com/52affce6e2e486732e39053c87dfa1349edd202a/build/android/gyp/process_resources.py
[modify] https://crrev.com/52affce6e2e486732e39053c87dfa1349edd202a/build/config/android/internal_rules.gni
[modify] https://crrev.com/52affce6e2e486732e39053c87dfa1349edd202a/build/config/android/rules.gni

Project Member

Comment 5 by bugdroid1@chromium.org, Dec 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/46a41a802079d801a4d7b3f9d8ad2bf0fd941243

commit 46a41a802079d801a4d7b3f9d8ad2bf0fd941243
Author: Mohamed Heikal <mheikal@google.com>
Date: Fri Dec 01 16:58:32 2017

Reland "Merges process and package resources script"

This reverts commit 52affce6e2e486732e39053c87dfa1349edd202a.

Reason for reland: Fixes bug that causes webview to fail

Original change's description:
> Revert "Merges process and package resources script"
>
> This reverts commit ea0f96c8c0132c60d10a254466bf70af5d763741.
>
> Reason for revert:
> Causing resource errors in the real webview (not on cq)
> https://build.chromium.org/p/chromium.android/builders/Android%20WebView%20L%20%28dbg%29/builds/10729
>
> Original change's description:
> > Merges process and package resources script
> >
> > process_resources.py and package_resources.py are currently both required to
> > create the final apk. They currently communicate using zipfiles. This ends up
> > having 3-4 zips/unzips during the final build of the same apk in order to
> > perform modifications. This merger allows all the required processing to be
> > done before apk creation with no need for zipping. It also simplifies the
> > process_resources.py script to separate the code that runs during library
> > builds vs apk builds.
> >
> > Bug:  782316 
> > Change-Id: I958c1d107d593b0932275d3c4452c2c51c499b55
> > Reviewed-on: https://chromium-review.googlesource.com/791152
> > Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
> > Reviewed-by: agrieve <agrieve@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#519850}
>
> TBR=agrieve@chromium.org,mheikal@chromium.org
>
> Change-Id: If0d30f7e57b18ff56bd17c2c918398158fb3dffa
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug:  782316 
> Reviewed-on: https://chromium-review.googlesource.com/796717
> Reviewed-by: Bo <boliu@chromium.org>
> Commit-Queue: Bo <boliu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#520149}

Bug:  782316 
Change-Id: I4b6d7650c84706b55bfab7ae6943251342f2e0b3
Reviewed-on: https://chromium-review.googlesource.com/801595
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520961}
[modify] https://crrev.com/46a41a802079d801a4d7b3f9d8ad2bf0fd941243/base/android/java/src/org/chromium/base/LocaleUtils.java
[delete] https://crrev.com/0a6d1baa62035faa61680f66b8910c54ee56c7fd/build/android/gyp/package_resources.py
[modify] https://crrev.com/46a41a802079d801a4d7b3f9d8ad2bf0fd941243/build/android/gyp/process_resources.py
[modify] https://crrev.com/46a41a802079d801a4d7b3f9d8ad2bf0fd941243/build/config/android/internal_rules.gni
[modify] https://crrev.com/46a41a802079d801a4d7b3f9d8ad2bf0fd941243/build/config/android/rules.gni

Project Member

Comment 6 by bugdroid1@chromium.org, Dec 7 2017

Comment 7 by ctzsm@chromium.org, Dec 7 2017

The last CL is causing compiling failure on clang-clankium-tot-builder, I am going to revert it.
Project Member

Comment 8 by bugdroid1@chromium.org, Dec 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/db213ff641175f136d52a577e21690f7f955f0bd

commit db213ff641175f136d52a577e21690f7f955f0bd
Author: Shimi Zhang <ctzsm@chromium.org>
Date: Thu Dec 07 19:21:01 2017

Revert "Use Aapt2 for final apk resource packaging"

This reverts commit 0639c753f9edfb3b5ed57296f16f956c7de6e98e.

Reason for revert: clang-clankium-tot-builder [5 out of the last 5 builds have failed]

Original change's description:
> Use Aapt2 for final apk resource packaging
> 
> This CL makes aapt2 perform the final resource processing and packaging for an
> apk as well as outputting proguard files.
> 
> Bug:  782316 
> Change-Id: I29b502a5f702ce1860f7982ea56d946bfa08e087
> Reviewed-on: https://chromium-review.googlesource.com/806676
> Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
> Reviewed-by: agrieve <agrieve@chromium.org>
> Reviewed-by: Ted Choc <tedchoc@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#522481}

TBR=tedchoc@chromium.org,agrieve@chromium.org,mheikal@chromium.org

Change-Id: I0dd188274ea9f6807364a025391d97bac4a3f37c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  782316 
Reviewed-on: https://chromium-review.googlesource.com/814697
Reviewed-by: Shimi Zhang <ctzsm@chromium.org>
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522503}
[delete] https://crrev.com/3ec52b9cc096aaec7e7ebd0a1872718170e4e409/base/android/jni_generator/AndroidManifest.xml
[modify] https://crrev.com/db213ff641175f136d52a577e21690f7f955f0bd/base/android/jni_generator/BUILD.gn
[modify] https://crrev.com/db213ff641175f136d52a577e21690f7f955f0bd/build/android/gyp/process_resources.py
[modify] https://crrev.com/db213ff641175f136d52a577e21690f7f955f0bd/build/android/pylib/instrumentation/instrumentation_test_instance.py
[modify] https://crrev.com/db213ff641175f136d52a577e21690f7f955f0bd/chrome/android/java/res/layout/data_reduction_main_menu_item.xml
[modify] https://crrev.com/db213ff641175f136d52a577e21690f7f955f0bd/testing/android/empty_apk/AndroidManifest.xml

Project Member

Comment 10 by bugdroid1@chromium.org, Dec 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f174f4deb83b28f63a30813241c2f279c4a99440

commit f174f4deb83b28f63a30813241c2f279c4a99440
Author: Mohamed Heikal <mheikal@chromium.org>
Date: Tue Dec 12 17:02:00 2017

Reland "Use Aapt2 for final apk resource packaging"

This reverts commit db213ff641175f136d52a577e21690f7f955f0bd.

Reason for reland: Downstream issue fixed. No changes here.

This CL makes aapt2 perform the final resource processing and packaging for an
apk as well as outputting proguard files.

TBR=agrieve

Bug:  782316 
Change-Id: I1b35f49f2e4b4d503cc7ae07dabc18d9014abea5
Reviewed-on: https://chromium-review.googlesource.com/817377
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523456}
[add] https://crrev.com/f174f4deb83b28f63a30813241c2f279c4a99440/base/android/jni_generator/AndroidManifest.xml
[modify] https://crrev.com/f174f4deb83b28f63a30813241c2f279c4a99440/base/android/jni_generator/BUILD.gn
[modify] https://crrev.com/f174f4deb83b28f63a30813241c2f279c4a99440/build/android/gyp/process_resources.py
[modify] https://crrev.com/f174f4deb83b28f63a30813241c2f279c4a99440/build/android/pylib/instrumentation/instrumentation_test_instance.py
[modify] https://crrev.com/f174f4deb83b28f63a30813241c2f279c4a99440/chrome/android/java/res/layout/data_reduction_main_menu_item.xml
[modify] https://crrev.com/f174f4deb83b28f63a30813241c2f279c4a99440/testing/android/empty_apk/AndroidManifest.xml

Project Member

Comment 11 by bugdroid1@chromium.org, Dec 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c63b9f7306ee851fdb7f6785f1a682b3611385db

commit c63b9f7306ee851fdb7f6785f1a682b3611385db
Author: agrieve <agrieve@chromium.org>
Date: Thu Dec 14 22:40:55 2017

Revert "Reland Use Aapt2 for final apk resource packaging"

This reverts commit f174f4deb83b28f63a30813241c2f279c4a99440.

Reason for revert: Breaks apk_merger.py (see bug)

Original change's description:
> Reland "Use Aapt2 for final apk resource packaging"
> 
> This reverts commit db213ff641175f136d52a577e21690f7f955f0bd.
> 
> Reason for reland: Downstream issue fixed. No changes here.
> 
> This CL makes aapt2 perform the final resource processing and packaging for an
> apk as well as outputting proguard files.
> 
> TBR=agrieve
> 
> Bug:  782316 
> Change-Id: I1b35f49f2e4b4d503cc7ae07dabc18d9014abea5
> Reviewed-on: https://chromium-review.googlesource.com/817377
> Reviewed-by: agrieve <agrieve@chromium.org>
> Commit-Queue: agrieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#523456}

TBR=tedchoc@chromium.org,agrieve@chromium.org,ctzsm@chromium.org,mheikal@chromium.org

Bug:  782316 
Change-Id: Idd57f012b1bc32330c9659e9d63fba5eec27615d
Reviewed-on: https://chromium-review.googlesource.com/827900
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524210}
[delete] https://crrev.com/826eae6812fc62c516d2beac2db50c3fdbc4c561/base/android/jni_generator/AndroidManifest.xml
[modify] https://crrev.com/c63b9f7306ee851fdb7f6785f1a682b3611385db/base/android/jni_generator/BUILD.gn
[modify] https://crrev.com/c63b9f7306ee851fdb7f6785f1a682b3611385db/build/android/gyp/process_resources.py
[modify] https://crrev.com/c63b9f7306ee851fdb7f6785f1a682b3611385db/build/android/pylib/instrumentation/instrumentation_test_instance.py
[modify] https://crrev.com/c63b9f7306ee851fdb7f6785f1a682b3611385db/chrome/android/java/res/layout/data_reduction_main_menu_item.xml
[modify] https://crrev.com/c63b9f7306ee851fdb7f6785f1a682b3611385db/testing/android/empty_apk/AndroidManifest.xml

Project Member

Comment 12 by bugdroid1@chromium.org, Dec 20 2017

Project Member

Comment 13 by bugdroid1@chromium.org, Dec 21 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ed4cf2db865d9389e83d5410172b1b38e9684033

commit ed4cf2db865d9389e83d5410172b1b38e9684033
Author: Mohamed Heikal <mheikal@google.com>
Date: Thu Dec 21 20:32:13 2017

Fix aapt2 file ignore regression

aapt used to ignore certain files and directories using an ignore
pattern. aapt2 no longer provides such functionality. This cl allows the
process_resources.py script to use the aapt ignore pattern to ignore the
files on python's side.

The ignore pattern is also simplified to just what is required, rather
than using the default, so as to not complicate the python code that
would use it.

Bug:  782316 
Change-Id: I62dd434ede8004ce93f2a3f4bb640a6645aa0199
Reviewed-on: https://chromium-review.googlesource.com/826009
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525790}
[modify] https://crrev.com/ed4cf2db865d9389e83d5410172b1b38e9684033/build/android/gyp/process_resources.py
[modify] https://crrev.com/ed4cf2db865d9389e83d5410172b1b38e9684033/build/android/gyp/util/build_utils.py

Project Member

Comment 14 by bugdroid1@chromium.org, Jan 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1cbd75b6f0bf8767f0eba789356bb63c0d655b3e

commit 1cbd75b6f0bf8767f0eba789356bb63c0d655b3e
Author: Andrew Grieve <agrieve@chromium.org>
Date: Tue Jan 02 18:38:05 2018

Remove double-reversing of resource .zips

It was being reversed in build_configs, then again in
process_resources.py

Bug:  782316 
Change-Id: I654a77d8e859f068101fadf99400c26582844d82
Reviewed-on: https://chromium-review.googlesource.com/842950
Reviewed-by: Eric Stevenson <estevenson@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526507}
[modify] https://crrev.com/1cbd75b6f0bf8767f0eba789356bb63c0d655b3e/build/android/gyp/process_resources.py
[modify] https://crrev.com/1cbd75b6f0bf8767f0eba789356bb63c0d655b3e/build/android/gyp/write_build_config.py

Project Member

Comment 15 by bugdroid1@chromium.org, Jan 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/69007c4049a6640493175997b6d915ddbfa58ed6

commit 69007c4049a6640493175997b6d915ddbfa58ed6
Author: Mohamed Heikal <mheikal@google.com>
Date: Thu Jan 11 04:09:47 2018

Android: Strip namespaces from xml files in monochrome

XML namespaces are not used by android at runtime and can be stripped.
This is safe only for apks targeting API > 21 which is only monochrome.

Bug:  782316 
Change-Id: I7517f86e3e24a1199f9b78dff856a4479af96334
Reviewed-on: https://chromium-review.googlesource.com/840180
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528553}
[modify] https://crrev.com/69007c4049a6640493175997b6d915ddbfa58ed6/build/android/gyp/process_resources.py
[modify] https://crrev.com/69007c4049a6640493175997b6d915ddbfa58ed6/build/config/android/internal_rules.gni
[modify] https://crrev.com/69007c4049a6640493175997b6d915ddbfa58ed6/build/config/android/rules.gni
[modify] https://crrev.com/69007c4049a6640493175997b6d915ddbfa58ed6/chrome/android/chrome_public_apk_tmpl.gni

Status: Fixed (was: Assigned)
Ok so this bug is now done. Switching to aapt2 for apks saved around 300k and stripping namespaces (only on monochrome) saved 40k. 

Sign in to add a comment