feat: polish Pakkit and strengthen release readiness
- Improve Wear splash, ongoing status, and progress focus - Refine browser accessibility and connection recovery - Add offline privacy and open-source notices - Harden installation approval and storage error handling - Expand emulator coverage and release artifact checks - Document Play publication gates and hardware validation
This commit is contained in:
34 files changed
+1027
-111
No files matched your search
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Audit the built release bundle and its merged manifest; this is not Play approval."""
|
||||
import hashlib
|
||||
import json
|
||||
import xml.etree.ElementTree as ET
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
ANDROID = '{http://schemas.android.com/apk/res/android}'
|
||||
bundle = ROOT / 'app/build/outputs/bundle/release/app-release.aab'
|
||||
manifest = ROOT / 'app/build/intermediates/merged_manifests/release/processReleaseManifest/AndroidManifest.xml'
|
||||
root = ET.parse(manifest).getroot()
|
||||
app = root.find('application')
|
||||
assert root.get('package') == 'meghdad.pakkit'
|
||||
assert root.find('uses-sdk').get(ANDROID + 'targetSdkVersion') == '36'
|
||||
assert root.find('uses-sdk').get(ANDROID + 'minSdkVersion') == '31'
|
||||
assert app.get(ANDROID + 'allowBackup') == 'false'
|
||||
assert app.get(ANDROID + 'debuggable', 'false') == 'false'
|
||||
assert any(e.get(ANDROID + 'name') == 'android.hardware.type.watch' and e.get(ANDROID + 'required') == 'true' for e in root.findall('uses-feature'))
|
||||
assert any(e.get(ANDROID + 'name') == 'com.google.android.wearable.standalone' and e.get(ANDROID + 'value') == 'true' for e in app.findall('meta-data'))
|
||||
permissions = {e.get(ANDROID + 'name') for e in root.findall('uses-permission')}
|
||||
expected = {'android.permission.' + p for p in ['REQUEST_INSTALL_PACKAGES', 'POST_NOTIFICATIONS', 'INTERNET', 'ACCESS_NETWORK_STATE', 'CHANGE_NETWORK_STATE', 'WAKE_LOCK', 'FOREGROUND_SERVICE', 'FOREGROUND_SERVICE_CONNECTED_DEVICE']}
|
||||
assert permissions == expected | {'meghdad.pakkit.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'}, permissions
|
||||
for component in app:
|
||||
if component.tag not in {'activity', 'receiver', 'service', 'provider'}:
|
||||
continue
|
||||
name = component.get(ANDROID + 'name')
|
||||
exported = component.get(ANDROID + 'exported') == 'true'
|
||||
if name.endswith('.WatchActivity'):
|
||||
assert exported and component.get(ANDROID + 'taskAffinity') == ''
|
||||
elif name == 'androidx.profileinstaller.ProfileInstallReceiver':
|
||||
assert exported and component.get(ANDROID + 'permission') == 'android.permission.DUMP'
|
||||
else:
|
||||
assert not exported, name
|
||||
if component.tag == 'service':
|
||||
assert component.get(ANDROID + 'foregroundServiceType') == 'connectedDevice'
|
||||
assert root.find('queries') is None
|
||||
with zipfile.ZipFile(bundle) as archive:
|
||||
names = archive.namelist()
|
||||
assets = sorted(n.removeprefix('base/assets/') for n in names if n.startswith('base/assets/') and not n.endswith('/'))
|
||||
assert assets == ['legal/licenses.txt', 'legal/privacy.txt', 'web/app.js', 'web/index.html', 'web/style.css'], assets
|
||||
for name in assets:
|
||||
assert archive.read('base/assets/' + name) == (ROOT / 'app/src/main/assets' / name).read_bytes(), name
|
||||
assert not any(n.endswith(('.apk', '.jks', '.keystore')) for n in names)
|
||||
native = [n for n in names if n.endswith('.so')]
|
||||
assert not native, 'Reassess 64-bit and 16 KB page support after adding native libraries'
|
||||
signed = any(n.upper().startswith('META-INF/') and n.upper().endswith(('.RSA', '.EC', '.DSA')) for n in names)
|
||||
lint_results = {}
|
||||
for variant in ['debug', 'release']:
|
||||
lint = ET.parse(ROOT / f'app/build/reports/lint-results-{variant}.xml').getroot()
|
||||
issues = lint.findall('issue')
|
||||
assert not any(i.get('severity') in {'Error', 'Fatal'} for i in issues)
|
||||
lint_results[variant] = [i.get('id') for i in issues if i.get('severity') == 'Warning']
|
||||
report = {
|
||||
'bundle': str(bundle.relative_to(ROOT)),
|
||||
'sha256': hashlib.sha256(bundle.read_bytes()).hexdigest(),
|
||||
'bytes': bundle.stat().st_size,
|
||||
'mergedManifestChecked': True,
|
||||
'targetSdk': 36,
|
||||
'minSdk': 31,
|
||||
'assetsMatchSource': assets,
|
||||
'nativeLibraries': native,
|
||||
'signaturePresent': signed,
|
||||
'signatureCryptographicallyVerified': False,
|
||||
'lintErrors': 0,
|
||||
'lintWarnings': lint_results,
|
||||
'publicationGates': ['Verify upload signing and enroll in Play App Signing', 'Hosted privacy policy and real support contact', 'Store artwork and Console declarations', 'Hardware and browser compatibility matrix', 'Restricted-permission, foreground-service and Wear quality review', 'Confirm transport and Data safety handling against policy'],
|
||||
}
|
||||
output = ROOT / 'app/build/reports/validation/release-audit.json'
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2) + '\n')
|
||||
print(json.dumps(report, indent=2))
|
||||
@@ -13,8 +13,11 @@ parser.add_argument("--watch", required=True, help="Wear OS emulator serial, e.g
|
||||
parser.add_argument("--browser", help="Optional Android emulator serial with Chrome initialized")
|
||||
parser.add_argument("--small", action="store_true", help="Run round UI tests at 192dp and 1.3x font size")
|
||||
parser.add_argument("--skip-build", action="store_true")
|
||||
parser.add_argument("--restart", action="store_true", help="After browser receipt, kill the background debug process and verify review recovery")
|
||||
parser.add_argument("--large", action="store_true", help="Use app/build/qa/large-fixture.apk for the real browser upload")
|
||||
args = parser.parse_args()
|
||||
if args.restart and not args.browser:
|
||||
parser.error("--restart requires --browser.")
|
||||
if args.browser == args.watch:
|
||||
parser.error("Use distinct Wear OS and Android browser emulator serials.")
|
||||
for serial in filter(None, [args.watch, args.browser]):
|
||||
@@ -52,7 +55,7 @@ try:
|
||||
print(output, flush=True)
|
||||
screenshots = report_dir / ("watch-product-small" if args.small else "watch-product")
|
||||
screenshots.mkdir(exist_ok=True)
|
||||
for name in ["home", "scan", "browser-approval", "sending", "checking", "ready", "installing", "confirm", "failed", "installed"]:
|
||||
for name in ["home", "privacy", "scan", "browser-approval", "sending", "checking", "ready", "installing", "confirm", "failed", "installed"]:
|
||||
image = adb(args.watch, "exec-out", "cat", f"/sdcard/Android/data/meghdad.pakkit/files/product-review/{name}.png")
|
||||
(screenshots / f"{name}.png").write_bytes(image)
|
||||
|
||||
@@ -96,8 +99,19 @@ if args.browser:
|
||||
if browser_test.poll() is None:
|
||||
browser_test.terminate()
|
||||
browser_test.wait(timeout=10)
|
||||
if args.restart:
|
||||
# Kill only this debug app, in the background, on the explicitly selected emulator.
|
||||
adb(args.watch, "shell", "input", "keyevent", "KEYCODE_HOME")
|
||||
pid = adb(args.watch, "shell", "pidof", "meghdad.pakkit").decode().strip()
|
||||
if not pid.isdecimal():
|
||||
raise RuntimeError("Expected one Pakkit debug process.")
|
||||
adb(args.watch, "shell", "run-as", "meghdad.pakkit", "kill", "-9", pid)
|
||||
adb(args.watch, "shell", "am", "start", "-W", "-n", "meghdad.pakkit/.ui.WatchActivity")
|
||||
tap_text(args.watch, "Remove file")
|
||||
if args.restart:
|
||||
tap_text(args.watch, "Start receiving")
|
||||
assert session_url(args.watch).endswith(":8787/")
|
||||
(report_dir / "process-recovery.txt").write_text("PASS: background process killed after signed APK receipt; private review recovered, receiving required an explicit restart, fixed port reused.\n")
|
||||
tap_text(args.watch, "Stop receiving")
|
||||
finally:
|
||||
if args.large:
|
||||
|
||||
Reference in new issue
Block a user