diff --git a/tools/android/exercise-content.ps1 b/tools/android/exercise-content.ps1 index ff04fa0..72fdacb 100644 --- a/tools/android/exercise-content.ps1 +++ b/tools/android/exercise-content.ps1 @@ -119,10 +119,15 @@ function StartAudio([string]$Name,[int]$Seconds) { Start-Sleep -Milliseconds 100 } Check "audio-ready-$Name" $ready 'Recorder reported actual Recording started before interaction' - Adb @('shell','cmd','audio','set-volume','3','15') | Out-Null - $route=Adb @('shell','dumpsys','audio') + for ($attempt=0; $attempt -lt 20; $attempt++) { + Adb @('shell','cmd','audio','set-volume','3','15') | Out-Null + $route=Adb @('shell','dumpsys','audio') + $route | Set-Content -LiteralPath (Join-Path $EvidenceDir "$Name-active-route-$attempt.txt") -Encoding utf8 + $current=[regex]::Match($route,'(?s)- STREAM_MUSIC:.*?Current: ([^\r\n]+)').Groups[1].Value + if ($current -match '8000 \(remote_submix\): 15') { break } + Start-Sleep -Milliseconds 250 + } $route | Set-Content -LiteralPath (Join-Path $EvidenceDir "$Name-active-route.txt") -Encoding utf8 - $current=[regex]::Match($route,'(?s)- STREAM_MUSIC:.*?Current: ([^\r\n]+)').Groups[1].Value Check "audio-active-route-$Name" ($current -match '8000 \(remote_submix\): 15') $current } function CompareAudio([string]$Name,[string[]]$Ids) {