Skip to content

Commit

Permalink
Add additional logging and fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jun 29, 2023
1 parent 8fde2d0 commit 7d898d2
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public class DeviceTest: BaseTest
protected static bool IsDeviceAttached (bool refreshCachedValue = false)
{
if (string.IsNullOrEmpty (_shellEchoOutput) || refreshCachedValue) {
// run this twice as sometimes the first time returns the
// device as "offline".
RunAdbCommand ("devices");
var devices = RunAdbCommand ("devices");
TestContext.Out.WriteLine ($"LOG adb devices: {devices}");
_shellEchoOutput = RunAdbCommand ("shell echo OK", timeout: 15);
}
return _shellEchoOutput.Contains ("OK");
Expand Down Expand Up @@ -58,11 +63,14 @@ public void DeviceSetup ()
DeviceAbi = RunAdbCommand ("shell getprop ro.product.cpu.abilist64").Trim ();

if (string.IsNullOrEmpty (DeviceAbi))
DeviceAbi = RunAdbCommand ("shell getprop ro.product.cpu.abi") ?? RunAdbCommand ("shell getprop ro.product.cpu.abi2");
DeviceAbi = (RunAdbCommand ("shell getprop ro.product.cpu.abi") ?? RunAdbCommand ("shell getprop ro.product.cpu.abi2")) ?? "x86_64";

if (DeviceAbi.Contains (",")) {
DeviceAbi = DeviceAbi.Split (',')[0];
}
} else {
TestContext.Out.WriteLine ($"LOG GetSdkVersion: {DeviceSdkVersion}");
DeviceAbi = "x86_64";
}
} catch (Exception ex) {
Console.Error.WriteLine ("Failed to determine whether there is Android target emulator or not: " + ex);
Expand Down

0 comments on commit 7d898d2

Please sign in to comment.