#!/bin/sh # Start the emulator headlessly in the background. # Usage: sh tools/emulator_start.sh set -e cd "$(dirname "$0")/.." . ./android_env.sh # Check if already running if adb devices 2>/dev/null | grep -q "emulator"; then echo "Emulator already running." adb devices exit 0 fi echo "Starting emulator (headless, no audio)..." emulator -avd privacypin_test -no-window -no-audio -gpu swiftshader_indirect & EMULATOR_PID=$! echo "Emulator PID: $EMULATOR_PID" echo "Waiting for boot..." adb wait-for-device # Wait for boot_completed while [ "$(adb shell getprop sys.boot_completed 2>/dev/null)" != "1" ]; do sleep 2 done echo "Emulator booted and ready."