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

richard (@richard) git at gitlab.torproject.org
Tue Jan 23 10:43:12 UTC 2024



richard pushed to branch maint-13.0 at The Tor Project / Applications / tor-browser-build


Commits:
4ae6c26c by Pier Angelo Vendrame at 2024-01-23T10:48:57+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
=====================================
@@ -31,13 +31,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/4ae6c26c18f70f2b483c5427d519aa1eade1e620

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/4ae6c26c18f70f2b483c5427d519aa1eade1e620
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/20240123/e82bbbd0/attachment-0001.htm>


More information about the tbb-commits mailing list