From 2970c2dcfe42c334f7aa273e3770075f9ec540ca Mon Sep 17 00:00:00 2001 From: NINI Date: Mon, 5 Oct 2026 22:37:17 +0900 Subject: [PATCH] fix(android-qa): observe first home and production pause save --- tools/android/exercise-content.ps1 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/android/exercise-content.ps1 b/tools/android/exercise-content.ps1 index 335da7b..ff04fa0 100644 --- a/tools/android/exercise-content.ps1 +++ b/tools/android/exercise-content.ps1 @@ -46,7 +46,7 @@ function StartHome([string]$Name) { Adb @('shell','input','keyevent','224') | Out-Null Adb @('shell','am','start','-W','-n',$activity) | Out-Null $observations=[Collections.Generic.List[object]]::new() - $ready=$false + $ready=$false; $pauseRequested=$false Add-Type -AssemblyName System.Drawing for($attempt=0;$attempt-lt30;$attempt++) { $pidText=Adb @('shell','pidof',$package) @@ -64,10 +64,25 @@ function StartHome([string]$Name) { if($pixel.R-ge200-and$pixel.G-ge130-and$pixel.B-le120){$gold++} if($y-le6-and$pixel.R-lt110-and$pixel.G-lt110-and$pixel.B-lt110){$dark++} }} + $dark=0 + for ($y=[int]($image.Height*.17); $y -lt [int]($image.Height*.28); $y+=4) { + for ($x=[int]($image.Width*.39); $x -lt [int]($image.Width*.61); $x+=4) { + $pixel=$image.GetPixel($x,$y) + if ($pixel.R -lt 110 -and $pixel.G -lt 110 -and $pixel.B -lt 110) { $dark++ } + } + } $homeButton=0; foreach($px in @(.36,.64)){foreach($py in @(.53,.61)){$p=$image.GetPixel([int]($image.Width*$px),[int]($image.Height*$py));if($p.R-ge200-and$p.G-ge130-and$p.B-le120){$homeButton++}}} - $ui=$image.Width-gt$image.Height-and$sky-ge200-and$gold-ge10-and$dark-ge2-and$homeButton-eq4 - $observations.Add(@{attempt=$attempt;utc=[DateTime]::UtcNow.ToString('o');pid=$pidText;validAppSave=$validSave;landscape=($image.Width-gt$image.Height);skySamples=$sky;goldButtonSamples=$gold;titleDarkSamples=$dark;homeButtonSamples=$homeButton;readyUi=$ui;png=$png}) + $ui=$image.Width-gt$image.Height-and$sky-ge200-and$gold-ge10-and$dark-ge20-and$homeButton-eq4 + $observations.Add(@{attempt=$attempt;utc=[DateTime]::UtcNow.ToString('o');pid=$pidText;validAppSave=$validSave;landscape=($image.Width-gt$image.Height);skySamples=$sky;goldButtonSamples=$gold;titleDarkSamples=$dark;titleBoundsNormalized=@(.39,.17,.61,.28);titleStridePixels=4;homeButtonSamples=$homeButton;readyUi=$ui;png=$png}) } finally {$image.Dispose()} + if ($pidText -match '^\d+' -and $ui -and !$validSave -and !$pauseRequested) { + $observations[$observations.Count-1] | ConvertTo-Json -Depth 6 | Set-Content -LiteralPath (Join-Path $EvidenceDir "$Name-first-home-without-save.json") -Encoding utf8 + Check "$Name-first-home-ui" $true 'Actual first Home title/button/PID observed before production pause creates save' + Adb @('shell','input','keyevent','3') | Out-Null + Start-Sleep -Milliseconds 500 + Adb @('shell','am','start','-W','-n',$activity) | Out-Null + $pauseRequested=$true + } if($pidText-match'^\d+'-and$validSave-and$ui){$ready=$true;$saveText|Set-Content (Join-Path $EvidenceDir "$Name-ready-save.json") -Encoding utf8;break} } $observations.ToArray()|ConvertTo-Json -Depth 6|Set-Content (Join-Path $EvidenceDir "$Name-readiness.json") -Encoding utf8