CI / check (push) Canceled after 0s
Google Play Protect blocked installing beta.7, most likely for the
notification listener (notification summaries).
- A second flavour dimension, `reading`: `standard` declares no listener and
no permission of it; `notifications` is the full build plus the listener,
with the same application id and key. Variants: fullStandard,
fullNotifications, fdroidStandard (no F-Droid build with the listener).
The listener class and its manifest entry live in src/notifications only.
- Settings in a standard build says where notification summaries went and
why. The self-updater installs only its own kind: a notifications build
takes latest.json's optional `notifications {url, sha256}` or nothing.
- Release builds carry arm64-v8a and armeabi-v7a only; debug keeps x86_64
for the emulator. The engine's unused C and C++ API libraries are left out.
- scripts/check-apk.sh checks the built files (listener only where it may
be, model stored, no x86 in a release); CI runs it on the three debug APKs
and on an unsigned release build, release.yml on what it publishes.
- release.yml publishes llembas-android-<version>.apk, -notifications.apk
and -fdroid.apk with SHA256SUMS.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
46 lines
2.5 KiB
Bash
Executable File
46 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# What an APK declares and carries, checked on the built file rather than believed from the build
|
|
# script. CI runs it on every push's builds and the release workflow on what it is about to publish.
|
|
#
|
|
# scripts/check-apk.sh <apk> <kind> [release]
|
|
#
|
|
# <kind> is `standard` (the full build), `fdroid` or `notifications`:
|
|
# - only `notifications` may declare a notification listener or name its permission; the other
|
|
# two must have nothing of it in the manifest (Google Play Protect blocks installing an app
|
|
# from outside the Play Store that can read notifications);
|
|
# - `standard` and `notifications` carry the wake-word model, stored uncompressed, and the
|
|
# engine's library for arm64; `fdroid` carries neither;
|
|
# - with `release`, no x86_64 library (only an emulator would load it).
|
|
set -euo pipefail
|
|
apk="$1"; kind="$2"; release="${3:-}"
|
|
[ -f "$apk" ] || { echo "check-apk: no $apk" >&2; exit 1; }
|
|
fail() { echo "check-apk: $(basename "$apk"): $1" >&2; exit 1; }
|
|
|
|
aapt2="$(find "${ANDROID_HOME:?ANDROID_HOME is not set}/build-tools" -name aapt2 -type f | sort -V | tail -1)"
|
|
[ -x "$aapt2" ] || fail "no aapt2 under ANDROID_HOME"
|
|
manifest="$("$aapt2" dump xmltree --file AndroidManifest.xml "$apk")"
|
|
listener=0
|
|
grep -qiE "notification_?listener" <<<"$manifest" && listener=1
|
|
case "$kind" in
|
|
notifications) [ "$listener" = 1 ] || fail "the notifications build declares no notification listener" ;;
|
|
standard|fdroid) [ "$listener" = 0 ] || fail "a $kind build must not declare a notification listener" ;;
|
|
*) fail "unknown kind $kind" ;;
|
|
esac
|
|
|
|
files="$(unzip -v "$apk")"
|
|
models="$(awk '$NF ~ /^assets\/wakeword\/.*\.onnx$/' <<<"$files")"
|
|
if [ "$kind" = fdroid ]; then
|
|
[ -z "$models" ] || fail "the fdroid build carries the wake-word model"
|
|
! grep -q " lib/.*libsherpa" <<<"$files" || fail "the fdroid build carries the wake-word engine"
|
|
else
|
|
[ "$(wc -l <<<"$models")" = 3 ] || fail "expected the three model files in assets/wakeword"
|
|
! awk '$2 != "Stored"' <<<"$models" | grep -q . || fail "a model file is compressed (the engine's files must be stored)"
|
|
grep -q " assets/wakeword/version$" <<<"$files" || fail "no assets/wakeword/version"
|
|
grep -q " lib/arm64-v8a/libsherpa-onnx-jni.so$" <<<"$files" || fail "no arm64 wake-word engine"
|
|
fi
|
|
if [ "$release" = release ]; then
|
|
! grep -q " lib/x86" <<<"$files" || fail "a release must carry no x86 library"
|
|
fi
|
|
size="$(stat -c %s "$apk")"
|
|
echo "check-apk: $(basename "$apk"): $kind${release:+ $release}, $((size / 1024 / 1024)) MB, as it should be"
|