Index: build/android/resource_sizes.py |
diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py |
index 64ce719f37e1c014401479f05493a6bb1fc21ea0..6c77ec3e61dfafeeb3506e4050015b021f7d60f7 100755 |
--- a/build/android/resource_sizes.py |
+++ b/build/android/resource_sizes.py |
@@ -185,11 +185,15 @@ def PrintApkAnalysis(apk_filename, chartjson=None): |
FILE_GROUPS = ( |
FileGroup('Native code', r'\.so$', lambda f: 'crazy' not in f), |
FileGroup('Java code', r'\.dex$', YES), |
- FileGroup('Native resources (no l10n)', r'\.pak$', NO), |
+ FileGroup('Native resources (no l10n)', |
+ r'^assets/.*(resources|percent)\.pak$', NO), |
# For locale paks, assume only english paks are extracted. |
- FileGroup('Native resources (l10n)', r'\.lpak$', lambda f: 'en_' in f), |
- FileGroup('ICU (i18n library) data', r'assets/icudtl\.dat$', NO), |
- FileGroup('V8 Snapshots', r'\.bin$', NO), |
+ # Handles locale paks as bother resources or assets (.lpak or .pak). |
+ FileGroup('Native resources (l10n)', |
+ r'\.lpak$|^assets/.*(?!resources|percent)\.pak$', |
+ lambda f: 'en_' in f or 'en-' in f), |
+ FileGroup('ICU (i18n library) data', r'^assets/icudtl\.dat$', NO), |
+ FileGroup('V8 Snapshots', r'^assets/.*\.bin$', NO), |
FileGroup('PNG drawables', r'\.png$', NO), |
FileGroup('Non-compiled Android resources', r'^res/', NO), |
FileGroup('Compiled Android resources', r'\.arsc$', NO), |
@@ -221,13 +225,18 @@ def PrintApkAnalysis(apk_filename, chartjson=None): |
total_install_size = total_apk_size |
for group in FILE_GROUPS: |
- uncompressed_size = sum(member.file_size for member in found_files[group]) |
- packed_size = sum(member.compress_size for member in found_files[group]) |
- install_size = packed_size |
- install_bytes = sum(member.file_size for member in found_files[group] |
- if group.extracted(member.filename)) |
- install_size += install_bytes |
- total_install_size += install_bytes |
+ uncompressed_size = 0 |
+ packed_size = 0 |
+ extracted_size = 0 |
+ for member in found_files[group]: |
+ uncompressed_size += member.file_size |
+ packed_size += member.compress_size |
+ # Assume that if a file is not compressed, then it is not extracted. |
+ is_compressed = member.compress_type != zipfile.ZIP_STORED |
+ if is_compressed and group.extracted(member.filename): |
+ extracted_size += member.file_size |
+ install_size = packed_size + extracted_size |
+ total_install_size += extracted_size |
ReportPerfResult(chartjson, apk_basename + '_Breakdown', |
group.name + ' size', packed_size, 'bytes') |