Skip to content

Commit 40dddc5

Browse files
committed
fix: prime adb before native Android emulator boots
1 parent 856ae34 commit 40dddc5

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

scripts/prime_android_lab_adb.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Hosted Android readers occasionally enter the emulator action with no adb
5+
# daemon listening on 5037. Prime the production SDK bridge before an AVD is
6+
# launched. This is Lab-only orchestration: it never changes Nuvio runtime code,
7+
# app manifests, provider JS or player/network behavior.
8+
if ! command -v adb >/dev/null 2>&1; then
9+
echo "FIELD_NATIVE_ADB_PRIME status=missing_adb runtime_mutation=false" >&2
10+
exit 1
11+
fi
12+
13+
adb kill-server >/dev/null 2>&1 || true
14+
adb start-server >/dev/null
15+
16+
ready=0
17+
for _attempt in 1 2 3 4 5; do
18+
if adb devices >/tmp/niakvio-adb-devices.txt 2>/tmp/niakvio-adb-error.txt; then
19+
ready=1
20+
break
21+
fi
22+
sleep 1
23+
done
24+
25+
if [ "$ready" -ne 1 ]; then
26+
cat /tmp/niakvio-adb-error.txt >&2 || true
27+
echo "FIELD_NATIVE_ADB_PRIME status=unavailable runtime_mutation=false" >&2
28+
exit 1
29+
fi
30+
31+
echo "FIELD_NATIVE_ADB_PRIME status=ready port=5037 runtime_mutation=false"

0 commit comments

Comments
 (0)