From 452dca0a13aff357b0a5d75d4c9cc3c69ddca188 Mon Sep 17 00:00:00 2001 From: HKLHaoBin Date: Sat, 13 Jun 2026 23:34:54 +0800 Subject: [PATCH] fix(scripts): improve android-ui-verify uninstall and screencap on Windows Co-authored-by: Cursor --- openless-all/app/scripts/android-ui-verify.ps1 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openless-all/app/scripts/android-ui-verify.ps1 b/openless-all/app/scripts/android-ui-verify.ps1 index 9a125368..3f33a802 100644 --- a/openless-all/app/scripts/android-ui-verify.ps1 +++ b/openless-all/app/scripts/android-ui-verify.ps1 @@ -58,7 +58,11 @@ if (-not $apk) { Write-Host "Installing $($apk.FullName) ..." adb logcat -c -adb install -r $apk.FullName +adb shell pm uninstall --user 0 com.openless.app 2>$null +if ($LASTEXITCODE -ne 0) { + adb uninstall com.openless.app 2>$null +} +adb install $apk.FullName Write-Host "Starting MainActivity ..." adb shell am start -n com.openless.app/.MainActivity @@ -73,9 +77,11 @@ adb shell dumpsys package com.openless.app | Set-Content -Path (Join-Path $Proje function Capture-Screen([string]$label) { $out = Join-Path $shotDir "openless-screenshot-$label-$stamp.png" - $bytes = adb exec-out screencap -p - if ($bytes) { - [System.IO.File]::WriteAllBytes($out, $bytes) + $tmp = Join-Path $env:TEMP "openless-screencap-$label.png" + adb shell screencap -p /sdcard/openless-ui-$label.png + adb pull /sdcard/openless-ui-$label.png $tmp | Out-Null + if (Test-Path $tmp) { + Move-Item -Force $tmp $out Write-Host "Screenshot: $out" } }