#!/usr/bin/env bash # qa/entrypoint_smoke.sh — Cold-start / entry-point launch-integrity smoke. # # WHY THIS EXISTS: a whole bug class makes the app "open and immediately close" on a REAL notification # cold-start (e.g. the splash-exit `provider.iconView` NPE — the OS hands over a splash with no icon on # the notification/PendingIntent launch path). It breaks EVERY notification at once (shared cold-start # path) yet is invisible to `adb am start` (different launch path) and to the normal launcher icon. # The only reliable catch is a real push, delivered to a genuinely killed app (`am kill`, NOT # `am force-stop` — force-stopped apps are excluded from FCM), tapped from the shade. # # For each entry the app must: OPEN, STAY UP (process alive, 0 FATAL), and land OFF the launcher. # Emulator FCM-to-killed-app is flaky (FcmRetry); undeliverable cases are reported BLOCKED, not FAIL — # only an actual open-and-close / crash is a FAIL. # # Usage: qa/entrypoint_smoke.sh [recipient_uid] # qa/entrypoint_smoke.sh emulator-5556 imDjjOTTQvXGGjyUhUc5JSeHWkU2 # Env overrides: PKG, SA_JSON, COUPLE_ID. # Runtime: ~3–7 min (flaky emulator FCM adds retries). Run in the background and read the matrix. # Exit 0 only if zero FAIL (BLOCK = undeliverable push, environmental — rerun, not an app bug). set -u SERIAL="${1:-emulator-5554}" RUID="${2:-}" PKG="${PKG:-closer.app}" HERE="$(cd "$(dirname "$0")" && pwd)" export NODE_PATH="${NODE_PATH:-$HERE/../functions/node_modules}" PASS=0; FAIL=0; BLOCKED=0 adbs() { adb -s "$SERIAL" "$@"; } alive() { adbs shell pidof "$PKG" 2>/dev/null | tr -d '\r'; } crashed() { adbs logcat -d -t 1500 2>/dev/null | grep -E "FATAL EXCEPTION|getIconView|Force finishing.*$PKG" | grep -v AppsFilter | head -3; } on_launcher() { adbs shell dumpsys activity activities 2>/dev/null | grep -m1 "ResumedActivity" | grep -qi "launcher"; } ok() { echo " PASS $1"; PASS=$((PASS+1)); } bad() { echo " FAIL $1 [$2]"; FAIL=$((FAIL+1)); } blkd() { echo " BLOCK $1 [$2]"; BLOCKED=$((BLOCKED+1)); } verify() { #