feat: check android uiautomator server running

This commit is contained in:
lilong.129
2024-10-11 21:32:06 +08:00
parent 37cbfacc2d
commit f8da26776a
3 changed files with 31 additions and 30 deletions
+8
View File
@@ -687,6 +687,14 @@ func (d *Device) IsPackageInstalled(packageName string) bool {
return builtin.Contains(packages, packageName)
}
func (d *Device) IsPackageRunning(packageName string) bool {
output, err := d.RunShellCommand("pidof", packageName)
if err != nil {
return false
}
return strings.TrimSpace(output) != ""
}
func (d *Device) ScreenCap() ([]byte, error) {
if d.HasFeature(FeatShellV2) {
return d.RunShellCommandV2WithBytes("screencap", "-p")