Android-Auto-Api
Android-Auto-Api copied to clipboard
基于fragment切换后无法拿到新显示内容
切换后找不到按钮,明明在。已经使用android:accessibilityEventTypes="typeAllMask"
清除后台目标应用,从act.startActivity(act.packageManager.getLaunchIntentForPackage(TARGET_PROCESS))
进去执行查找的找不到,手动打开目标应用home到后台,再执行自动程序就正常了。已经使用waitforApp
act.startActivity(act.packageManager.getLaunchIntentForPackage(TARGET_PROCESS))
if(waitForApp(TARGET_PROCESS,5000).also { toast( if(it) "success" else "fail") })
试来试去,应该跟rootNodesOfAllWindows
方法有关,不知道什么原理,改代码让它走<=LOLLIPOP分支就好了
小米6 MIUI11.0.5 android版本9 api28
compileSdk33 targetSdk31
试来试去,应该跟
rootNodesOfAllWindows
方法有关,不知道什么原理,改代码让它走<=LOLLIPOP分支就好了 小米6 MIUI11.0.5 android版本9 api28 compileSdk33 targetSdk31
哥们,怎么操作的?直接把
fun rootNodesOfAllWindows(): ViewChildList =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ViewChildList().also { list ->
AutoApi.windows()?.sortedByDescending {
if (it.isActive) Int.MAX_VALUE else it.layer
}?.forEach { win ->
list.add(
win.root?.let { r -> ViewNode(r.also(AccessibilityNodeInfo::refresh)) }
)
} ?: list.add(activeWinNode())
}
} else {
ViewChildList().also { list ->
list.add(activeWinNode())
}
}
改成
fun rootNodesOfAllWindows(): ViewChildList =
ViewChildList().also { list ->
AutoApi.windows()?.sortedByDescending {
if (it.isActive) Int.MAX_VALUE else it.layer
}?.forEach { win ->
list.add(
win.root?.let { r -> ViewNode(r.also(AccessibilityNodeInfo::refresh)) }
)
} ?: list.add(activeWinNode())
}
吗?其他的不用动?还是继续用SF去查找控件吗?