feat: 新增获取前台应用,oppo输入法切换兼容性适配。新增切换输入法方法

This commit is contained in:
余泓铮
2024-06-24 16:42:26 +08:00
parent 02a8783223
commit d084066354
6 changed files with 78 additions and 12 deletions

View File

@@ -159,15 +159,8 @@ type AndroidDevice struct {
}
func (dev *AndroidDevice) Init() error {
brand, err := dev.d.Brand()
if err != nil {
return fmt.Errorf("failed to init android device. brand is null %v", err)
}
if strings.ToLower(brand) == "oppo" {
// 启动一次io.appium.settings。防止oppo设备上切换输入法失败
myexec.RunCommand("adb", "-s", dev.SerialNumber, "shell",
"monkey", "-p", "io.appium.settings", "-c", "android.intent.category.LAUNCHER", "1")
}
myexec.RunCommand("adb", "-s", dev.SerialNumber, "shell",
"ime", "enable", "io.appium.settings/.UnicodeIME")
myexec.RunCommand("adb", "-s", dev.SerialNumber, "shell", "rm", "-r", env.DeviceActionLogFilePath)
return nil
}