[tbb-commits] [Git][tpo/applications/tor-browser-build][main] Bug 41066: Compress the APKs more

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Wed Jan 24 16:08:45 UTC 2024



Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build


Commits:
23474930 by Pier Angelo Vendrame at 2024-01-24T17:08:30+01:00
Bug 41066: Compress the APKs more

Our APK was refused by the Play Store as too big.
As a workaround, for this release we can try to compress the APK more,
by extracting it and repacking it with 7-zip.
The preferred and long-term solution would be to switch to Android App
Bundles, but this might require some changes to our signing scripts.

- - - - -


2 changed files:

- projects/browser/build.android
- projects/browser/config


Changes:

=====================================
projects/browser/build.android
=====================================
@@ -46,13 +46,19 @@ mv $rootdir/[% c('input_files_by_name/noscript') %] "$noscript_path"
 
 mv $rootdir/allowed_addons.json $assets_dir/allowed_addons.json
 
-[% c('zip', {
-    zip_src => [ '$assets_dir' ],
-    zip_args => '$apk',
-  }) %]
+mkdir apk
+pushd apk
+7zz x "$apk"
+cp -R ../assets ./
+find -type f -exec touch -m -t '[% USE date; date.format(pc("firefox-android", "timestamp"), format = "%Y%m%d%H%M") %]' {} \;
+find -type f ! -name resources.arsc -printf '%P\n' | sort > ../files.txt
+7zz a -tzip -mx9 -mtc- -spf ../repacked.apk @../files.txt
+# resources.arsc must not be compressed as per the APK specifications
+7zz a -tzip -mm=Copy -mtc- ../repacked.apk resources.arsc
+popd
 
 aligned_apk=$(basename $apk .apk)_aligned.apk
-zipalign -vp 4 $apk $aligned_apk
+zipalign -vp 4 repacked.apk $aligned_apk
 
 # Sign a QA build. This .apk is not a debug version and doesn't contain a debug
 # flag in the manifest.


=====================================
projects/browser/config
=====================================
@@ -46,7 +46,13 @@ targets:
     var:
       verify_allowed_addons: 1
       arch_deps:
-        - openjdk-11-jdk-headless
+        - 7zip
+        - openjdk-17-jdk-headless
+      container:
+        # 7zip is in backports in bullseye, and we can already use Java 17 for
+        # apksigner.
+        suite: bookworm
+        arch: amd64
   torbrowser:
     var:
       prefs_file: 000-tor-browser.js



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/234749308ce0cccdb6d0576c622f16eef1ae4ddd

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/234749308ce0cccdb6d0576c622f16eef1ae4ddd
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240124/f1f27d13/attachment-0001.htm>


More information about the tbb-commits mailing list