Skip to content

Commit 810b39e

Browse files
committed
Improved adb wait
1 parent ffc657b commit 810b39e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

scripts/build-android-app.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,11 +1098,26 @@ adb_framework_ready_once() {
10981098
if [ -n "$service_status" ] && printf '%s' "$service_status" | grep -q "found"; then
10991099
service_ok=1
11001100
fi
1101+
1102+
# Success conditions - prioritize package manager over activity manager for API 35
1103+
if [ -n "$system_server" ] && [ $pm_ok -eq 1 ] && [ $pm_list_ok -eq 1 ] && [ $service_ok -eq 1 ]; then
1104+
ba_log "Android framework ready on $serial (system_server=$system_server; package manager operational)"
1105+
return 0
1106+
fi
1107+
1108+
# Fallback: if boot is complete and PM works, proceed even without full activity manager
1109+
if [ "$sys_boot" = "1" ] && [ $pm_ok -eq 1 ] && [ $pm_list_ok -eq 1 ]; then
1110+
local time_waiting=$((SECONDS - start_time))
1111+
if [ $time_waiting -ge 120 ]; then
1112+
ba_log "Android framework heuristically ready on $serial after ${time_waiting}s (system_server=$system_server; pm functional but activity_manager slow)"
1113+
return 0
1114+
fi
1115+
fi
11011116

1102-
if [ "$boot_ok" = "1" ] && [ "$dev_boot" = "1" ] && [ -n "$system_pid" ] \
1117+
# Original stricter check for early success
1118+
if [ "$boot_ok" = "1" ] && [ "$dev_boot" = "1" ] && [ -n "$system_server" ] \
11031119
&& [ $pm_ok -eq 1 ] && [ $cmd_ok -eq 1 ] && [ $service_ok -eq 1 ]; then
1104-
if [ $pm_list_ok -eq 1 ] || [ $activity_ok -eq 1 ] || [ $resolve_ok -eq 1 ]; then
1105-
ba_log "Android framework ready on $serial (system_server=$system_pid)"
1120+
if [ $pm_list_ok -eq 1 ] || [ $activity_ok -eq 1 ] || [ $resolve_ok -eq 1 ]; then ba_log "Android framework ready on $serial (system_server=$system_pid)"
11061121
return 0
11071122
fi
11081123

0 commit comments

Comments
 (0)