fix(android): show conversation in screenshot fixture (#111000)

* fix(android): seed screenshot chat history

* fix(android): update screenshot chat readiness

* fix(android): use visible screenshot chat marker

* style(android): format screenshot script test

* fix(android): pin screenshot timezone

* fix(android): restore screenshot timezone
This commit is contained in:
Peter Steinberger
2026-07-18 17:02:29 -07:00
committed by GitHub
parent a68fdad8f5
commit 68ec50d643
4 changed files with 147 additions and 7 deletions

View File

@@ -47,6 +47,9 @@ DISPLAY_OVERRIDDEN=0
ORIGINAL_WM_SIZE=""
ORIGINAL_WM_DENSITY=""
SCREENSHOT_DENSITY=""
TIMEZONE_OVERRIDDEN=0
ORIGINAL_AUTO_TIME_ZONE=""
ORIGINAL_TIME_ZONE=""
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -151,6 +154,18 @@ restore_device_display() {
fi
}
restore_device_timezone() {
if [[ "$TIMEZONE_OVERRIDDEN" != "1" || -z "${ADB_BIN:-}" || -z "${ADB_SERIAL:-}" ]]; then
return
fi
if [[ -n "$ORIGINAL_TIME_ZONE" ]]; then
"$ADB_BIN" -s "$ADB_SERIAL" shell cmd alarm set-timezone "$ORIGINAL_TIME_ZONE" >/dev/null 2>&1 || true
fi
if [[ "$ORIGINAL_AUTO_TIME_ZONE" == "true" || "$ORIGINAL_AUTO_TIME_ZONE" == "false" ]]; then
"$ADB_BIN" -s "$ADB_SERIAL" shell cmd time_zone_detector set_auto_detection_enabled "$ORIGINAL_AUTO_TIME_ZONE" >/dev/null 2>&1 || true
fi
}
cleanup_emulator_log() {
if [[ -n "$EMULATOR_LOG" && -f "$EMULATOR_LOG" ]]; then
rm -f "$EMULATOR_LOG"
@@ -159,6 +174,7 @@ cleanup_emulator_log() {
cleanup() {
restore_device_display
restore_device_timezone
cleanup_started_emulator
cleanup_emulator_log
}
@@ -333,6 +349,22 @@ wait_for_explicit_device() {
stabilize_device_for_screenshots() {
local adb="$1"
local serial="$2"
ORIGINAL_AUTO_TIME_ZONE="$("$adb" -s "$serial" shell cmd time_zone_detector is_auto_detection_enabled 2>/dev/null | tr -d '\r')"
ORIGINAL_TIME_ZONE="$("$adb" -s "$serial" shell getprop persist.sys.timezone 2>/dev/null | tr -d '\r')"
if [[ "$ORIGINAL_AUTO_TIME_ZONE" != "true" && "$ORIGINAL_AUTO_TIME_ZONE" != "false" ]]; then
echo "Could not determine emulator automatic timezone setting." >&2
return 1
fi
if [[ -z "$ORIGINAL_TIME_ZONE" ]]; then
echo "Could not determine emulator timezone." >&2
return 1
fi
# Arm cleanup before the first mutation; restoring an unchanged snapshot is safe.
TIMEZONE_OVERRIDDEN=1
# Seeded chat timestamps use the device timezone, so disable detection before
# pinning UTC to avoid inheriting the runner's locale.
"$adb" -s "$serial" shell cmd time_zone_detector set_auto_detection_enabled false >/dev/null
"$adb" -s "$serial" shell cmd alarm set-timezone UTC >/dev/null
"$adb" -s "$serial" shell settings put global window_animation_scale 0 >/dev/null 2>&1 || true
"$adb" -s "$serial" shell settings put global transition_animation_scale 0 >/dev/null 2>&1 || true
"$adb" -s "$serial" shell settings put global animator_duration_scale 0 >/dev/null 2>&1 || true
@@ -404,7 +436,6 @@ boot_emulator() {
serial="$(wait_for_single_device "$adb")"
wait_for_boot_completed "$adb" "$serial"
stabilize_device_for_screenshots "$adb" "$serial"
ADB_SERIAL="$serial"
}
@@ -416,7 +447,6 @@ resolve_device() {
if [[ -n "$DEVICE" ]]; then
wait_for_explicit_device "$adb" "$DEVICE"
stabilize_device_for_screenshots "$adb" "$DEVICE"
ADB_SERIAL="$DEVICE"
return
fi
@@ -429,7 +459,6 @@ resolve_device() {
echo "Stop it so the script can boot '${AVD}', or pass --device '${devices}' to override the no-cutout profile." >&2
return 1
fi
stabilize_device_for_screenshots "$adb" "$devices"
ADB_SERIAL="$devices"
return
fi
@@ -452,7 +481,9 @@ latest_play_debug_apk() {
scene_ready_text() {
case "$1" in
home) printf '%s\n' "Overview" ;;
chat) printf '%s\n' "Ready when you are" ;;
# The screenshot fixture seeds chat history and restores at the latest user
# turn, so wait for that visible anchor instead of empty-chat copy.
chat) printf '%s\n' "Draft a short status update for the team." ;;
voice) printf '%s\n' "Ready to talk" ;;
settings) printf '%s\n' "OpenClaw mobile" ;;
voice-wake) printf '%s\n' "Wake listener" ;;
@@ -568,6 +599,7 @@ fi
ADB_BIN="$(adb_bin)"
resolve_device "$ADB_BIN"
require_emulator_device "$ADB_BIN" "$ADB_SERIAL"
stabilize_device_for_screenshots "$ADB_BIN" "$ADB_SERIAL"
configure_screenshot_display "$ADB_BIN" "$ADB_SERIAL"
mkdir -p "$OUTPUT_DIR"
rm -f "$OUTPUT_DIR"/*.png "$OUTPUT_DIR"/*.jpg "$OUTPUT_DIR"/*.jpeg