1*e07d83d3SAndroid Build Coastguard Worker#!/bin/bash 2*e07d83d3SAndroid Build Coastguard Workerecho "Waiting for emulator to start..." 3*e07d83d3SAndroid Build Coastguard Worker 4*e07d83d3SAndroid Build Coastguard Workerbootanim="" 5*e07d83d3SAndroid Build Coastguard Workerfailcounter=0 6*e07d83d3SAndroid Build Coastguard Workeruntil [[ "$bootanim" =~ "stopped" ]]; do 7*e07d83d3SAndroid Build Coastguard Worker bootanim=`adb -e shell getprop init.svc.bootanim 2>&1` 8*e07d83d3SAndroid Build Coastguard Worker let "failcounter += 1" 9*e07d83d3SAndroid Build Coastguard Worker # Timeout after 5 minutes. 10*e07d83d3SAndroid Build Coastguard Worker if [[ $failcounter -gt 300 ]]; then 11*e07d83d3SAndroid Build Coastguard Worker echo "Can not find device after 5 minutes..." 12*e07d83d3SAndroid Build Coastguard Worker exit 1 13*e07d83d3SAndroid Build Coastguard Worker fi 14*e07d83d3SAndroid Build Coastguard Worker sleep 1 15*e07d83d3SAndroid Build Coastguard Workerdone 16*e07d83d3SAndroid Build Coastguard Worker 17