mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 22:05:59 +00:00
cleanup (#764)
This commit is contained in:
1 parent
4163b31b02
commit
83ec5708ed
852 files changed
+4844
-46144
No files matched your search
@@ -1,6 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# axml_rename.py in.apk out.apk old=new ... : rewrite whole strings in AndroidManifest.xml's string
|
||||
# pool (binary XML), leaving every other entry of the apk byte-identical. Unsigned output.
|
||||
import struct, sys, zipfile
|
||||
|
||||
def dec_len8(b, o):
|
||||
|
||||
@@ -95,7 +95,6 @@ def required():
|
||||
|
||||
|
||||
def record(root=ROOT):
|
||||
# Refresh scripts even on a CI native-cache hit; these are source, not cached binaries.
|
||||
if root == ROOT:
|
||||
from check_session_assets import source_assets
|
||||
for source, asset in source_assets().items():
|
||||
@@ -112,7 +111,6 @@ def record(root=ROOT):
|
||||
gzip.decompress((root / path).read_bytes())
|
||||
except (OSError, EOFError) as error:
|
||||
raise ValueError('Invalid desktop removal inventory: ' + name) from error
|
||||
# Check inside the compressed payload, where a plain Gradle build used to ship no sinks.
|
||||
process = subprocess.Popen(['zstd', '-dc', str(root / paths['assets/pulseaudio.tzst'])], stdout=subprocess.PIPE)
|
||||
try:
|
||||
with tarfile.open(fileobj=process.stdout, mode='r|') as archive:
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# sign-apk.sh <in.apk> <variant> <out.apk>
|
||||
#
|
||||
# Turns a CI build (signed with the public AOSP testkey) into one package of tools/release/variants.txt
|
||||
# signed with DroidDeck's own key, carrying the hand-over from the testkey:
|
||||
# - v1 + v2 are signed by the testkey, v3 by our key, with a signed lineage testkey -> our key;
|
||||
# - an install from before (testkey) updates to it and keeps its data;
|
||||
# - the testkey loses its rollback right, so an apk signed with the testkey alone - which anyone
|
||||
# can make - is refused as an update to it (device-proven on the Pocket FIT, 2026-09-24);
|
||||
# - --rotation-min-sdk-version 28: the lineage applies from Android 9, not only from 13.
|
||||
#
|
||||
# The key comes from the environment and is never written anywhere but the path given:
|
||||
# RELEASE_KEYSTORE path to the PKCS12 keystore
|
||||
# RELEASE_STORE_PASSWORD its password (the key has the same one: PKCS12)
|
||||
# RELEASE_KEY_ALIAS the key's alias
|
||||
# BUILD_TOOLS Android build-tools dir (zipalign, apksigner, aapt)
|
||||
# RELEASE_SIGNER_SHA256 optional: the expected certificate digest, else keystore/release-signer.sha256
|
||||
set -euo pipefail
|
||||
|
||||
die() { echo "::error::$*" >&2; exit 1; }
|
||||
@@ -37,7 +21,6 @@ export TESTKEY_PASSWORD=android
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
|
||||
# The package name and everything the manifest derives from it; component class names stay.
|
||||
P=com.droiddeck.launcher
|
||||
if [ "$pkg" = "$P" ]; then
|
||||
python3 "$here/axml_rename.py" "$in" "$work/renamed.apk"
|
||||
@@ -50,7 +33,6 @@ fi
|
||||
got=$("$BUILD_TOOLS/aapt" dump badging "$work/renamed.apk" | sed -n "s/^package: name='\([^']*\)'.*/\1/p")
|
||||
[ "$got" = "$pkg" ] || die "$variant: the apk says package '$got', not '$pkg'"
|
||||
if [ "$pkg" != "$P" ]; then
|
||||
# A provider left on the old authority would clash with the standard app installed beside it.
|
||||
tree=$("$BUILD_TOOLS/aapt" dump xmltree "$work/renamed.apk" AndroidManifest.xml)
|
||||
grep -E 'android:(authorities|taskAffinity)' <<<"$tree" | grep -F "\"$P." \
|
||||
&& die "$variant: the manifest still names $P in an authority or task"
|
||||
@@ -58,8 +40,6 @@ fi
|
||||
|
||||
"$BUILD_TOOLS/zipalign" -p -f 4 "$work/renamed.apk" "$work/aligned.apk"
|
||||
|
||||
# The lineage: the testkey vouches for our key. Made fresh each time (it is two certificates and
|
||||
# a signature, nothing secret beyond the key that signs it).
|
||||
"$BUILD_TOOLS/apksigner" rotate --out "$work/lineage" \
|
||||
--old-signer --ks "$TESTKEY" --ks-type PKCS12 --ks-pass env:TESTKEY_PASSWORD \
|
||||
--ks-key-alias testkey --key-pass env:TESTKEY_PASSWORD --set-rollback false \
|
||||
@@ -76,13 +56,9 @@ fi
|
||||
--out "$out" "$work/aligned.apk"
|
||||
rm -f "$out.idsig"
|
||||
|
||||
# What the apk must carry, checked rather than assumed.
|
||||
"$BUILD_TOOLS/apksigner" verify --min-sdk-version 26 "$out" >/dev/null || die "$variant: does not verify"
|
||||
# (Listed first, then searched: grep -q stops reading early, which fails a pipe under pipefail.)
|
||||
listing=$(unzip -l "$out")
|
||||
grep -qE 'META-INF/.*\.(SF|RSA)$' <<<"$listing" || die "$variant: no JAR signature (old installers)"
|
||||
# Android 9+ must see our key and only our key. apksigner labels signers "Signer #1", "Signer
|
||||
# (minSdkVersion=28, ...)" or "V3.0 Signer:" depending on its version; the digests are what count.
|
||||
certs=$("$BUILD_TOOLS/apksigner" verify --min-sdk-version 28 --print-certs "$out")
|
||||
v3=$(sed -n 's/^.*Signer.* certificate SHA-256 digest: //p' <<<"$certs" | sort -u)
|
||||
if [ "$v3" != "$expected" ]; then
|
||||
|
||||
@@ -368,8 +368,6 @@ def build_catalog(source: GitHub, ci: GitHub, source_repo: str, ci_repo: str) ->
|
||||
if version_code_text and version_code_text.isdigit():
|
||||
version_code = int(version_code_text)
|
||||
else:
|
||||
# Legacy test releases did not record it. If the PR did not change build.gradle,
|
||||
# the base value is exact; otherwise use the PR head's value.
|
||||
version_code = base_code
|
||||
try:
|
||||
changed = source.get(f"/repos/{source_repo}/pulls/{pr}/files?per_page=100")
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
# The packages a signed build ships as. The same apk, with only the manifest's package name (and
|
||||
# the names derived from it) changed: some phones give their performance modes only to apps with
|
||||
# certain names. Each is its own app to Android - installs beside the others, with its own data.
|
||||
#
|
||||
# name package file suffix
|
||||
standard com.droiddeck.launcher -
|
||||
pubg com.tencent.ig -pubg
|
||||
antutu com.antutu.benchmark.full -antutu
|
||||
|
||||
Reference in new issue
Block a user