Verified Commit 23474930 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

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.
parent ef63c83c
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -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.
+7 −1
Original line number Diff line number Diff line
@@ -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